Skip to content

fix: say column lineage needs dbt compile on a parse-only manifest - #56

Merged
ralphstodomingo merged 3 commits into
mainfrom
fix/parse-manifest-compile-note
Dec 1, 2026
Merged

ralphstodomingo merged 3 commits into
mainfrom
fix/parse-manifest-compile-note

Conversation

@ralphstodomingo

@ralphstodomingo ralphstodomingo commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On a dbt parse manifest (no compiled SQL), column lineage and reach can't be read. The plugin said "run dbt 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-report say what is missing, why (dbt parse writes none) and the command. Compiled manifests keep their wording. Nothing is Fusion-specific.

Claims

  • C1. Pane header: altimate-code's "No compiled SQL found — run dbt compile first" becomes "no compiled SQL for 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)". Other notes are unchanged.
  • C2. Column box: "N not traced (no compiled SQL, which dbt parse doesn't write: run dbt compile)".
  • C3. Band, per-edit note and report downstream: "N downstream models have no compiled SQL (dbt parse writes none; run dbt compile)".
  • C4. Claude's per-edit note on a model with no compiled_code and no column to trace adds "column reach unknown: the manifest has no compiled SQL for (dbt parse writes none); dbt compile traces it".
  • C5. Report upstream: when the model itself has no compiled SQL, that is the reason given, not "a constant, say". An unread ancestor, or any other reason, keeps the old wording.
  • C6. After Claude runs dbt compile, the pane reloads by itself with full column lineage and reach (the existing reload).

Residuals

  • R1. The pane doesn't compile on a key press, so the person still runs one command (or asks Claude to).
  • R2. A compile run outside Claude (another terminal) reloads the pane at Claude's next tool call or on r, as before.
  • R3. C4 doesn't apply to a manifest over 4 MiB (read through altimate-code); C1 to C3 and C5 do.
  • R4. fix: plain mods API use for the plugin directory inspection (MOD_CAPABILITY_USE_NOT_PLAIN) #51 moves lineage.tsx and task-impact.tsx into integrations.tsx; whichever lands second ports these strings.
  • R5. CHANGELOG entry under [Unreleased]; no version bump (left to the release PR).

Verification

Check Result
New or changed tests on 6674cd7 7 fail, as expected; the upstream test also checks that an unread ancestor, even one with the model's name, keeps the old line
claude plugin test, main 1480 pass / 3 fail (timing tests)
claude plugin test, branch 1488 pass / 3 fail: the same timing tests as main
tests/*.sh (8), pytest tests/ all pass; 65 passed
plugin validate --strict . pass
plugin validate --strict ./plugins/altimate-code fails as on main (ICON_MISSING, existing typecheck warnings); none new
Live, jaffle_shop DuckDB, dbt-core 1.11 parse C1 to C5 in pane, band, note, both reports
Live, dbt Fusion 2.0.12 parse the same text
Live, Claude runs dbt compile (Core, Fusion) pane reloads unpressed: confidence high, customer_id read by 2 models, 1 dashboard

Screenshots

dbt-core 1.11 dbt parse manifest, jaffle_shop on DuckDB.

Before After
Pane header pane header before pane header after
Column box column box before column box after

Task band after an edit:

task band after

dbt Fusion 2.0.12, same text · after Claude runs dbt compile, the pane reloads by itself:

Fusion pane header after pane after compile

🤖 Generated with Claude Code

https://claude.ai/code/session_01BXxzvpmBim7nhBFZE99CaJ

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
@ralphstodomingo ralphstodomingo self-assigned this Nov 28, 2026
@ralphstodomingo

Copy link
Copy Markdown
Contributor Author

@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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T13:27:13.243658Z 22d566e Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +630 to +631
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]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@ralphstodomingo

Copy link
Copy Markdown
Contributor Author

@codex review

Round 2 on 649c264: the P2 (an unread ancestor relabelling a compiled model's untraced column) is fixed. Please check the fix and the claims (C1–C6) and residuals (R1–R5) in the PR body again.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 ?? '')))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@ralphstodomingo

Copy link
Copy Markdown
Contributor Author

@codex review

Round 3 on 22d566e: the round-2 P2 (a same-named ancestor matched as the focus) is fixed by matching the focus's node index (its hop-0 column) instead of a name. Please check that and the claims (C1–C6) and residuals (R1–R5) in the PR body again.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 22d566e867

ℹ️ 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".

@ralphstodomingo
ralphstodomingo marked this pull request as ready for review November 30, 2026 04:35
)}
{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>}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?? '')))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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\`)`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kilo-code-bot

kilo-code-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 5 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 4
Issue Details (click to expand)

WARNING

File Line Issue
plugins/altimate-code/hooks/lineage.tsx 1777 Pane rewrites an answer-wide note that can name another node as if the focused model lacks compiled SQL

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/lineage.tsx 1148 New note suppressed when the older reach fallback yields an empty reach object
plugins/altimate-code/hooks/impact-report.ts 633 Upstream answer without a hop-0 column still gets the "a constant, say" wording
plugins/altimate-code/hooks/impact-report.ts 309 Message asserts dbt parse as the cause; selective compiles also leave nodes without compiled SQL
plugins/altimate-code/hooks/lineage-graph.ts 43 Legacy raw_sql manifests are never marked uncompiled
Files Reviewed (10 files)
  • plugins/altimate-code/CHANGELOG.md - 0 issues
  • plugins/altimate-code/README.md - 0 issues
  • plugins/altimate-code/hooks/impact-report.test.ts - 0 issues
  • plugins/altimate-code/hooks/impact-report.ts - 2 issues
  • plugins/altimate-code/hooks/lineage-graph.test.ts - 0 issues
  • plugins/altimate-code/hooks/lineage-graph.ts - 1 issue
  • plugins/altimate-code/hooks/lineage.test.tsx - 0 issues
  • plugins/altimate-code/hooks/lineage.tsx - 2 issues
  • plugins/altimate-code/hooks/task-impact.test.tsx - 0 issues
  • plugins/altimate-code/types/index.d.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash-1017 · Input: 159.8K · Output: 46K · Cached: 6.3M

@hkaltai hkaltai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peer review (Claude + Codex Sol 6.1 + lead), with one convergence round. No blocking issues; approving. Two minor points are inline.

Nits

  • hooks/lineage.tsx L1147: the comment says the hint is for when "no column of the model was found to trace". The condition node.uncompiled && !reach && !carried.length also holds when touched columns all ended up in unchecked, so Claude gets this line next to "columns not checked (over the limit, ...)". Both statements are true. Either add && !unchecked.length or 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 via include_graph has no uncompiled; 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>}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 } : {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ralphstodomingo
ralphstodomingo merged commit e9a26dd into main Dec 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants