Repository navigation
fix: the lineage pane reloads by itself when a compile rewrites the manifest - #52
Conversation
…anifest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a reload A reload that failed was retried by every later tool call; each rewrite of the manifest is now tried once, and a failure says so. A reload no longer claims the pane over a follow that is in flight or starts meanwhile, and no longer makes a shell command's own reads give up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… has gone Overlapping reloads of two rewrites cancelled each other without either landing; a reload now waits for the one reading. A manifest removed before the reload reads it no longer replaces the graph with the SQL files' lineage. The README says the pane reloads by itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… or SQL-files graph Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…conversation blocks nothing A manifest removed before the reload reads it now says so instead of staying silent. The record of a reload being read is scoped to its conversation, so one left pending by /clear no longer stops the next conversation's reloads. A reload's message is written only while no newer follow has started, also when the write is retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e reloaded manifest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Approved at head 8f01b55 by two independent reviewers: |
…conversation, the shell cascade Tests hold a manifest stat, a manifest read or a file lookup to put a follow before, during or after a reload; each guard in the reload fails one of them when removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Approved at head 3d0f5cd by two independent reviewers: |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Incremental review of Previous Review Summary (commit 3d0f5cd)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 3d0f5cd)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (4 files)
Reviewed by deepseek-v4.1-flash-1017 · Input: 64.9K · Output: 19.8K · Cached: 722.2K |
…, and the changelog names when a rewrite is tried again Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Approved at 0702151 by claude -p and codex gpt-6.1-sol. No blocking finding introduced by this PR. Tests (hooks/lineage.test.tsx, hooks/lineage-graph.test.ts): 218 pass, 0 fail; the new test fails with the fix removed (217 pass, 1 fail). |
sahrizvi
left a comment
There was a problem hiding this comment.
Approve. Consensus review by Claude (lead) and Codex. No critical or major finding is open.
The pane reloads after an ordinary dbt compile, run, build and parse of the shown model, and the out-of-date warning clears without r. I checked this live, in Claude Code 2.1.332 with real Bash tool calls on a DuckDB dbt project, at this head and on a merge with #54. The pane never opens, takes focus or moves to another model by itself. A tool call that leaves the manifest unchanged costs one stat and no parse. A reload sends nothing to the warehouse server.
Two minors remain, both commented inline. Neither blocks:
- Same-mtime or backdated manifest rewrites are not reloaded. This is an edge case: base shows the same stale graph with no warning, and sequential dbt runs on APFS, ext4 or NTFS never land within one mtime.
- The warehouse lineage the person asked for disappears after a reload. This is UX only: nothing is sent,
rrestores it, and it is safe to fix in a follow-up.
Nits, the live-check table, the race probes, the cost measurement and the mutation results are in a separate PR comment.
| */ | ||
| async function reloadIfRewritten($: EngineInterface, focus: LineageFocus): Promise<boolean> { | ||
| const stat = await $.fs.stat(focus.manifest).catch(() => null) | ||
| if (!stat || stat.mtimeMs <= focus.mtimeMs) return false |
There was a problem hiding this comment.
Minor (edge case; base gives the same result). A rewrite that keeps the manifest's mtime is never reloaded, and neither is one whose mtime moves backwards. Examples are two writes within one timestamp tick on a coarse filesystem, or an older manifest restored with cp -p. In both cases the pane keeps the old graph with no warning.
Kit probes show exactly the same outcome at base, because staleSql uses the same strict > comparison. So this is not a regression.
A half-written read that dbt finishes within the same mtime is suppressed by reloadAttempted. It keeps the old graph, the out-of-date warning and "Could not read … Press r to retry." until r. That is a missed reload with the warning still up.
This needs a concurrent dbt run in another terminal, or a filesystem with 1–2 s mtimes. On APFS every live rewrite reloaded.
A cheap follow-up: put stat.size in the revision, and compare with stat.mtimeMs !== focus.mtimeMs instead of <=, so a restore is read too.
| if (!input.auto && input.fromAnswer === undefined) askedFor = `${id}\u0000${manifest}` | ||
| if (!input.auto && !input.reload && input.fromAnswer === undefined) askedFor = `${id}\u0000${manifest}` | ||
| // A reload is no ask: the person's earlier ask does not carry over to the rewritten manifest. | ||
| else if (input.reload) askedFor = null |
There was a problem hiding this comment.
Minor (UX, safe in a follow-up). After /lineage orders shows the warehouse section, the reload sets askedFor = null and clears warehouseAtom (isNew). So the section disappears at the next dbt compile, with nothing saying why.
Seen live with a stub MCP server offering table_lineage: /lineage orders made one call and showed "OBSERVED IN THE WAREHOUSE". A Bash dbt compile then reloaded the pane, the section vanished, and no new call was made. r brings it back. Before this PR the stale pane kept it.
Not sending again is the right call. But the person could be told: keep the earlier view while the relation is unchanged, or show a line such as "warehouse lineage: press r".
The test "a rewritten manifest does not re-send the table…" checks only the call count.
Consensus review of
|
| Tree | Command | Expected | Seen |
|---|---|---|---|
| head | edit orders.sql, then dbt compile |
reload, warning clears | reloaded, new column shown, warning gone |
| head | edit, then dbt run / dbt build |
reload | reloaded |
| head | edit, then dbt parse |
reload | reloaded; "No compiled SQL found — run dbt compile first" |
| head | edit, then dbt compile -s customers |
stays on orders |
stayed on orders, reloaded |
| head | edit, then dbt compile --target-path other_target |
no reload, warning stays | warning stays |
| head | pane closed, then dbt compile |
not reopened | not reopened |
| head | target/ symlinked, edit, compile |
reload | reloaded |
| head | no manifest (SQL-files pane), then dbt parse |
switches to the manifest | switched |
| merge #52+#54 | Bash edit (compile & validate writes target/.altimate-plugin/) |
no reload, warning stays | target/manifest.json untouched, no reload, warning stays |
| merge #52+#54 | dbt compile, edit && dbt run, edit && dbt build, -s customers, closed pane |
as on head | as on head |
A reload made no table_lineage call. A stub MCP server logged one call for /lineage and none for any reload. Lineage added nothing to Claude's context.
Races (kit probes):
- A reload overlapping
r, overlapping/lineage stg_customers, or held across/clearlands once, or gives way correctly. - A manifest deleted and then recreated is reloaded once it is back.
- The only silent stale cases are same-mtime and backwards-mtime rewrites, and base shares them (see the inline comment).
Cost. Over 10 unchanged tool calls: 10 manifest stats and 0 reads. On a 50 MB manifest a stat takes about 0.07–0.09 ms, against 57 ms for one read and parse. Unchanged calls made 0 CLI calls.
Suites (claude plugin test):
| Tree | Pass | Fail |
|---|---|---|
| head | 1439 | 1 |
| base | 1424 | 1 |
| merge #52+#54 | 1473 | 0 |
- The one failure is the known flaky runs test, "a dbt call that starts while another call reads its artifact", which also fails at base.
tests/*.shand pytest (65) pass everywhere.validate --strict plugins/altimate-codegives the same result as base.- fix: the lineage pane reloads by itself when a compile rewrites the manifest #52 and fix: a Bash edit of a model gets compile & validate, as an Edit does #54 conflict only in
CHANGELOG.md(keep both lines).
…reload-after-compile # Conflicts: # plugins/altimate-code/CHANGELOG.md
Problem
The lineage pane shows
orders. Claude editsmodels/orders.sqland runsdbt compile. The pane keeps the pre-edit lineage and shows "⚠ orders.sql changed after the manifest was written: rundbt compile, then press r" until someone pressesror types/lineage orders, even though the compile has already rewritten the manifest. Earlier builds refreshed on their own, but only by accident: the plugin's own compile & validate run used to writetarget/manifest.json. Those runs now write undertarget/.altimate-plugin/, so that reload stopped happening.Cause
recheckStaleinhooks/lineage.tsxruns after every tool call. It compares the model file's mtime with the manifest mtime captured when the pane followed the model, but it never stats the manifest again. A newer manifest therefore went unnoticed, and onlyror/lineagecleared the warning.Fix
recheckStalefirst callsreloadIfRewritten. When the focused model's manifest is newer than the one shown, it re-follows the model the same wayrdoes, using areloadflag:rreads it at once.target/.altimate-plugin/, not thetarget/manifest.jsonthe pane follows, so they do not trigger a reload.If the SQL changed but the manifest didn't, the warning stays and
rworks as before.Tests (
hooks/lineage.test.tsx)/clearwhile a reload is still reading does not stop the next conversation's reloadsEach guard in the reload fails one of these tests when removed. The files this change touches (
lineage.test.tsx,lineage-graph.test.ts): 217 pass, 0 fail. The full suite on an earlier head of this branch had only the two failures that also fail onmain: "a line with a great many dbt calls is not read call by call" and "a dbt call that starts while another call reads its artifact".validate --strict ./plugins/altimate-codefails only with the validator'sICON_MISSINGwarning, the same asmain.🤖 Generated with Claude Code