Repository navigation
fix: say column lineage needs dbt compile on a parse-only manifest - #56
Conversation
A manifest from `dbt parse` has no compiled SQL, so column lineage and reach can't be read. The pane, its column box, the task band, the per-edit note and `/lineage-report` now say what is missing, why (`dbt parse` writes none) and the command (`dbt compile`): - the pane replaces altimate-code's "No compiled SQL found" with the reason and how the pane catches up (r, or a compile Claude runs); - the band, the note and the report's downstream say the unread models have no compiled SQL because `dbt parse` writes none; - Claude's per-edit note adds "column reach unknown" for an edited model with no compiled SQL and no column to trace (`GraphNode.uncompiled`); - the report's upstream gives the missing compiled SQL as the reason instead of "a constant, say". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BXxzvpmBim7nhBFZE99CaJ
|
@codex review Please review against the claims (C1–C6) and residuals (R1–R5) in the PR body: try to falsify each claim, and flag any compiled-manifest text that changed or any place the new wording could show for a reason other than missing compiled SQL. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6875c0935f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const uncompiled = read.length === 0 ? (up.unresolved ?? []).find(one => /no compiled sql/i.test(String(one?.reason ?? ''))) : undefined | ||
| if (uncompiled) return [[{ code: column }, ' in ', { code: model }, " can't be traced upstream: the manifest has no compiled SQL for ", { code: nameOf(up, uncompiled.model) }, ' (', { code: 'dbt parse' }, ' writes none). Run ', { code: 'dbt compile' }, ', then open the report again.'], ...others] |
There was a problem hiding this comment.
Match the missing-SQL reason to the focused model
When the focused model has compiled SQL but no traced upstream columns (for example, a constant output), an unrelated ancestor in up.unresolved with a missing-SQL reason triggers this replacement too. The predicate checks every unresolved model rather than the focus, so the report incorrectly attributes the untraced column to that ancestor's missing SQL and changes the compiled-model wording that C5 promises to preserve. Restrict this replacement to a missing-SQL entry for the focused model; keep unrelated unread ancestors in the existing uncertainty details.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 649c264: the swap now needs the model's own unresolved entry (nameOf(up, one.model) === model), so an unread ancestor leaves a compiled model's "a constant, say" line as it was. New test covers the ancestor-only case.
…e model itself An unread ancestor with no compiled SQL no longer relabels a compiled model's untraced column; it keeps "a constant, say". The task test's upstream answer now names the edited model, as altimate-code does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BXxzvpmBim7nhBFZE99CaJ
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 649c2648c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const others: Words[] = maybe ? [[`${maybe} more ${maybe === 1 ? 'model' : 'models'} upstream may also be a source: the value wasn't traced from ${maybe === 1 ? 'it' : 'them'}, and nothing rules ${maybe === 1 ? 'it' : 'them'} out. \u201cWhere else it may come from\u201d below says why.`]] : [] | ||
| // On a manifest from `dbt parse` the model itself is unread: no compiled SQL, which is the reason, not a constant. | ||
| // Only the model's own entry counts: an unread ancestor doesn't explain an untraced column of a compiled model. | ||
| const uncompiled = read.length === 0 && (up.unresolved ?? []).some(one => nameOf(up, one?.model) === model && /no compiled sql/i.test(String(one?.reason ?? ''))) |
There was a problem hiding this comment.
Match the unresolved model by unique ID rather than name
When a compiled model and an unread ancestor share a name across packages, this predicate still attributes the ancestor's missing SQL to the focused model. Fresh evidence is the existing same-named package/integration-test model coverage in impact-report.test.ts: using those distinct IDs with only the ancestor unresolved reproduces the incorrect missing-SQL message. The new ancestor-only test uses different names, so it misses this remaining case. Compare the unresolved node's ID with up.focus.model (or its model index with the hop-zero column's model index), rather than comparing display names.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 22d566e: the focus is now the node of the answer's hop-0 column, matched by index, so no name is compared. A same-named model from another package stays an ancestor; new test covers it.
The upstream swap now matches the unresolved entry to the node of the hop-0 column, as altimate-code marks the focus. An unread ancestor of the same name in another package keeps "a constant, say". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BXxzvpmBim7nhBFZE99CaJ
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
| )} | ||
| {columns?.note && <Text color="warning">⚠ {columns.note}</Text>} | ||
| {/* altimate-code's "No compiled SQL found" says what to run, not why or what then: a `dbt parse` manifest, and the reload. */} | ||
| {columns?.note && <Text color="warning">⚠ {/no compiled sql/i.test(columns.note) ? `no compiled SQL for ${node.name} in this manifest (\`dbt parse\` writes none), so its column lineage is unknown: run \`dbt compile\`, then press r (a compile Claude runs reloads the pane by itself)` : columns.note}</Text>} |
There was a problem hiding this comment.
WARNING: The pane blames the focused model from an answer-wide note
columns.note is only confidence_factors[0] (or errors[0]) for the whole dbt_lineage answer (lineage-graph.ts:435), not a fact tied to node. Factors can name another node: the test added at lineage.test.tsx:861 shows one about an ancestor ("ephemeral parent int_orders expanded"). So a compiled model whose parent has no compiled SQL (for example after dbt compile --select other) can carry a note with this phrase, and the pane now prints "no compiled SQL for " for the wrong model while discarding the original note. When the focused node is known to have compiled SQL (node.uncompiled === false), keep the original note; only rewrite it when node.uncompiled is true or unknown (the >4 MiB path).
| `- ${quoted(node.name)} feeds ${graph.truncated ? 'at least ' : ''}${plural(downstream, 'downstream model')} in all (${counts.direct} direct, ${counts.transitive} transitive), ${plural(counts.tests, 'test')}${counts.exposures.length ? ` and ${plural(counts.exposures.length, 'exposure')} (${listed(counts.exposures)})` : ''}.`, | ||
| ) | ||
| // A `dbt parse` manifest: no column of the model was found to trace, and the reason is worth Claude's offer of a compile. | ||
| if (node.uncompiled && !reach && !carried.length) lines.push(`- column reach unknown: the manifest has no compiled SQL for ${quoted(node.name)} (\`dbt parse\` writes none); \`dbt compile\` traces it`) |
There was a problem hiding this comment.
SUGGESTION: An empty older reach suppresses the new explanation
The guard tests !reach, so it does not fire when the fallback path (lineage.tsx:1078-1081) produced a reach object with no models. reachFromMetadata returns non-null for column_reach: { models: [] } (lineage-graph.ts:502-504), and that object both sets reach and marks the column traced. On a parse manifest served by an altimate-code without a column answer, the note keeps the confident "read by no model" line (1117) and never explains the missing compiled SQL. Gating on traced evidence instead, for example !carried.length && !reach?.models.length, matches the intent stated at 1093 ("never a confident zero").
| // Only the model's own entry counts (the node of its hop-0 column, not a name): an unread ancestor doesn't explain | ||
| // an untraced column of a compiled model. | ||
| const self = up.columns.find(one => one.hop === 0)?.model | ||
| const uncompiled = read.length === 0 && self !== undefined && (up.unresolved ?? []).some(one => one?.model === self && /no compiled sql/i.test(String(one?.reason ?? ''))) |
There was a problem hiding this comment.
SUGGESTION: No hop-0 column still falls back to "a constant, say"
self is taken only from a hop-0 column, so when an upstream answer has no hop-0 entry the new reason is skipped. That shape reaches this function unfiltered: traceFull stores the upstream answer as-is (task-impact.tsx:330-332), while downstream answers are gated on a hop-0 column (task-impact.tsx:309). Map up.focus?.model (a unique_id) to its node index in up.nodes as a fallback, so the case C5 promises to cover still holds when altimate-code omits the hop-0 row.
| } | ||
| const missing = (answer.unresolved ?? []).filter(one => /no compiled sql/i.test(String(one?.reason ?? ''))).length | ||
| if (missing > 0 && missing >= unread) return `not traced: ${count(missing, 'downstream model')} ${missing === 1 ? 'has' : 'have'} no compiled SQL (run \`dbt compile\`)` | ||
| if (missing > 0 && missing >= unread) return `not traced: ${count(missing, 'downstream model')} ${missing === 1 ? 'has' : 'have'} no compiled SQL (\`dbt parse\` writes none; run \`dbt compile\`)` |
There was a problem hiding this comment.
SUGGESTION: dbt parse is asserted as the cause, but the reason only says compiled SQL is missing
The engine reason is "no compiled SQL: run dbt compile" (task-impact.test.tsx:958); it does not say which dbt command wrote the manifest. Any selective build leaves nodes without compiled_code — the plugin documents exactly that at dbt-mods-core.ts:520-522 ("dbt rewrites manifest.json on every run with the compiled SQL of only the nodes that run compiled ... would drop the compiled SQL of every other model"). After dbt run --select stg_orders or dbt compile --select other, users and Claude are therefore told the manifest came from dbt parse, which is false, even though the advice to run dbt compile is right. Consider "the manifest has no compiled SQL for it", or consult inputs.manifest. The same heuristic and wording now appear at impact-report.ts:308,633 and lineage.tsx:1777,1918; one shared constant would keep them in step.
| columns, | ||
| ...(TEST_TYPES.has(type) ? { testColumn: testColumnOf(node), testOn: typeof node?.attached_node === 'string' ? node.attached_node : null } : {}), | ||
| // dbt writes a model's raw_code on every parse and its compiled_code only on a compile (or run, build, show). | ||
| ...(type === 'model' && typeof node?.raw_code === 'string' && !node?.compiled_code && !node?.compiled_sql ? { uncompiled: true as const } : {}), |
There was a problem hiding this comment.
SUGGESTION: Older manifests use raw_sql, so the flag misses them
The predicate accepts the legacy compiled_sql field but requires raw_code, which dbt wrote only from manifest schema v9 (dbt 1.5). An older parse manifest has raw_sql and no compiled_sql, so uncompiled stays unset and the new note never appears, even though the legacy case is clearly meant to be handled. Adding typeof node?.raw_sql === "string" to the raw SQL check makes the legacy handling symmetric.
Code Review SummaryStatus: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
Fix these issues in Kilo Cloud Reviewed by deepseek-v4.1-flash-1017 · Input: 159.8K · Output: 46K · Cached: 6.3M |
hkaltai
left a comment
There was a problem hiding this comment.
Peer review (Claude + Codex Sol 6.1 + lead), with one convergence round. No blocking issues; approving. Two minor points are inline.
Nits
hooks/lineage.tsxL1147: the comment says the hint is for when "no column of the model was found to trace". The conditionnode.uncompiled && !reach && !carried.lengthalso holds when touched columns all ended up inunchecked, so Claude gets this line next to "columns not checked (over the limit, ...)". Both statements are true. Either add&& !unchecked.lengthor make the comment match the condition.- README: "On a manifest from
dbt parse... the edit note Claude gets ... say that is why". The edit-note line doesn't appear on a manifest over 4 MiB (graph viainclude_graphhas nouncompiled; R3 in the PR body). Worth adding the 4 MiB limit to the README, as the README already does for the test count. - Missing tests: a partially compiled manifest (selective compile), a
raw_sql-only parse manifest, and an uncompiled model whose touched columns all end up unchecked.
| )} | ||
| {columns?.note && <Text color="warning">⚠ {columns.note}</Text>} | ||
| {/* altimate-code's "No compiled SQL found" says what to run, not why or what then: a `dbt parse` manifest, and the reload. */} | ||
| {columns?.note && <Text color="warning">⚠ {/no compiled sql/i.test(columns.note) ? `no compiled SQL for ${node.name} in this manifest (\`dbt parse\` writes none), so its column lineage is unknown: run \`dbt compile\`, then press r (a compile Claude runs reloads the pane by itself)` : columns.note}</Text>} |
There was a problem hiding this comment.
Minor — wording names the wrong cause on some compiled manifests
{columns?.note && <Text color="warning">⚠ {/no compiled sql/i.test(columns.note) ? `no compiled SQL for ${node.name} in this manifest (\`dbt parse\` writes none), ...` : columns.note}</Text>}This rewrite fires for any note matching no compiled sql. altimate-code sends that note for every model without compiled_code (native/dbt/lineage.ts, project-lineage.ts). That also happens on a manifest written by a selective dbt compile -s other / dbt run -s ... / dbt build -s ..., where unselected models have no compiled SQL. Someone who just ran a compile is then told the cause is dbt parse. The fix (dbt compile) is still right; only the stated cause is misleading. The same wording is used in the column box (L1918) and in unknownReach / upstreamWords in impact-report.ts.
Suggestion: state the cause without blaming a parse, e.g. no compiled SQL for X in this manifest (as after \dbt parse`, or a compile that didn't select it). Or use the parse wording only when the graph node is uncompiledand the manifest'smetadata.invocation_command` is a parse.
| columns, | ||
| ...(TEST_TYPES.has(type) ? { testColumn: testColumnOf(node), testOn: typeof node?.attached_node === 'string' ? node.attached_node : null } : {}), | ||
| // dbt writes a model's raw_code on every parse and its compiled_code only on a compile (or run, build, show). | ||
| ...(type === 'model' && typeof node?.raw_code === 'string' && !node?.compiled_code && !node?.compiled_sql ? { uncompiled: true as const } : {}), |
There was a problem hiding this comment.
Minor — pre-1.3 parse manifests are never marked uncompiled
...(type === 'model' && typeof node?.raw_code === 'string' && !node?.compiled_code && !node?.compiled_sql ? { uncompiled: true as const } : {}),The check still accepts the old compiled_sql key, but it requires raw_code. Manifests from dbt before 1.3 (schema ≤ v6) store the source as raw_sql, so a real parse manifest from those versions never gets uncompiled. On those manifests the new edit-note hint (lineage.tsx L1148) never fires. The model.shop.old fixture in lineage-graph.test.ts pairs raw_code with compiled_sql, which dbt never writes, so the test doesn't catch this.
Suggestion: typeof (node?.raw_code ?? node?.raw_sql) === 'string', or prefer dbt's own node.compiled === false when it is present. Make the fixture realistic (raw_sql + compiled_sql) and add a raw_sql-only parse case.
Summary
On a
dbt parsemanifest (no compiled SQL), column lineage and reach can't be read. The plugin said "rundbt compile" without saying why, Claude's per-edit note said nothing, and the report blamed "a constant, say". Now the pane, column box, band, per-edit note and/lineage-reportsay what is missing, why (dbt parsewrites none) and the command. Compiled manifests keep their wording. Nothing is Fusion-specific.Claims
dbt compilefirst" becomes "no compiled SQL for in this manifest (dbt parsewrites none), so its column lineage is unknown: rundbt compile, then press r (a compile Claude runs reloads the pane by itself)". Other notes are unchanged.dbt parsedoesn't write: rundbt compile)".dbt parsewrites none; rundbt compile)".compiled_codeand no column to trace adds "column reach unknown: the manifest has no compiled SQL for (dbt parsewrites none);dbt compiletraces it".dbt compile, the pane reloads by itself with full column lineage and reach (the existing reload).Residuals
Verification
claude plugin test, mainclaude plugin test, branchtests/*.sh(8),pytest tests/plugin validate --strict .plugin validate --strict ./plugins/altimate-codedbt compile(Core, Fusion)customer_idread by 2 models, 1 dashboardScreenshots
dbt-core 1.11
dbt parsemanifest, jaffle_shop on DuckDB.Task band after an edit:
dbt Fusion 2.0.12, same text · after Claude runs
dbt compile, the pane reloads by itself:🤖 Generated with Claude Code
https://claude.ai/code/session_01BXxzvpmBim7nhBFZE99CaJ