Repository navigation
fix: hands-on findings — real reach in the task band, hardcoded refs, shell edits, older doc gaps, pane follow and fit, package repos, value changes - #44
Conversation
… shell edits, older doc gaps, pane follow and fit, package repos, value changes - The task's manifest copies sit in target/ itself: altimate-code reads a seed's header from the folder above the manifest's, so a copy one folder deeper traced nothing through a select * and the band said 0 columns. A reach of 0 beside readers that may pass the column on unnamed is "not traced", never "every downstream model was read". - Compile and validate flags a model, seed or source named by its table instead of ref() or source(). - A model a shell command rewrites gets the per-edit impact note. - Only columns an edit made undocumented are its gaps; older ones are said once, quietly. - The lineage pane follows the edited model as the edit starts; a graph wider than the pane opens as its ends, with its dashboards named. - A package repo is compiled and validated from the project below it that installs it (integration_tests); missing packages are a one-line note. - With no select item changed, the band names the columns whose values change and their reach, else says values may change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| for (const [id, node] of Object.entries<any>(manifest?.nodes ?? {})) { | ||
| if (['model', 'seed', 'snapshot'].includes(node?.resource_type) && typeof node?.name === 'string') add(id, node, `{{ ref('${node.name}') }}`) | ||
| } | ||
| for (const [id, node] of Object.entries<any>(manifest?.sources ?? {})) { |
There was a problem hiding this comment.
WARNING: The hardcoded-relation check goes blind on manifests over 4 MiB
hardcodedRelations can only flag relations present in the manifest it is given, but for a manifest larger than MAX_MANIFEST_BYTES (dbt-mods.tsx:81) compileAndValidate passes the output of MANIFEST_SLICE (dbt-mods.tsx:294). That slice (a) never includes a sources key, so this loop always sees {}, and (b) keeps only the checked node's own parent_map/child_map neighbourhood (keep in MANIFEST_SLICE). A table written by hand instead of ref() is by definition not a parent in the manifest, so its node is normally not in the slice either. On a large project the new warning therefore never fires for the exact case it was added for (swapping {{ ref('x') }} for x), while hardcodedRelations still returns [], which reads as no hardcoded relations rather than not checked. Returning the relation catalogue from the slice (name/package_name/resource_type/relation_name for every model, seed, snapshot and source, plus sources) or reading it separately when the manifest is sliced would keep the check honest.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
|
|
||
| // An identifier part: double-quoted, backquoted, bracketed or bare. | ||
| const PART = String.raw`(?:"[^"]+"|` + '`[^`]+`' + String.raw`|\[[^\]]+\]|[A-Za-z_][\w$]*)` | ||
| const RELATION_AFTER = new RegExp(String.raw`\b(?:from|join)\s+(${PART}(?:\s*\.\s*${PART}){0,2})`, 'gi') |
There was a problem hiding this comment.
SUGGESTION: from inside a function call is read as a relation
RELATION_AFTER matches any from/join word, including the ones inside function arguments: extract(day from orders), trim(both ' ' from customers), substring(name from 1). When the identifier after it happens to equal a model, seed or source name, the edit gets a false hardcoded-relation warning and Claude's note tells it to put the ref() or source() back, i.e. to rewrite valid SQL. Blanking the argument lists of extract/trim/substring-style calls before matching, or requiring the keyword to start a clause, avoids that.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| if (!dirs.length) return null | ||
| // Files touched in the last minute, then each one's own time against the command's start. | ||
| const listed = await $.process.run(['find', ...dirs, '-name', '*.sql', '-type', 'f', '-mmin', '-1'], { timeoutMs: 10_000 }).catch(() => null) | ||
| const top = (await $.process.run(['git', '-C', root, 'rev-parse', '--show-toplevel'], { timeoutMs: 5_000 }).catch(() => null))?.stdout.trim() ?? '' |
There was a problem hiding this comment.
SUGGESTION: git rev-parse runs even when nothing changed
WRITES matches very common commands (python3, node, cp, mv, tee), so this runs after most shell calls in a dbt session. When find lists nothing the loop below is empty, but this git rev-parse still spawns a process; an early return (e.g. if (!listed?.stdout.trim()) return { root, files: [] }) skips that spawn and makes the empty path explicit. The returned root is also unused by the only caller.
There was a problem hiding this comment.
Fixed: git rev-parse now runs only when find listed a changed file (plugins/altimate-code/hooks/lineage.tsx:1189 found; the loop continues when it is empty).
| 'type_int type_float type_timestamp type_boolean quote_column int integer numeric decimal varchar text float double boolean').split(' '), | ||
| ) | ||
| // A changed line that filters or joins rather than computes a value. | ||
| const NOT_A_VALUE = /^\s*(?:where|and|or|on|from|join|left|right|inner|full|cross|group|order|having|limit|qualify|union|\)|\{%-?\s*(?:if|endif|for|endfor|else))\b/i |
There was a problem hiding this comment.
SUGGESTION: The ) alternative can never match
The whole group is followed by a word-boundary assertion, but ) is a non-word character, so the ) branch matches only when the parenthesis is immediately followed by a word character. Lines it was meant to skip, such as ) as total, or ) and status = ..., are followed by whitespace and so are scanned for column names anyway. Put the ) branch (and the Jinja {% branch) outside the word-boundary guard so lines starting with ) are really ignored.
There was a problem hiding this comment.
valueCandidates was rewritten in 09f3adc. It is now a plain word list from the lines the change added (plugins/altimate-code/hooks/impact-report.ts:102), and altimate-code's impact_analysis decides which words are the model's columns and what they reach. The band says "values may change", and names that reach nothing are dropped, so no 0 is ever shown. The clause/depth tracking this comment is about is gone at 031a5c1.
Code Review SummaryStatus: 15 Issues Found | Recommendation: Address before merge Incremental review of Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
Fix these issues in Kilo Cloud Previous Review Summaries (3 snapshots, latest commit f99db36)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit f99db36)Status: 10 Issues Found | Recommendation: Address before merge Incremental review of Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (6 files)
Fix these issues in Kilo Cloud Previous review (commit 35a3eeb)Status: 32 Issues Found | Recommendation: Address before merge Incremental review of Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (8 files)
Fix these issues in Kilo Cloud Previous review (commit e1791e7)Status: 30 Issues Found | Recommendation: Address before merge Incremental review of Overview
Issue Details (click to expand)WARNING
SUGGESTION
[Snapshot truncated.] Additional previous summary content was truncated to keep this comment within platform limits. Reviewed by deepseek-v4.1-flash-1017 · Input: 200.8K · Output: 83.3K · Cached: 7.4M |
…outputs not CTE columns, edit gaps kept, runner keeps the repo's dbt and the model's version, shell search window, value-change false positives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| const ch = code[i]! | ||
| if (ch === '(') depth++ | ||
| else if (ch === ')') depth = Math.max(0, depth - 1) | ||
| else if (depth === 0 && /[Ss]/.test(ch) && /^select\b/i.test(code.slice(i, i + 7)) && !/\w/.test(code[i - 1] ?? '')) last = i |
There was a problem hiding this comment.
WARNING: Only the final top-level SELECT is read, so earlier union branches lose their outputs
last is overwritten by every top-level select, and selectItems(sql.slice(last, end)) then reads only the last row-producing branch. A model like select id from a union all select id from b (or the usual {% if is_incremental() %} … {% else %} … {% endif %} pair) therefore yields only the last branch's names. When an edit adds a column to an earlier branch, now does not contain it and old() in undocumentedByEdit returns true on !now.has(key), so the edit's own new undocumented column is reported as "not documented, from before this edit" and no gap warning is raised. The previous selectItems(sql) saw every scope, so this is a regression for set-operation and conditional models: collect the items of every top-level SELECT instead of only the last one, which keeps CTE and subquery scopes out without dropping branches.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| let filtering = false | ||
| const added = now.flatMap(line => { | ||
| const clause = CLAUSE.exec(line)?.[1]?.toLowerCase() | ||
| if (clause) filtering = FILTERS.has(clause) |
There was a problem hiding this comment.
WARNING: A select/from inside a parenthesised predicate resets the filter state
filtering changes only on a clause word that starts a line and is not tied to parenthesis depth, so a predicate split over lines around a subquery is read as a value change:
where claim_id in (
select claim_id from other
)
and paid_amount > 0
The select/from lines set filtering back to false, so editing > 0 makes paid_amount a candidate and the task summary claims its values change. The reverse also happens: a select item that wraps onto left(name, 3) or right(...) starts with a FILTERS word and is dropped. Track paren depth and only let a depth-0 clause keyword (one not followed by () start or end a filter clause.
There was a problem hiding this comment.
valueCandidates was rewritten in 09f3adc. It is now a plain word list from the lines the change added (plugins/altimate-code/hooks/impact-report.ts:102), and altimate-code's impact_analysis decides which words are the model's columns and what they reach. The band says "values may change", and names that reach nothing are dropped, so no 0 is ever shown. The clause/depth tracking this comment is about is gone at 031a5c1.
| contextGiven.clear() | ||
| oldGapsSaid.clear() | ||
| lastReturned.clear() | ||
| editGaps.clear() |
There was a problem hiding this comment.
WARNING: editGaps is not cleared when a conversation ends
A /clear runs endDbtMods and no session.start follows it (see features/index.ts), yet only oldGapsSaid and lastReturned are cleared there. The previous conversation's editGaps entry is still passed as ours to undocumentedByEdit, so a column an earlier conversation's edit left undocumented is reported as this edit's fresh gap (band warning and Claude's note) instead of the quiet "from before this edit" mention. Clear editGaps in endDbtMods too (or key it by generation).
There was a problem hiding this comment.
Fixed in 6ab8041: endDbtMods clears editGaps (plugins/altimate-code/hooks/dbt-mods.tsx:2009) as well as the session start (plugins/altimate-code/hooks/dbt-mods.tsx:1642). The test "after /clear, the next conversation compares with the model as built again…" covers it.
| for (let i = 0; i < parts.length; i++) known.set(parts.slice(i).join('.'), { relation: parts.slice(i).join('.'), use }) | ||
| } | ||
| // A manifest too big to read here comes as a slice of the model's graph, with every relation listed apart. | ||
| const nodes: [string, any][] = Array.isArray(manifest?.relations) ? manifest.relations.map((one: any) => [String(one?.id), one]) : Object.entries<any>(manifest?.nodes ?? {}) |
There was a problem hiding this comment.
SUGGESTION: The relations are enumerated twice for a sliced manifest
With manifest.relations present, the first loop visits every entry only to drop sources and the second visits the array again to keep them, repeating the Array.isArray(manifest?.relations) branch; a full manifest reads a third collection. One normalised list (const relations = Array.isArray(manifest?.relations) ? manifest.relations : [...Object.values(manifest?.nodes ?? {}), ...Object.values(manifest?.sources ?? {})]) followed by a single pass that picks the ref() or source() wording by resource_type visits each relation once and removes the duplicated guard.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
… the newest check only, the runner asks dbt ls for the file's version, CTE column lists, predicates split over lines Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| */ | ||
| export function outputColumns(sql: string, depth = 0): { names: Set<string>; star: boolean } | null { | ||
| const code = masked(sql) | ||
| const select = topLevel(code, 'select', 0, true) |
There was a problem hiding this comment.
WARNING: Only the last top-level SELECT is read, so union and if/else branches lose their columns
topLevel(code, 'select', 0, true) keeps only the final top-level select, so select id from a union all select id, amount from b (and the common incremental {% if is_incremental() %} / {% else %} pair) yields only the last branch's names. When an edit adds a column to an earlier branch, now in undocumentedByEdit does not contain it, old() returns true on !now.has(key), and the edit's own new undocumented column is filed as 'from before this edit', so no gap warning is raised. The previous selectItems(sql) saw every scope; collect the items of every top-level SELECT instead of only the last one - a depth-0 scan already keeps CTE and subquery lists out.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| let star = false | ||
| for (const item of topItems(list)) { | ||
| const bare = item.replace(/\s+/g, ' ').trim() | ||
| if (/^(?:[\w"`]+\.)?\*$/.test(bare)) { |
There was a problem hiding this comment.
WARNING: A * with a modifier is no longer recognised as a star
Only an item that is exactly * or t.* sets star. * exclude (col) and * replace (x as y) (DuckDB, BigQuery, Snowflake) match neither this check nor the name regexes below, so outputColumns returns empty names with star: false. undocumentedByEdit then trusts that empty set and classifies every returned column as old through !now.has, so a model such as with src as (select id, amount from raw) select * exclude (extra) from src never warns about a newly added undocumented column. The earlier detector treated any top-level * as a star and fell back to selectItems; set star when an item starts with an optionally qualified * unless the item is exactly a plain * (the CTE resolution below handles that case).
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| const added = now.flatMap(line => { | ||
| const opens = CLAUSE.exec(line)?.[1]?.toLowerCase() | ||
| const filtering = opens ? FILTERS.has(opens) : carried | ||
| const clauses = [...line.matchAll(CLAUSES)].map(one => one[1]!.toLowerCase()) |
There was a problem hiding this comment.
WARNING: carried is set by a clause word anywhere on the line, including inside a string literal
CLAUSES scans the raw line, so , 'order' as record_type (or a column literally named order) sets carried to true and every later line without a clause word is treated as a filter and dropped from the value candidates. In a {% set %} column list, for example, the changed line , med.paid_amount / 100 is no longer named and the summary falls back to 'values may change downstream'. The reverse also remains: the scan is not paren-depth aware, so select/from inside where claim_id in (select ... from other) still resets carried, and a change inside that filtering subquery is read as a value change. Strip string literals before splitting the words, and only take clause words at depth 0.
There was a problem hiding this comment.
valueCandidates was rewritten in 09f3adc. It is now a plain word list from the lines the change added (plugins/altimate-code/hooks/impact-report.ts:102), and altimate-code's impact_analysis decides which words are the model's columns and what they reach. The band says "values may change", and names that reach nothing are dropped, so no 0 is ever shown. The clause/depth tracking this comment is about is gone at 031a5c1.
| } | ||
|
|
||
| /** The node names `dbt ls --output json --output-keys name` printed: one JSON object per line, among dbt's own log lines. */ | ||
| /** The models `dbt ls --output json --output-keys "name version original_file_path"` lists, each with its file and version. */ |
There was a problem hiding this comment.
SUGGESTION: A second copy of the dbt ls JSON-line parser
listedFiles repeats listedNames' loop (strip ANSI, one line at a time, skip non-{, guarded JSON.parse) with only the field test changed, and it was inserted between listedNames' doc comment and listedNames, so that comment now sits above the wrong function. One helper that parses each JSON line once and returns the node, with listedNames and listedFiles reading the fields they need, removes the duplicate and the misplaced JSDoc.
There was a problem hiding this comment.
Fixed: listedNames and listedFiles now share one JSON-line parser, jsonLines (plugins/altimate-code/hooks/dbt-mods-core.ts:175).
…the file's model, /clear drops edit gaps, versioned ref advice, depth-aware value candidates, shell edits below the session folder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| const n = left.get(line) ?? 0 | ||
| if (n > 0) left.set(line, n - 1) | ||
| const changed = !!line && n === 0 | ||
| for (const token of line.matchAll(/\(|\)|(?<![\w.])(?:[A-Za-z_]\w*\.)?([A-Za-z_]\w*)\b(\s*\()?/g)) { |
There was a problem hiding this comment.
WARNING: A ( that follows a word is swallowed, so every later line is read at the wrong depth
The identifier branch ends in (\s*\()?, so in (, exists (, max( match as one token (group 2): the ( never reaches the clauses.push above, while the closing ) still runs clauses.pop(). The level's clause is therefore overwritten or popped early:
where id in (select id, x from t): the(afterinis swallowed, soselectoverwrites the level'swhereinstead of opening a subquery level. A changed line inside that filter subquery then namesid/xas value candidates and the summary claims their values change - the false positive this rewrite is meant to remove.select (select max(a) from t) as m, amount from t:max(is swallowed and its)pops the real grouping level, sofromstays in force and a later changedamountline is dropped.
Only a bare ( (not directly preceded by an identifier) is pushed. Matching ( separately from the word, or pushing whenever token[2] is set, keeps the depth balanced.
There was a problem hiding this comment.
valueCandidates was rewritten in 09f3adc. It is now a plain word list from the lines the change added (plugins/altimate-code/hooks/impact-report.ts:102), and altimate-code's impact_analysis decides which words are the model's columns and what they reach. The band says "values may change", and names that reach nothing are dropped, so no 0 is ever shown. The clause/depth tracking this comment is about is gone at 031a5c1.
| const base = await $.session.root().catch(() => '.') | ||
| const own = await projectRoot($, commandDir(start.command, base), false).catch(() => null) | ||
| // Below it only once a dbt project has been seen this session: a session that never touches dbt never walks its folder. | ||
| const roots = own ? [own] : projectSeen ? (await projectsBelow($, base).catch(() => [] as string[])).slice(0, MAX_BASH_PROJECTS) : [] |
There was a problem hiding this comment.
SUGGESTION: The new projects-below search has no test
This branch (and MAX_BASH_PROJECTS) is what makes a shell edit in a project below the session folder get an impact note, but lineage.test.tsx only exercises the own path (start() makes the session root a project), so a wrong root, a note duplicated when two roots overlap, or the cap not being applied would go unnoticed. A test whose session root sits above two projects, with the shell command rewriting a model in the second, would cover it.
There was a problem hiding this comment.
Covered by the lineage tests "a shell command in a session opened above its dbt project looks for changed models in the projects below" and "a shell command in a dbt project also looks in the projects below it" (plugins/altimate-code/hooks/lineage.test.tsx).
…package-qualified ref advice, value parts compared, shell edits below the session folder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h every CTE, macro lists compared by their Jinja, set-block column lists, ambiguous relation names left alone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| continue | ||
| } | ||
| const word = token[2]?.toLowerCase() | ||
| if (word && !token[1] && CLAUSE_WORDS.has(word)) { |
There was a problem hiding this comment.
WARNING: A ( right after a clause keyword is still swallowed, so its ) pops a level that was never pushed
The new token[3] push below balances a function call such as max(, but this branch continues before reaching it: when a clause word itself is followed by (, the paren is part of the same token and no level is pushed. In from (select ...), join (select ...), on (...) or where (...) the inner select/from then overwrite this level's clause, and the matching ) pops nothing (or an outer level when one is open), so the clause state after the subquery is wrong. A changed line inside a from (/join ( subquery is read as a value part, so its columns are offered as value candidates, and any whose name the manifest also lists among the model's columns is traced as a value change. Push token[3] in this branch too (before continue), as the function-call path does.
There was a problem hiding this comment.
valueCandidates was rewritten in 09f3adc. It is now a plain word list from the lines the change added (plugins/altimate-code/hooks/impact-report.ts:102), and altimate-code's impact_analysis decides which words are the model's columns and what they reach. The band says "values may change", and names that reach nothing are dropped, so no 0 is ever shown. The clause/depth tracking this comment is about is gone at 031a5c1.
| for (let at = topLevel(code, 'select'); at >= 0; at = topLevel(code, 'select', at + 6)) selects.push(at) | ||
| if (!selects.length) return null | ||
| let k = selects.length - 1 | ||
| while (k > 0 && /\b(?:union|intersect|except|minus)\b/i.test(code.slice(selects[k - 1]!, selects[k]!)) && topLevel(code.slice(selects[k - 1]!, selects[k]!), '(?:union|intersect|except|minus)') >= 0) k-- |
There was a problem hiding this comment.
WARNING: {% if %}/{% else %} branches still yield only the last SELECT's names
Walking back over set operations fixes union all, but two alternative top-level SELECTs ({% if ... %} select ... {% else %} select ... {% endif %}) are not joined by union, so k stays on the last one and only that branch's names are returned. A column added inside the earlier branch is missing from now.names, and undocumentedByEdit then falls through to jinjaOf(before) === jinjaOf(after), which is also true (the edit changed SQL text, not a Jinja tag), so the edit's own new undocumented column is filed as pre-existing and no gap warning is raised. Union the names of top-level SELECTs that no set operation joins, instead of keeping only the last.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| if (code[i] === '(') depth++ | ||
| else if (code[i] === ')') depth-- | ||
| } | ||
| out.set(unquote(match[1]!), { raw: sql.slice(open, i - 1), code: code.slice(open, i - 1) }) |
There was a problem hiding this comment.
SUGGESTION: ctesOf returns a code field that nothing reads
Only raw is used (body.raw in the recursion and one.raw in the source fingerprint; the recursion re-masks it anyway), so the masked code companion is a second full copy of every CTE body with no reader. Dropping it, or returning just the raw body, keeps the same behaviour with less copying.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| const dirs = models.map(one => (one === '.' ? root : `${root}/${one}`)) | ||
| if (!dirs.length) continue | ||
| const listed = await $.process.run(['find', ...dirs, '-name', '*.sql', '-type', 'f', '-mmin', `-${minutes}`], { timeoutMs: 10_000 }).catch(() => null) | ||
| const top = (await $.process.run(['git', '-C', root, 'rev-parse', '--show-toplevel'], { timeoutMs: 5_000 }).catch(() => null))?.stdout.trim() ?? '' |
There was a problem hiding this comment.
SUGGESTION: git rev-parse runs even when find listed nothing
With this change roots can hold up to five projects from projectsBelow, and WRITES matches very common commands (python3, node, cp, mv, tee), so each matching shell call spawns up to five git rev-parse processes even when find returned no files (the loop below then does nothing). Return early when listed?.stdout.trim() is empty, or move the git lookup inside the loop so it runs only once a candidate file is found.
There was a problem hiding this comment.
Fixed: git rev-parse is skipped when find listed nothing (plugins/altimate-code/hooks/lineage.tsx:1189).
| const base = await $.session.root().catch(() => '.') | ||
| const own = await projectRoot($, commandDir(start.command, base), false).catch(() => null) | ||
| // The walk below it is bounded (2000 folders) and kept for the session. | ||
| const roots = own ? [own] : (await projectsBelow($, base).catch(() => [] as string[])).slice(0, MAX_BASH_PROJECTS) |
There was a problem hiding this comment.
SUGGESTION: The now-ungated projects-below walk has no test
Removing the projectSeen gate means this branch runs for every writing shell command in a session whose folder is not a dbt project, not just after one has been seen. lineage.test.tsx only exercises the own path (its start() makes the session root a project), so a wrong root, a duplicate note when two roots overlap, or MAX_BASH_PROJECTS not being applied would go unnoticed. A test whose session root sits above two projects, with the command rewriting a model in the second, would cover it.
There was a problem hiding this comment.
The projectSeen gate was dropped on purpose: the walk is bounded (2000 folders) and cached per folder. The two projects-below tests named above cover it (plugins/altimate-code/hooks/lineage.test.tsx).
…et-block lists, the model in the ambiguity check, the pane's no-new-gaps heading Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| const read = /^\s*((?:"[^"]+"|`[^`]+`|[A-Za-z_]\w*))(?:\s+(?:as\s+)?(?!where\b|group\b|order\b|limit\b|qualify\b|having\b|window\b|union\b)[A-Za-z_]\w*)?\s*(?:;\s*)?(?:$|where\b|group\b|order\b|limit\b|qualify\b|having\b|window\b|union\b)/i.exec(tail) | ||
| const body = read ? ctes.get(unquote(read[1]!)) : undefined | ||
| const inner = body !== undefined ? outputColumns(body.raw, depth + 1, ctes) : null | ||
| if (inner) return { names: new Set([...names, ...inner.names]), star: inner.star, vars, ...(inner.source !== undefined && { source: inner.source }) } |
There was a problem hiding this comment.
WARNING: The {% set %} list a select * CTE renders is dropped, so a column added there is missed
inner is parsed from the CTE body, so inner.vars holds the variables that body renders (select {{ cols }}), but this return keeps only the outer level's vars. In {% set cols %}id, amount{% endset %} / with src as (select {{ cols }} from raw) / select * from src, names are inherited from the CTE while vars stays empty, so setBlockNames(after, now.vars) in undocumentedByEdit returns nothing. Adding paid_cents to the block then leaves now.names, nowSet and now.star all empty, so undocumentedByEdit falls back to jinjaOf(before) === jinjaOf(after) - true, because jinjaOf keeps only the {% set %}/{% endset %} tags and not the block's text - and the new column is filed as pre-existing, with no gap warning. Merge it here: vars: new Set([...vars, ...inner.vars]).
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| const list = code.slice(select + 6, from < 0 || from > end ? end : from).replace(/^\s*(?:distinct|all)\b/i, '') | ||
| const names = new Set<string>() | ||
| // The Jinja variables the list renders (`{{ cols }}`): their `{% set %}` blocks name outputs. | ||
| const vars = new Set([...sql.slice(select + 6, from < 0 || from > end ? end : from).matchAll(/\{\{-?\s*([A-Za-z_]\w*)\s*-?\}\}/g)].map(one => one[1]!)) |
There was a problem hiding this comment.
SUGGESTION: Only a bare {{ name }} is recognised, so a filtered render loses its {% set %} list
The regex requires the whole expression to be one identifier, so {{ core | trim }} (or | join(', '), or any filter on a block-set column list) records no variable. setBlockNames(after, now.vars) then skips that block, and since jinjaOf keeps only the Jinja tags and not the block's text, a column newly added to the block is classified as "from before this edit" and no gap is warned - the false negative this round is meant to remove. Capture the leading identifier and ignore a trailing filter, e.g. /\{\{-?\s*([A-Za-z_]\w*)\b/g.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| expect(await pane.find({ type: 'Text', text: ' not documented, from before this edit' })).toBeDefined() | ||
| await pane.unmount() | ||
| // A check that found only older gaps does not claim the columns match. | ||
| show.rows = [{ order_id: 1, amount: 10, status: 'placed', amount_cents: 1000 }] |
There was a problem hiding this comment.
SUGGESTION: Dead reassignment
This array is identical to the initial show.rows in start() (line 808), so the line changes nothing, and the comment above it describes the assertion that actually depends on the rows set at line 835. Removing it (or setting the rows where they really change) keeps the test honest.
There was a problem hiding this comment.
Fixed: the dead reassignment was removed when the E test was rewritten for the warehouse-based design (09f3adc).
…red CTE columns, quoted identifiers, Jinja alternatives, named-item edits, runner always asks dbt ls, FROM in function calls, balanced subquery levels, fewer git calls Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (named items or column-less clause lines only, Jinja unchanged), quoted CTE names kept Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… lines only, top-level CTEs only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| if (/^(?:[\w"`]+\.)?\*\s+\S/.test(bare)) modified = true | ||
| continue | ||
| } | ||
| const name = itemName(sql.slice(select + 6 + lead + a, select + 6 + lead + b)) |
There was a problem hiding this comment.
WARNING: A trailing comment is read as the select item's name
itemName is given the raw sql slice here, while the items were split on the masked list. A trailing line comment therefore becomes the name: amount -- in cents is captured as cents by the /[\s)](...)$/ fallback and amount itself is dropped, and amount /* cents */ gets no name at all. Before this change the name was read from the masked text, where comments were already blanked. The lost name defeats the rule added in this PR: onlyNamedItems measures the changed line with itemName too, so a new amount_cents -- cents select item resolves to cents, which outputColumns has already put in now.names, and old() files the new undocumented column as pre-existing (no gap warning). now.names also gains phantom names, which can make an unrelated undocumented column look like it was there before. Pass a comment-blanked slice (quotes kept, which is why the raw text was used) here, at setBlockNames (line 1090) and in onlyNamedItems (line 1117).
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| // Named nowhere (through a `*` the SQL does not resolve, or a macro): there before only when no Jinja expression or | ||
| // tag changed and every line the edit changed either rewrote a named output's select item or sits in a clause that | ||
| // adds no column (WHERE, GROUP BY, HAVING, QUALIFY, ORDER BY, LIMIT). | ||
| return onlyNamedItems(before!, after!, new Set([...was.names, ...wasSet]), new Set([...now.names, ...nowSet])) |
There was a problem hiding this comment.
SUGGESTION: File-wide work runs once per undocumented column
old() is called twice for every undocumented column (filter for fresh, then again for old), and each call re-scans both whole texts with jinjaOf, rebuilds the two combined name sets, and - for any column no list names - runs onlyNamedItems, which re-diffs every line and calls columnlessLines twice more. Hoist jinjaOf(before) !== jinjaOf(after), the combined sets and the onlyNamedItems result (or at least its quietBefore/quietAfter sets) above old; a model with dozens of undocumented columns repeats all of it dozens of times per check.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| const listEnd = from < 0 || from > next ? next : from | ||
| const list = code.slice(select + 6, listEnd) | ||
| const lead = /^\s*(?:distinct|all)\b/i.exec(list)?.[0].length ?? 0 | ||
| for (const one of sql.slice(select + 6, listEnd).matchAll(/\{\{-?\s*([A-Za-z_]\w*)\s*-?\}\}/g)) vars.add(one[1]!) |
There was a problem hiding this comment.
SUGGESTION: A filtered {{ … }} render records no variable
The regex still matches only a bare {{ name }}, so {{ cols | trim }}, {{ cols|join(', ') }} or {{ env_var('COLS') }} add nothing to vars. setBlockNames then names no columns for that block, now.names/nowSet stay empty, and old() falls through to onlyNamedItems; the changed set-block line is not one of the named outputs, so every other undocumented column of the model is reported as this edit's fresh gap (a warning about columns the edit did not touch). Capture the leading identifier and ignore a trailing filter, e.g. /\{\{-?\s*([A-Za-z_]\w*)\b/g.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
…ed diff within output lists, runner ls errors shown, nested projects searched Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| const afterSide = sides(now, nowSet) | ||
| // Named in the model's own list after the edit: there before only when that list named it before too (outside | ||
| // Jinja that may not run). | ||
| if (afterSide.names.has(key) || now.maybe.has(key) || nowSet.maybe.has(key)) return beforeSide.names.has(key) |
There was a problem hiding this comment.
WARNING: Conditional names are compared only against the unconditional "before" set
When the after side names the column only inside Jinja that may not run (now.maybe/nowSet.maybe), this returns beforeSide.names.has(key) and never consults was.maybe/wasSet.maybe. So a column that sits in the same unchanged {% if is_incremental() %} … {% else %} … {% endif %} branch on both sides is treated as fresh on any edit. On the first check of a model (lastReturned is null at dbt-mods.tsx:690) every undocumented column of an incremental model is reported as this edit's new gap, and editGaps.set(fileKey, gaps.fresh) (dbt-mods.tsx:692) then keeps them the edit's on later checks, since lastReturned excludes them (dbt-mods.tsx:696). The updated "an undocumented column is the edit's only when…" case encodes exactly this for a whitespace-only edit, which is the false warning that finding E was meant to remove. Return true when was.maybe.has(key) || wasSet.maybe.has(key) too: the same conditional branch named it before.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| } | ||
| // Where the item's own text starts (past whitespace and masked Jinja tags before it). | ||
| const start = select + 6 + lead + a + (/^\s*/.exec(list.slice(lead + a, lead + b))?.[0].length ?? 0) | ||
| const name = itemName(sql.slice(start, select + 6 + lead + b)) |
There was a problem hiding this comment.
WARNING: Item names are read from raw SQL, so a trailing comment becomes the name
itemName gets sql.slice(start, …), which still holds -- and /* */ comments (the items were split on masked code, but the slice is raw). amount -- in cents therefore resolves to cents and amount is lost, and amount /* cents */ gets no name at all. That defeats the rule this PR adds: a new undocumented amount_cents -- cents item resolves to cents, which is already in now.names, so onlyNamedItems treats the changed line as a named item and old() files the new column as pre-existing with no gap warning. The same raw text is passed to itemName in setBlocks (line 1125) and onlyNamedItems (line 1174). Pass a comment-blanked slice (quotes kept, which is why raw text was used) at all three.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| if (afterSide.names.has(key) || now.maybe.has(key) || nowSet.maybe.has(key)) return beforeSide.names.has(key) | ||
| // Named on neither side (a macro or a `*` fills it): there before only when every line the edit changed is a named | ||
| // output's item or a clause that adds no column. | ||
| return !was.maybe.has(key) && !wasSet.maybe.has(key) && !beforeSide.names.has(key) && onlyNamedItems(before!, after!, beforeSide, afterSide) |
There was a problem hiding this comment.
WARNING: An O(lines²) diff runs for every undocumented column
old() is evaluated twice per undocumented column (line 1110), and for every column the after list does not name it now runs onlyNamedItems: an LCS over every line of the model with one Uint32Array per line (up to 4M cells and roughly 16 MB allocated per call for a 2000-line model), plus columnlessLines, which masks the whole text twice. A model with dozens of undocumented columns (the PR's Tuva run reported 69) repeats all of it dozens of times per check on the hook's thread, and past the 4M-cell bail (line 1150) every column silently becomes fresh. Hoist the jinjaOf comparison, the combined sides(...) sets and one onlyNamedItems result (or at least its removed/added and quiet sets) above old.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| out.spans.push([base + select, base + listEnd]) | ||
| const list = code.slice(select + 6, listEnd) | ||
| const lead = /^\s*(?:distinct|all)\b/i.exec(list)?.[0].length ?? 0 | ||
| for (const one of sql.slice(select + 6, listEnd).matchAll(/\{\{-?\s*([A-Za-z_]\w*)\s*-?\}\}/g)) out.vars.add(one[1]!) |
There was a problem hiding this comment.
SUGGESTION: A filtered {{ … }} render still records no variable
The regex matches only a bare {{ name }}, so {{ cols | trim }}, {{ cols|join(', ') }} or {{ env_var('COLS') }} add nothing to vars. setBlocks(after, now.vars) then names no columns for that block, the changed set-block lines sit outside every span, and old() falls through to onlyNamedItems, so every other undocumented column of the model is reported as this edit's fresh gap. Capture the leading identifier and ignore a trailing filter, e.g. /\{\{-?\s*([A-Za-z_]\w*)\b/g.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
…s lines by position, one diff per edit; the supported-input contract written down Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| if (jinjaOf(before!) !== jinjaOf(after!)) return false | ||
| // Jinja control flow (`{% if %}`, `{% for %}`) anywhere decides what runs: outside what this reading supports, so | ||
| // the column counts as the edit's. | ||
| if (conditionalJinja) return false |
There was a problem hiding this comment.
WARNING: The whole-file conditionalJinja rule re-reports every older gap on incremental models
conditionalJinja is computed from the entire text on either side, so one {% if %}/{% for %} anywhere - the ordinary {% if is_incremental() %} around a WHERE clause, or a tag left inside a {# … #}/-- … comment, since jinjaControlled scans raw SQL and not masked text - makes old() return false for every undocumented column of the model, including ones this edit never touched and ones the final select list names unconditionally.
On the first check of a file (earlier/lastReturned is null, dbt-mods.tsx:690) that marks every pre-existing undocumented column as this edit's gap, the check turns warn (dbt-mods.tsx:699), and editGaps.set(fileKey, gaps.fresh) (dbt-mods.tsx:692) plus the lastReturned filter (696) keep them fresh for the rest of the conversation. That is the "undocumented order_id, amount" noise this PR's point E removed, now for the most common incremental pattern.
Scope the rule to the changed lines (or to the output whose item sits in a control block), and blank comments before scanning for tags, instead of treating the whole model as unreadable.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| if (afterSide.names.has(key) || now.maybe.has(key) || nowSet.maybe.has(key)) return beforeSide.names.has(key) | ||
| // Named on neither side (a macro or a `*` fills it): there before only when every line the edit changed is a named | ||
| // output's item or a clause that adds no column. | ||
| return !was.maybe.has(key) && !wasSet.maybe.has(key) && !beforeSide.names.has(key) && onlyItems(beforeSide, afterSide) |
There was a problem hiding this comment.
SUGGESTION: The maybe guards here and on line 1123 are now unreachable
maybe is only filled for offsets inside a jinjaControlled range (outputColumns:1045, setBlocks:1145), and line 1117 already returns false when either text contains such a range. So by this point now.maybe/nowSet.maybe (line 1123) and was.maybe/wasSet.maybe are always empty: those checks can no longer change the result, and the maybe plumbing in outputColumns/setBlocks has no live reader left. Keep one mechanism - drop the maybe conditions and field, or drop the blanket return and make the conditional-name comparison carry the decision.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| const movedAfter = moved.replace(' select id,\n amount\n', ' select id\n').replace(' select id\n from raw\n)\nselect', ' select id,\n amount\n from raw\n)\nselect') | ||
| expect(undocumentedByEdit(['amount'], moved, movedAfter, ['id'])).toEqual({ fresh: ['amount'], old: [] }) | ||
| // A line whose text also appears in a GROUP BY is judged where it is: a new select item stays the edit's. | ||
| expect(undocumentedByEdit(['amount'], 'select\n id\nfrom raw\ngroup by\n id', 'select\n id,\n amount\nfrom raw\ngroup by\n id', ['id'])).toEqual({ fresh: ['amount'], old: [] }) |
There was a problem hiding this comment.
SUGGESTION: This case does not exercise the position-based columnlessLines
amount is a named item of the after side's own select list, so old() answers through afterSide.names.has(key) (dbt-mods-core.ts:1123) and onlyNamedItems/columnlessLines never runs - the assertion also holds with the previous text-based quiet set, so it does not guard the fix it is labelled for. To cover it, the changed line's trimmed text has to also occur in a WHERE/GROUP BY line while the column itself is not named by the list (e.g. a column behind an unresolved *); then the old text match would wrongly mark the changed line quiet.
There was a problem hiding this comment.
That test was replaced in 09f3adc. Attribution no longer reads clause lines; it compares the warehouse's columns ("a column the model returned before the edit is not the edit's gap…" in plugins/altimate-code/hooks/dbt-mods.test.tsx).
…iases and Jinja branches not read as relations, changed aliases first among value candidates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| // Jinja becomes a same-length `_j___` word, so a relation right after it is never taken for one, and positions hold. | ||
| const text = sqlCode(sql.replace(/\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}|\{#[\s\S]*?#\}/g, one => `_j${'_'.repeat(Math.max(0, one.length - 2))}`.slice(0, one.length))) | ||
| // Keywords inside quoted identifiers (`as "from x"`) are no keywords: matched on a copy with their letters hidden. | ||
| const hidden = text.replace(/"(?:[^"]|"")*"|`[^`]*`/g, one => `${one[0]}${'_'.repeat(Math.max(0, one.length - 2))}${one[one.length - 1]}`) |
There was a problem hiding this comment.
SUGGESTION: hidden repeats the masking masked() already does
masked() (line 919) already returns SQL of the same length with Jinja, comments and strings blanked and the letters of double-quoted and backticked identifiers hidden, so const hidden = masked(sql) yields the same text here: a Jinja-rendered relation becomes spaces and no longer matches RELATION_AFTER, which also makes the /^_j_*$/ guard below unnecessary. Keeping a second copy of the quote masking means a later fix to one can miss the other. Relatedly, the .slice(0, one.length) on line 864 is a no-op: the template is already _j plus one.length - 2 underscores.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| // Keywords inside quoted identifiers (`as "from x"`) are no keywords: matched on a copy with their letters hidden. | ||
| const hidden = text.replace(/"(?:[^"]|"")*"|`[^`]*`/g, one => `${one[0]}${'_'.repeat(Math.max(0, one.length - 2))}${one[one.length - 1]}`) | ||
| // Text inside Jinja control flow may not run (out of what is read): nothing there is flagged. | ||
| const controlled = jinjaControlled(sql) |
There was a problem hiding this comment.
SUGGESTION: jinjaControlled reads tags inside comments
jinjaControlled(sql) scans the raw text, so a {% if %} or {% for %} left inside a {# ... #}, -- or /* ... */ comment opens a range. A commented-out block whose {% if %} has no matching {% endif %}, or that is cut short, is treated as unclosed and runs to the end of the file, so controlled skips every relation after it and the hardcoded-relation warning goes silent for the rest of the model. Build the ranges from a comment-blanked copy instead; it is the same length, so the offsets still line up with hidden.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| // outside what is read. | ||
| const counts = new Map<string, number>() | ||
| for (const one of sql.matchAll(/\{%-?\s*set\s+(\w+)\b/gi)) counts.set(one[1]!, (counts.get(one[1]!) ?? 0) + 1) | ||
| out.reassigned = [...only].some(name => (counts.get(name) ?? 0) > 1) |
There was a problem hiding this comment.
SUGGESTION: reassigned is file-wide, so one double {% set %} turns every older gap into this edit's
A single variable in only being assigned twice anywhere in the file sets reassigned, and line 1118 then returns false for every undocumented column, so all of them become this edit's fresh gaps. A model that already set cols twice before the edit (or sets it once as a {% set %} block and again with {% set cols = ... %}, even in a macro or a branch that never renders) therefore reports every pre-existing gap as new on the first check, and editGaps keeps them fresh for the rest of the conversation. The last assignment wins, so reading the last block's list (or marking only that block's columns unknown) keeps the other columns honest.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
…d identifiers, unrendered Jinja blocks not read, comments not item names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| /** An item's output name: its alias, or the column it is (`t.col`); quotes removed. Null for an expression with no alias. */ | ||
| function itemName(item: string): string | null { | ||
| // Comments are not part of the item: `amount -- in cents` is named amount. | ||
| const bare = item.replace(/--[^\n]*|\/\*[\s\S]*?\*\//g, ' ').replace(/\s+/g, ' ').trim() |
There was a problem hiding this comment.
WARNING: Blanking comments here also blanks --//* */ inside strings and quoted names
This strip runs on the raw item text, so a -- or /* inside a string literal or quoted identifier eats the rest of the line and the item loses its name: coalesce(status, '--') as status becomes coalesce(status, ' and count(*) as "a--b" becomes count(*) as "a, both of which return null. outputColumns then omits the name, so a new undocumented column written that way is not in now.names and old() files it as pre-existing (no gap warning); the same loss can also make an untouched column look like this edit's. Strip only the spans masked() reports as comments (the offsets line up), or skip quoted spans before looking for --//*.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| /** Where Jinja blocks whose body may not be rendered in place are (`macro`, `set`…`endset`, `call`, `raw`, `filter`), as offsets. */ | ||
| function jinjaBlocks(sql: string): [number, number][] { | ||
| const out: [number, number][] = [] | ||
| for (const block of sql.matchAll(/\{%-?\s*(macro|set|call|raw|filter)\b(?:(?!%\})[\s\S])*%\}[\s\S]*?\{%-?\s*end\1\s*-?%\}/g)) out.push([block.index!, block.index! + block[0].length]) |
There was a problem hiding this comment.
SUGGESTION: The block ranges are read from raw SQL, so a commented-out opener pairs with a real end tag
jinjaBlocks(sql) scans the unmodified text (as jinjaControlled(sql) does just below). A {% macro old() %} or {% set cols %} left inside a {# … #} or -- … comment therefore opens a range that runs to the next real {% endmacro %}/{% endset %}, and every from/join in between is treated as text that may not be rendered: the hardcoded-relation check goes silent for that whole span. Build the offsets from a comment-blanked copy (same length, so they still line up with hidden) and use that copy for jinjaControlled too.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| if (returned.has(key)) return true | ||
| if (!was || !now || !wasSet || !nowSet || wasSet.reassigned || nowSet.reassigned) return false | ||
| // Quoted identifiers (case-sensitive names) are outside what this reading compares: the column is the edit's. | ||
| if (quotedIdentifiers) return false |
There was a problem hiding this comment.
SUGGESTION: A quoted identifier anywhere makes every undocumented column this edit's
quotedIdentifiers is computed from the whole file, and when it is true old() returns false before it ever checks whether the model's own select list named the column on both sides. So in a model that quotes any identifier, a long-standing undocumented column named in both before and after is reported as this edit's fresh gap on every check, and editGaps (dbt-mods.tsx) then keeps it fresh for the conversation. This is the same failure mode as the whole-file conditionalJinja rule and it is the "undocumented order_id, amount" noise point E removed. Scope the bail to the columns whose names come from a quoted identifier, or to the lines the edit changed, instead of the whole model.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
…bodies not outputs, relations matched part by part with stored case Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| // matches only a plain identifier stored in one case (a mixed-case or dotted name needs quotes): else no advice. | ||
| // A part the manifest quotes is stored in that exact case: an unquoted SQL part, which the warehouse folds (to lower | ||
| // case, or upper on some), is taken to name it only when it is a plain lower-case identifier. | ||
| if (sqlParts.some((one, i) => (one.quoted ? one.text !== hit.exact[i] : hit.quoted[i] && !/^[a-z_][a-z0-9_$]*$/.test(hit.exact[i]!)))) continue |
There was a problem hiding this comment.
WARNING: An unquoted reference to an upper-case (Snowflake) relation is never flagged
hit.quoted[i] is true for every part of dbt's Snowflake relation_name ("DB"."SCHEMA"."TABLE", stored upper case), and an unquoted SQL part has one.quoted === false, so the guard only lets it through when the stored text is a plain lower-case identifier. select * from analytics.raw.orders (Snowflake folds it to ANALYTICS.RAW.ORDERS, the model's real relation) therefore hits continue, no warning is raised, and the pane reports no hardcoded relation - the exact "ref() swapped for its table" case point C adds, silently missing on Snowflake. Before this commit the parts were folded with unquote, so that reference matched. The new test pins the miss ("d"."s"."ORDERS4" against s.orders4). Comparing an unquoted part with the stored one case-insensitively (or accepting the folded upper-case form too) keeps quoted SQL parts exact without losing the warning on upper-folding warehouses.
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
| for (let i = 0; i < parts.length; i++) { | ||
| const key = parts.slice(i).join('\u0000') | ||
| const had = known.get(key) | ||
| known.set(key, had === undefined || had?.use === use ? { relation: exact.slice(i).join('.'), use, exact: exact.slice(i), quoted: stored.slice(i) } : null) |
There was a problem hiding this comment.
SUGGESTION: The relation field of known is never read
Nothing after add() reads entry.relation - the matching loop only uses hit.use, hit.exact and hit.quoted - yet every manifest relation now allocates an exact.slice(i).join('.') string for each dotted suffix. Dropping relation from the map type (line 873) and from this object keeps the same behaviour with less work per relation (a sliced Tuva manifest lists every relation).
There was a problem hiding this comment.
The hand-written SQL/Jinja parser this comment is about was removed in 09f3adc (the design note in the PR body explains why). Documentation gaps now come from the columns the warehouse returns (undocumentedByEdit, plugins/altimate-code/hooks/dbt-mods-core.ts:837, with the baseline from builtColumns, plugins/altimate-code/hooks/dbt-mods.tsx:538). Hardcoded relations come from dbt's compiled SQL and the node's dependencies through altimate-code's dbt_map_relations (hardcodedReads, plugins/altimate-code/hooks/dbt-mods.tsx:570). So this code path no longer exists at 031a5c1.
…locks, dollar quotes and table functions read as unknown, aliased renders not lists Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| const runs = await runPlaceOf($, root) | ||
| const own = await targetOf($, root) | ||
| const target = await manifestTarget($, root) | ||
| const place = target !== own ? ((await runnerOf($, root).catch(() => null)) ?? root) : (await $.fs.exists(`${own}/manifest.json`).catch(() => false)) ? root : runs |
There was a problem hiding this comment.
SUGGESTION: parseNow still resolves the same target three times, and always pays for a run place it may not use
own (1628) reads dbt_project.yml through targetOf, then manifestTarget (1629) calls targetOf(root) again and stats the same own manifest, and this line stats it a third time. runs (1627) is needed only by the final branch, yet runPlaceOf always runs runnerOf plus packagesOf/dbt_project.yml/packages-file reads. runnerOf here is the same cached promise manifestTarget just resolved - a borrowed target cannot exist without a runner - so ?? root is unreachable, and it also differs from the sibling runs fallback. Return the resolved target and whether it was borrowed from manifestTarget (or take targetOf once and derive both), then compute runs only in the branch that uses it.
There was a problem hiding this comment.
Declining the rest: parseNow runs on a button press, and each extra resolution is a dbt_project.yml read or an exists probe against a 300 s dbt parse. runPlaceOf is kept because it also records the runner's package for the repo's own dbt (runFor), which runDbt in integration_tests needs. The ?? root covers runnerOf rejecting (it is called with .catch), not a missing runner.
| for (const node of Object.values(graph.nodes)) { | ||
| if (!FOLLOWABLE.has(node.type) || !node.path) continue | ||
| const name = node.name.toLowerCase() | ||
| if (!byName.has(name) || node.id.split('.')[1] === pkg) byName.set(name, node.id) |
There was a problem hiding this comment.
SUGGESTION: Fourth copy of "which package owns this node"
node.id.split('.')[1] === pkg (here and at 270), node.id.split('.')[1] !== pkg (270) and built.id.split('.')[1] === pkg (lineage.tsx:455) all depend on the unique_id being resource.package.name[.vN], but only findModel's doc says so. One exported packageOf(id) beside FOLLOWABLE would keep the four checks from drifting - the same duplication normalize still has (lineage.tsx:168 against package-runner.ts:7).
There was a problem hiding this comment.
Done in b1a5091: one exported packageOf(id) in lineage-graph.ts (documented as model.<package>.<name>[.v<N>]), used by findModel, modelsNamed, graphFromTools and checkPath. The normalize pair is answered on its own thread (lineage's copy is on main).
| // integration_tests' own fct_orders, at the same project-relative path, listed first. | ||
| const manifest = { | ||
| ...MANIFEST, | ||
| nodes: { 'model.shop_tests.fct_orders': { resource_type: 'model', name: 'fct_orders', original_file_path: 'models/fct_orders.sql', depends_on: { nodes: [] }, config: { materialized: 'view' }, columns: {} }, ...MANIFEST.nodes }, |
There was a problem hiding this comment.
SUGGESTION: The fixture pins findModel/impactFirst, but the answer path the change also touches is untested
The new modelsNamed preference (a package's node wins a name two projects share) and rootOf (lineage.tsx:266-270, which gives a borrowed manifest's own node integration_tests as its root) are separate code from the findModel(wanted, pkg) this test exercises through Read and Edit. No answer test uses a manifest holding both fct_orders nodes, and nothing names a model only integration_tests has, so a regression in byName's tie-break or in rootOf would not fail any test. Add a turn.complete answer naming fct_orders (asserting the package's graph and its int_orders parent) and one naming an integration_tests-only model (asserting the follow's root and stale hint read integration_tests).
There was a problem hiding this comment.
Added in b1a5091: "a package repo: a name the answer gives that integration_tests shares follows the package's own model" (lineage.test.tsx). The manifest lists integration_tests' fct_orders after the package's, so a name map that kept the last one would offer answer-model.shop_tests.fct_orders; the test asserts the package's button is offered and integration_tests' is not.
…; through the CLI the package's own is looked up by unique_id; the band asks for it by unique_id - A file of the project resolves to one of the project's own nodes or none, so a model not yet parsed in the package is not traced as integration_tests' model at the same path. - Over 4 MiB, when dbt_lineage answers a path with another package's node, the package's own is asked for by its unique_id. - With a borrowed manifest, the end-of-task band asks impact_analysis for the package's model by unique_id. - The model-context manifest slice is cached per project as well as per path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| const values = columns.length === 0 ? valueCandidates(one.original, current) : [] | ||
| // A package repo reading integration_tests' manifest: that manifest holds integration_tests' own models too, so the | ||
| // model is asked for by its unique_id. (A project's own manifest keeps the name: a versioned model goes by it.) | ||
| const borrowed = (await manifestFile($, one.root)) !== `${one.root}/target/manifest.json` |
There was a problem hiding this comment.
SUGGESTION: The borrow decision is re-resolved for every changed file, and from a different manifest than the one asked
The loop can walk more files than the five models eventually traced, and each iteration re-runs manifestFile (two fs.exists plus runnerOf) and reads/parses dbt_project.yml in projectName. Memoise it per root. More importantly, ask queries done.manifests[root] (the copy frozen at turn start), while borrowed is read from the live manifestFile: if something writes the project's own target/manifest.json during the task (a user-run dbt parse), borrowed flips to false and the package's model is then asked by name against the borrowed copy, tracing integration_tests' same-named node — the ambiguity this commit removes. Derive the flag from state.snapshot/done.manifests instead.
There was a problem hiding this comment.
Fixed in e7c2efa and reworked in 8307344: the unique_id a changed model is asked for by (changeId, task-impact.tsx) is now decided from the task's frozen manifest copy, the same file ask queries, so a dbt parse mid-task no longer flips it. Memoising per root is not done: the loop is bounded by the task's changed model files and each call is a couple of exists probes and one small yml read.
| async function graphFromTools($: EngineInterface, manifest: string, mtimeMs: number, model: string, path?: string, pkg?: string | null): Promise<{ graph: LineageGraph; id: string; columns: any } | null> { | ||
| const found = await graphFromToolsOnce($, manifest, mtimeMs, path ?? model, path) | ||
| // The path matched another package's node (integration_tests' model at the same path): the project's own, by its id. | ||
| if (found && path && pkg && found.id.split('.')[1] !== pkg) { |
There was a problem hiding this comment.
SUGGESTION: This is a fourth copy of the package extraction
id.split('.')[1] now appears here, at 253 and 270, in checkPath (465) and in lineage-graph.ts:253; only findModel's doc states the resource.package.name shape all of them rely on. One exported packageOf(id) beside FOLLOWABLE keeps a future id format from drifting between them, the way projectName was centralised in package-runner.ts.
There was a problem hiding this comment.
Done in b1a5091: one exported packageOf(id) in lineage-graph.ts, used by findModel, modelsNamed, graphFromTools and checkPath.
| } | ||
| let id = graph ? findModel(graph, wanted) : null | ||
| const pkg = await projectName($, root) | ||
| let id = graph ? findModel(graph, wanted, pkg, !!input.file) : null |
There was a problem hiding this comment.
SUGGESTION: !!input.file (ownOnly) is not asserted by any test
The only fixture with both packages' nodes at one path (lineage.test.tsx:328) still has the package's own node, so findModel returns it whether ownOnly is passed or not; the fixture where the own node is missing (lineage.test.tsx:348) goes through Edit/impactFirst, not a file follow. A Read of that fixture asserting the pane shows no model (instead of integration_tests' fct_orders) would pin this flag.
There was a problem hiding this comment.
Agreed that a file-follow test is the right pin. 8307344 adds "a package repo: a shell read of a package file the manifest lacks is not followed by its name…" and e7c2efa's "a file whose own node the manifest lacks…" covers the Edit path. A plain Read of that fixture is not yet asserted; this is still open with the remaining package-identity work on this PR.
There was a problem hiding this comment.
Done in 4ff8970: "a package repo: Read of a package file whose node the manifest lacks shows no model, not integration_tests' at its path" (lineage.test.tsx) reads the file and asserts no dbt_lineage call is made for integration_tests' node, which fails without ownOnly.
…lineage <name> through the CLI and /lineage-report <model>.<column> - Over 4 MiB, /lineage <name> answered with integration_tests' model of that name shows the package's own (asked for by unique_id) when it has one. - /lineage-report <model>.<column> on a borrowed manifest asks for the package's model by unique_id first, and by the name as given when the package has no model of that name. - One packageOf(id) reads a node's package; the answer-name preference has a test of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th> is a file lookup; the band judges a borrowed manifest by the task's copy - When dbt_lineage answers with another package's node, the project's own model, then its snapshot, is asked for by unique_id. - /lineage models/orders.sql looks the path up as a file: the project's own node or none. - Whether a task's model is asked for by unique_id follows the manifest copy the task reads, not the manifest as it is at the task's end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| await clock.settle() | ||
| expect(asked).toEqual(['models/fct_orders.sql', 'model.shop.fct_orders', 'fct_orders']) | ||
| const ui = await $.ui.mount({ ...PANE, surface: 'terminal' }) | ||
| expect(await ui.find({ type: 'Text', text: /lineage · fct_orders/ })).toBeDefined() |
There was a problem hiding this comment.
SUGGESTION: This test cannot tell the package's model from integration_tests' one
Both nodes are named fct_orders, the injected model.shop_tests.fct_orders copies the package node's edges (line 378), and the second command's own lookup is served from the cache, so asked (390/394) and this pane text are identical with the old graphFromTools that returned integration_tests' node. Drop the copied edges from the injected node (as lineage.test.tsx:328 does) and assert an int_orders upstream, or assert the focus's unique id, so reverting the name branch makes this test fail.
There was a problem hiding this comment.
Valid: the second lookup is served from the cache, so that half doesn't pin the name branch. Still open; the fix is to split the name lookup into its own test (no path lookup first), so it fails without the unique_id retry.
There was a problem hiding this comment.
Done in 4ff8970: the name lookup has its own test now ("…/lineage that the CLI answers with integration_tests' model shows the package's own"), with nothing cached before it; it asserts ['fct_orders', 'model.shop.fct_orders'] and fails without the unique_id retry. The path lookup is a separate test.
| const manifest = { | ||
| ...MANIFEST, | ||
| // integration_tests' own fct_orders listed last, so a name map that keeps the last would take it. | ||
| nodes: { ...MANIFEST.nodes, 'model.shop_tests.fct_orders': { resource_type: 'model', name: 'fct_orders', original_file_path: 'models/fct_orders.sql', depends_on: { nodes: [] }, config: { materialized: 'view' }, columns: {} } }, |
There was a problem hiding this comment.
SUGGESTION: This ordering does not pin the project's own node
With integration_tests' model listed last, a name map that keeps the first match (the actual regression: dropping packageOf(node.id) === pkg at lineage.tsx:267) still keeps the package's model and passes. Put model.shop_tests.fct_orders first, as the fixture at lineage.test.tsx:330 does, so the test fails without the tie-break.
There was a problem hiding this comment.
Valid: one ordering pins only one of the two regressions (keep-first vs keep-last). Still open; the fix is to assert both orderings.
There was a problem hiding this comment.
Done in 4ff8970: the answer-name test runs in both orders (integration_tests' fct_orders listed last, and listed first), so dropping the package tie-break fails one of them whichever way the map keeps duplicates.
…when it can be read: changed models, /lineage-report, written-out paths, shell reads, column-suffixed paths - A task's changed model is asked for by the unique_id its manifest copy gives the project's own node at the file's path (a version included, and integration_tests' own models as integration_tests'), when the copy is small enough to read; a borrowed copy too large to read keeps model.<package>.<name>. - /lineage-report <model>.<column> takes the project's own node of that name from a readable manifest. - An answer or plan that writes out integration_tests/models/x.sql names integration_tests' model x. - A shell read of a project file whose node is missing is not followed by its name; /lineage <path>.<column> keeps the file rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| const byPath = new Map<string, string>() | ||
| const below = borrowedRoot ? `${relative(root, borrowedRoot)}/` : null | ||
| for (const match of text.matchAll(/[\w./-]+\.sql\b/g)) { | ||
| const rel = match[0].replace(/^\.\//, '') |
There was a problem hiding this comment.
SUGGESTION: An absolute or Windows path is never matched, so the by-name map still picks the other package's model
rel is compared with node.path (dbt's project-relative original_file_path) after only ./ is stripped, and below is integration_tests/. An answer that writes the absolute path it edited -- /repo/integration_tests/models/fct_orders.sql -- never starts with that prefix, so path stays absolute and no node matches; byPath stays empty and line 288 falls back to byName, which names the package's model: exactly the misattribution this loop exists to prevent. A backslash path (integration_tests\models\fct_orders.sql) is worse: the regex stops at \, so rel is just fct_orders.sql and it matches no original_file_path. Strip a ${root}/ (and ${borrowedRoot}/) prefix and normalise \ to / before comparing, as relative already does elsewhere in the pane.
There was a problem hiding this comment.
Fixed in ff78b47 and 3f2b98a: modelsNamed now resolves each written-out path to an absolute path (relative ones against the session's folder, absolute ones as written), finds the dbt project it lies in, and matches only that project's package node at the project-relative path; a path no node of its project has names nothing, so the name map is never consulted for it. Tests: "…an absolute path names its own project's model…" and "…written-out paths name their own project's model each…" (lineage.test.tsx). Backslash paths are not handled (the plugin reads POSIX paths throughout); noted as a limitation.
| const word = match[0].toLowerCase() | ||
| const id = byName.get(word) | ||
| if (id && !found.has(id) && (word.includes('_') || ticked.has(word))) found.set(id, { id, name: match[0], root, ...(kept && { manifest: kept }) }) | ||
| const id = byPath.get(word) ?? byName.get(word) |
There was a problem hiding this comment.
SUGGESTION: A path mention of a model without an underscore is looked up and then thrown away
byPath now resolves models/orders.sql to the orders node, but the guard on the next line still keeps only a word with an underscore or one in ticked (a backticked name or path). So an answer that writes integration_tests/models/orders.sql without backticks adds nothing to the pane, and the common names (orders, customers, payments) never benefit from the new path lookup unless the whole path is backticked. Since the comment above says a path written out names its model, add byPath.has(word) to the guard.
There was a problem hiding this comment.
Fixed in ff78b47: a resolved path mention is added on its own (the mentions list), not through the underscore/backtick word guard, so integration_tests/models/orders.sql names orders with or without backticks; the words inside the path are not matched again.
…or by a name the other may answer to; written-out paths name only their own project's model - A changed model the shared manifest does not have yet, and any changed model of integration_tests or the package when the manifest is too large to read, is asked for as model.<its project>.<name>. - Each written-out .sql path in an answer or plan resolves to its own project's node (integration_tests' by integration_tests' package name), a path given from a subfolder by its ending; a path no node of that project has names nothing rather than another project's model of the same file name. Two paths with one model name stay two models. - Tests pin the name lookup through the CLI, the file rule on Read, and the answer-name preference in both orders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e manifest or not; a task report matches traces to changes by id - Each written-out .sql path is resolved to the dbt project it lies in (relative, ../ or absolute), and only that project's node at it counts; the borrowed manifest's location is kept when it is too large to read, so integration_tests' paths never fall to the package's same-named model. - The report's upstream traces are matched to their change by unique_id, so two same-named models (the package's and integration_tests') are each traced as themselves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ort and the value cap; Claude's own dbt_lineage call is followed by the node it answered for - Traces are matched to their change by unique_id (sameModel) in the band summary and the HTML report, and the three-value cap counts per change. - A dbt_lineage call Claude makes on a manifest a package repo borrows is followed by the unique_id it answered for, in the session's project when that node is the package's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ape; a failed lookup of the package's own model is a failure, not the other package's; /lineage <path>.<column> through the CLI - The node a dbt_lineage call answered for is read from the column-trace focus, the top level, structuredContent or the text, for a call that names its manifest. - Over 4 MiB, when asking for the package's own model by unique_id fails, the pane says so instead of showing integration_tests' model. - /lineage models/orders.sql.amount over 4 MiB looks up models/orders.sql. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ows; a text dbt_lineage report is followed by its ID line Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it lies in, whatever project the pane shows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is followed as the file it names, in its project, with integration_tests' manifest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roject's files: graph buttons, /lineage <id>, answers and Claude's calls Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ote reads a file reached through ../ as the file it names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st is too large to read; the band's untraced-column hint names the model by its unique_id Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
review-loop: APPROVED at 35a3eeb (reviewers: gpt-6-astra high, gpt-6.1-sol high) |
… task's changes read their project's manifest once - modelsNamed reads a written-out path with either separator, and keys its owner lookup on the one manifest it reads - a task resolves each project's name, manifest graph and sharing once, not once per changed file - sharesManifest and runnerOf read `local:` packages through one parser, and a shared manifest is any but the project's own target/manifest.json - the trace-to-change match goes through sameModel everywhere - tests: backslashed path, integration_tests' path over 4 MiB against the package's SQL files, the pane's project for a borrowed manifest, and the number of reads a task's changes make Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ioned package models in a large shared manifest; value columns past three counted - follow resolves the node's owner before the ownership check, so an older follow can no longer claim the pane over a newer one - /lineage <name> over 4 MiB looks a versioned package model up by its file (orders.sql, orders_v2.sql) before showing another package's model - a task's made-up unique_id the manifest lacks is asked for by name - every column whose value changes is traced for the report; the band shows three and counts the rest, whose unread models still count - the doctor's package check needs the package's own packages when it has a manifest of its own, where Run dbt parse runs - a schema.yml deleted after the manifest was written is said, like an edited one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sahrizvi
left a comment
There was a problem hiding this comment.
Consensus review: APPROVE. Panel: Claude (lead) and Codex (independent pass, then a cross-check of each other's findings). Reviewed at 6a3d08e207, which includes current main.
What was checked against real tools. jaffle_shop_duckdb built with dbt 1.11 and duckdb. The altimate-code CLI was built from the head of altimate-code #1795 (97c3fd556e), with npm 0.12.12 for the fallback path. Tuva's integration_tests was set up with dbt deps and dbt parse.
- Row A reproduced and fixed.
impact_analysisonstg_payments.amountgives 0 columns withorders/customersasstarwhen the manifest copy sits intarget/.altimate-lineage/. It gives 6 columns in 2 models when the copy sits intarget/. Both CLIs agree. Fed throughsummaryOf/summaryLines, base prints "reaches 0 columns in 0 models … ✓ Every downstream model was read". Head prints the real reach, and for the old location "not traced: 2 downstream models may read it without naming it (select *)" with a lower-bound footer. Cleanup only deletes.altimate-*manifest*.jsonolder than a day. Copies are per session. Nothing in altimate-code globstarget/. - Row C. No false positive across 21 models covering sources, seeds, snapshots, ephemeral parents,
ref(v=1), latest version,ref('pkg','m'),{{ this }}, a CTE named like a model and subquery refs. Hardcodedmain.stg_orders, a barestg_ordersand an aliased table are flagged. - CTE own times. These match hand arithmetic with #1795's real
reads(0-based, agreeing with the plugin). Self-reads and forward reads are ignored, and 0.12.12 keeps the old rule. - Row D. The Bash pre-hook does only a regex test and a clock read before the command, as at base.
- Single-project repos take the same paths as base apart from two small file reads.
- Tests. Head: 1356 pass, 1 fail. The failure is the known
runs.test.tsxtiming flake, which also fails alone at base 3 of 3 runs.tests/*.sh8/8 and pytest 65/65 pass at both trees. Five fixes reverted by hand each fail their regression tests.
Remaining minors (none blocks):
- A deferred
ref()can be flagged as hardcoded (inline). This is an edge input: it needs deferral inherited from the environment, the ref resolving to the prod relation, and a source declared on that exact relation. Codex first rated it major, then re-rated it minor after the reproduction. - A literal-only change inside a
{% set %}block names no value column (inline). The band still says the hedged "values may change downstream", so this is a missed hint, not a wrong certainty. - The baseline
dbt show --inline select * … --limit 1is not in the README or the cost note, and the cost gate does not see it (inline). It is bounded to once per model per conversation, so it is safe to document in a follow-up. - Shell-edit detection misses some writers (inline). These are edge commands, and a miss only means no note.
- Package models on Tuva's 9.7 MB borrowed manifest carry no
ymlwith #1795's head, so the schema.yml warning cannot fire there (inline). This is a Tuva-only edge, and it degrades to the old-CLI behaviour.
The nits and conflict notes are in a separate comment.
| const candidates = Array.isArray(one?.candidates) ? one.candidates : [] | ||
| if (one?.match === 'none' || candidates.length !== 1) continue | ||
| const hit = candidates[0] | ||
| if (typeof hit?.uniqueId !== 'string' || hit.uniqueId === self || known.has(hit.uniqueId) || typeof hit.replaceWith !== 'string') continue |
There was a problem hiding this comment.
Minor (edge input): a correct ref() can be flagged when the plugin's own dbt show defers.
The plugin's dbt inherits the session's environment. With DBT_DEFER=1 DBT_STATE=<prod state> DBT_FAVOR_STATE=1 (or deferral to a missing dev relation), {{ ref('stg_orders') }} compiles to "jaffle_shop"."prod"."stg_orders". If the project declares a source on that prod relation (prodsrc.stg_orders), dbt_map_relations returns exact/1 source.jaffle_shop.prodsrc.stg_orders. That id is not in known, so the check says "hardcoded … use {{ source('prodsrc', 'stg_orders') }}" and asks Claude to replace a correct ref.
Reproduced with dbt 1.11, duckdb and the #1795 CLI. Without such a source, the prod relation maps to none and nothing is flagged.
A possible fix: skip a mapping whose table name equals a parent's name/alias when deferral is active, or pass the deferred relations as known.
| export function valueCandidates(original: string, current: string, max = MAX_TASK_COLUMNS * 2): string[] { | ||
| const lines = (text: string) => | ||
| text | ||
| .replace(/\/\*[\s\S]*?\*\/|\{#[\s\S]*?#\}|\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}|'(?:[^']|'')*'|--[^\n]*/g, ' ') |
There was a problem hiding this comment.
Minor: a change only to a string literal yields no value candidates.
Inside {% set cols %} … case when status = 'paid' then amount else 0 end as paid_amount {% endset %} read by select {{ cols }}, changing 'paid' to 'settled' makes both changedColumnsAll and valueCandidates return []. The literal is stripped before lines are compared, so the changed line matches the original. paid_amount is never traced, and the band falls back to "values may change downstream; the model-level count stands".
This is hedged, not wrong. Comparing lines before stripping literals, and extracting words after, would keep the candidate.
| // (An ephemeral model has no relation of its own: dbt would inline its edited SQL, so there is nothing from before.) | ||
| const ephemeral = (node?.node?.config?.materialized ?? known?.node?.config?.materialized) === 'ephemeral' | ||
| // Of those, only the ones undocumented then count as older gaps: a column whose documentation the edit removed is new. | ||
| const builtBefore = lastReturned.has(fileKey) || !(drift.undocumented.length && returned && named && !errors.length && !ephemeral) ? null : await builtColumns(run1, pkg, named, node?.node?.version ?? known?.node?.version, viaRunner, `${scratch}/baseline`) |
There was a problem hiding this comment.
Minor (document it): a second warehouse query that the cost gate does not see.
On a model's first check in a conversation that finds an undocumented column, this runs dbt show --inline "select * from {{ ref('<model>') }}" --limit 1 on top of the check's own dbt show. It takes about 1.9 s on duckdb.
maxScanBytes gates only Claude's Bash dbt commands (features/cost.tsx), so this query is never estimated. On BigQuery, select * with LIMIT 1 still bills a scan of every column of the built table.
It is bounded: once per file per conversation (lastReturned, cleared on session start and /clear), not for ephemeral models, and only when there is a gap to tell apart. If a newer check of the same file replaces this one before it records lastReturned, the next check runs it again.
README.md:147 still says "One dbt show runs per edit", and the cost note at :153 names only dbt show --limit 1. Please document the baseline there, and consider skipping it when the adapter bills by bytes scanned.
| } | ||
|
|
||
| // A shell command that may write the SQL files it names (`sed -i`, a redirect, `tee`, a script). | ||
| const WRITES = /\bsed\b[^|;&]*\s-i|\bperl\b[^|;&]*\s-\w*i|>>?\s*['"]?[^\s'"|;&]*\.sql\b|\btee\b|\b(?:python3?|node|ruby|bun|deno)\b|\b(?:mv|cp|patch|truncate)\b|\bgit\s+(?:apply|checkout|restore)\b/ |
There was a problem hiding this comment.
Minor (edge): shell writers this regex misses.
These commands are not detected: awk -i inplace, ed, rsync … models/, ln, dbt run-operation writing a file, and vim/code --wait. mv a.sql b.sql matches, but a rename keeps the file's mtime, so find -mmin never sees b.sql.
False positives are cheap: git checkout -b, tee -a log, python3 -c 'print(1)' and cat package.json | grep node cost a find per project and nothing else.
Nothing new runs before the command. After it, the result can wait up to 3 s for find plus 8.5 s for the impact lookups when a model changed.
| if (await newer(node.path)) return `${base(node.path)} changed after the manifest was written: run \`dbt compile\`, then press r` | ||
| // Its schema.yml: the tests and documented columns the pane counts come from there. One deleted since leaves them | ||
| // all out of date too; one that cannot be read is not said to be either. | ||
| if (node.yml && (await newer(node.yml))) return `${base(node.yml)} changed after the manifest was written: run \`dbt parse\`, then press r` |
There was a problem hiding this comment.
Minor (Tuva-only edge): this warning cannot fire for package models on a borrowed manifest over 4 MiB.
With #1795's head (97c3fd556e, "yml only for a known root project"), dbt_lineage include_graph on Tuva's integration_tests/target/manifest.json (9.7 MB) returns yml on 2 nodes, neither of them a package model. core__medical_claim has none. So on Tuva opened at the repo root, "schema.yml changed after the manifest was written" never shows for the package's own models. This degrades to the old-CLI behaviour. Worth stating with the other known limits.
|
Consensus review notes (Claude + Codex): nits and items not tied to a diff line. None blocks.
|
Fixes the plugin behaviour seen in the 19 Nov hands-on testing (rows A, C–I) on dbt Labs' jaffle_shop_duckdb and Tuva Health's public tuva repo.
Merge order: this was cut from
fix/plugin-demo-bugs(#42). #42 merged before this was pushed, so the branch sits onmainwith #42 in it; nothing else to merge first.Live checks ran in real Claude Code 2.1.329 sessions (
claude --plugin-dir plugins/altimate-code) with altimate-code built from source (fix/tools-demo-bugs), dbt-core 1.12.7 and dbt-duckdb 1.11.1, using the steps in the report's section 5.A · band said "amount reaches 0 columns in 0 models · ✓ Every downstream model was read" on a compiled project
mainbefore fix: /clear keeps comments and health, plugin dbt runs keep the project's manifest, and five demo bugs #42 and onmainwith fix: /clear keeps comments and health, plugin dbt runs keep the project's manifest, and five demo bugs #42 (cents change instg_payments.amount, thendbt build): both said 0 columns in 0 models · 2 more may change · ✓ Every downstream model was read, while the per-edit note in the same session said 6 columns in 2 models. So the manifest overwrite was not the cause.target/.altimate-lineage/. altimate-code treats the folder above the manifest's folder as the project and reads a seed's CSV header from there.stg_paymentsdoesselect *from theraw_paymentsseed. From a copy one folder deeper, the header could not be found, soordersandcustomers(bothselect *) came back asmay_carrywith reasonstar, andunresolvedwas empty. The band read that as a real 0 with every model read. The same manifest intarget/traces 6 columns.target/itself (.altimate-manifest-before.<session>.json,.altimate-task-manifest.<session>.json). Copies left in the old folder are still cleaned up. If the reach is 0 while downstream models may pass the column on without naming it (star,natural_join,dynamic_name,row_reference), the band now says "not traced: N downstream models may read it without naming it (select *)" with a lower-bound footer, never "✓ Every downstream model was read".impact-report.test.ts› "a reach of 0 beside readers that select * is not traced…" uses altimate-code's real answer captured from the live run.task-impact.test.tsxchecks that the copy is intarget/and checks the cleanup of both folders.C ·
ref('stg_orders')replaced bymain.stg_orders, and compile & validate still said it matcheddbt show, compile & validate hands the SQL dbt just compiled (target/.altimate-plugin/compiled/<package>/<path>) to altimate-code'sdbt_map_relations. altimate-core reads the tables, and the tool matches each one to the manifest. A table matched to a single model, seed, snapshot or source that is not among the model'sdepends_on(dbt's own dependency list, from the manifest the show wrote) is a hardcoded read. The check becomes a warning: band "hardcoded main.stg_orders: use {{ ref('stg_orders') }} — lineage can't follow it". The dbt check pane lists it, and Claude's note asks it to put theref()back unless the person asked for the table. If the tool is missing or fails, nothing is flagged. The plugin does no SQL parsing for this.dbt-mods.test.tsx› "a table the compiled SQL reads that is a dbt node but not a dependency is flagged…" and "a table read through ref() (a dependency), the model itself, or an unclear match is never flagged…".D · no per-edit impact note when Claude edited through Bash
sed -i,perl -i, a redirect to a.sql,tee,python3/node/…,mv/cp/patch,git apply/checkout/restore), only the time is noted. Nothing is read or run before the command, so it never delays the command or the gates. Afterwards, model files under the project's model paths that changed since then (find -mmin -<minutes the command ran>, then each file's mtime) get the same impact-first note, diffed against the last commit. Withshow_edit_impactit goes to the transcript, and it always goes to Claude's context. At most 3 files per command.lineage.test.tsx› "a model a shell command rewrites gets the per-edit impact note too…" (a read-onlycatgets nothing).python3one-liner: "◆ impact-first · stg_payments.amount reaches 6 columns in 2 models" on screen, and "added to Claude's context: lineage for stg_payments.amount (changed by a shell command)".E · "undocumented order_id, amount" for columns that were already undocumented
dbt show --inline "select * from {{ ref('<model>') }}" --limit 1, the model's relation as it was built (with package and version from the runner). A column that was returned and undocumented before is not the edit's gap; one whose documentation the edit removed is. Names match exactly, and a gap that an earlier edit in the conversation made stays that edit's until documented. Older gaps don't make the check a warning, are mentioned once per conversation, quietly ("2 undocumented before this edit"), and the pane marks them "not documented, from before this edit". If the relation was never built, every gap counts as the edit's.dbt-mods.test.tsx› "a column the model returned before the edit is not the edit's gap…" (unit) and "only the columns an edit left undocumented are its gaps, from what the warehouse returned before…" (asserts the inline show, a single baseline query, the quiet second mention, and the pane heading), plus "after /clear, the next conversation compares with the model as built again…".F · the pane showed the last model read while Claude edited another
lineage.test.tsx› "the pane moves to the model being edited as the edit starts…" (the lookup is held, and the pane already shows the model).G · at default size the graph ran off the right edge and dashboards weren't visible
vshows the whole graph, then cycles as before.lineage.test.tsx› "a graph wider than the pane opens as its ends…". Tests about the whole graph now pressvfirst.H · Tuva: compile & validate ran dbt in the package root and failed with "Run dbt deps"
dbt_project.yml, which is the package. Its packages aren't installed there, and its models are disabled there (claims_enabled).packages.yml/dependencies.ymlinstalls this package by a local path (local: ../). If that project's packages are installed, dbt runs there with the repo's own dbt (its.venvwhen that project has none) and selects the model bypackage:<pkg>,<name>(<name>.v<N>for a versioned model). The band says "ran from integration_tests". The doctor counts packages installed there as installed. If dbt still says packages are missing, the result is a one-line "not checked: dbt's packages are not installed in …" note instead of a failure.dbt-mods.test.tsx› "a package tested from integration_tests is compiled and validated from there…" and "a project whose packages are not installed gets a one-line note…"./…/tuva/integration_tests.I · "no output column changed: the model-level count stands" after a change to what paid_amount holds
core__medical_claimlists its columns in a{% set %}block that the select reads. The select-item diff saw no change.impact_analysis(change_type modify) then decides which of those words are the model's columns and what each reaches. Only names that reach a downstream column are shown, as "values may change in paid_amount → reaches N columns in M models". If none qualify: "values may change downstream; the model-level count stands" (or "no model reads it downstream" when the count is 0). It never shows a reach of 0.impact-report.test.ts› "a change no select item shows…".task-impact.test.tsx› "a value change names the columns the manifest has that reach downstream; one that reaches nothing is left out, never shown as 0", plus the fallback text.Live rechecks after the redesign
Run on 20 Nov in Claude Code 2.1.329 with the PR build and altimate-code built from source:
Design note: no SQL parser in the plugin
The hand-written SQL/Jinja parser in
dbt-mods-core.ts(about 550 lines, used for E and C) is removed, because SQL and Jinja shapes it misread kept turning up. E now compares the columns the warehouse returns (dbt show), and C uses dbt's own compiled SQL anddepends_onwith altimate-code'sdbt_map_relations. I keeps only a word list that altimate-code'simpact_analysisfilters, with "may" wording.Numbers each mod shows
An audit of every number the mods show in the demo videos found these. Each is fixed here with a regression test that fails at c35608c:
task-impact.test.tsx› "a value change on Tuva…", using the real Tuvaimpact_analysisanswer (hooks/tuva-answer.fixture.ts, Apache-2.0 SQL and the tool's answer)./profile-ctesown times: a CTE's own time was its count's time less the CTE before it. A sibling CTE that follows a slower one showed+0 ms(paymentsafterorder_items). With an altimate-code that lists each CTE'sreads(fix: dbt_cte_profile lists the earlier CTEs each CTE reads altimate-code#1795), a CTE's own time is its count's time less the own times of every CTE it reads, directly or through another. An older altimate-code keeps the previous rule. Tests:cte-profile.test.tsx(thecustomer_revenueshape, failures in the closure, and the pane).dbt parse, then press r". On the >4 MiB path this uses theymlthat altimate-code#1795 adds to graph nodes. Tests:lineage.test.tsx(both paths).info_toastssetting (default on). When off, the dbt helpers raise no toast for what the transcript or the band already shows (model context added, a passing compile-and-validate, recheck or doctor). Failures still toast. The demo sessions record with it off.dbt showtable is read as numbers only for a column dbt draws right-aligned (as it draws numbers). A text column (versions such as1.10), a column whose cells show no alignment, and leading-zero codes (00501) stay text, as dbt's JSON gives them. Tests:dbt-mods.test.tsx(thetextTablecases, using dbt 1.11's own output).impact-report.test.ts,task-impact.test.tsx./dbt-doctortests the connection shows as stale afterwards. Test:dbt-mods.test.tsx› "an edit while /dbt-doctor tests the connection…".core__medical_claimcounts 91 data tests plus 53 unit tests (impact_analysis'test_countis data tests only); "2 synced · 1 found" counts Jira twice by design (connected, and a local jira-cli credential is offered next to it);impact_analysis"may change" for a model that reads the changed model but not the column is the tool's conservative answer.Package repos: the lineage half reads the manifest integration_tests writes
The previous video's Tuva scene only showed the band's "reaches 124 columns in 13 models" because the demo folder had a hand-made
target -> integration_tests/targetlink. In a plain Tuva clone the package root has notarget/, so the lineage pane, the per-edit note and the band fell back to the SQL files and traced nothing, and the doctor said the manifest was missing. Fixed (hooks/package-runner.ts):/lineage-report, a plan's impact, the doctor's manifest line (and its Run dbt parse) and model context on read useintegration_tests/target/manifest.jsonwhen the package has no manifest of its own. The task's manifest copy sits beside it, one copy per task./lineage <name>,/lineage <path>[.column](the session's path, in the project it lies in),/lineage-report <model>.<column>, written-out paths and unique_ids in answers and plans, and Claude's owndbt_lineagecalls. Two same-named models changed in one task keep their own traces in the band and the report. A node is checked for staleness against its own project's files, and a path reached through../is the file it names.lineage.test.tsx,task-impact.test.tsx,dbt-mods.test.tsxandimpact-report.test.ts("a package repo …"); each fails on the commit before its fix.targetlink): "◆ impact-first · core__medical_claim.paid_amount reaches 124 columns in 13 models, 84 may carry it", the band "values may change in paid_amount → reaches 124 columns in 13 models (44 end columns) · 84 more may change", the pane "8 direct · 89 transitive · HIGH", and compile & validate "ran from integration_tests". These matchaltimate tool run impact_analysison the same manifest (124 columns, 13 models, 44 ends, 84 may carry, 97 at model level).Known limits and follow-ups
dbt_lineage/impact_analysismatch a model by name or unique_id with no package scope. For a borrowed manifest over 4 MiB (Tuva's is 12 MB) the plugin asks for the package's model asmodel.<package>.<name>; a versioned package model that shares its name with an integration_tests model isn't found that way (a file lookup then shows nothing rather than the other project's model). Package-scoped lookup in altimate-code would remove this.<project>/target/manifest.jsonand ignores a customtarget-path(as onmain); the dbt helpers honour it.hooks/features/docs.test.tsxends with an extra blank line. Backslash paths in answers aren't resolved.Demo video
/Users/harish/.quikim/artifacts/pu-mods/videos/Hands-on-findings-fixes-v2.mp4(1920x1080, 2:04), recorded in Claude Code 2.1.330 at 35a3eeb on jaffle_shop_duckdb and Tuva (notargetlink). Scenes: A and E 0:15, D 0:38, C 0:52, F and G 1:11, H and I 1:36 (row I's band with the traced paid_amount reach at 1:52). Toasts and the repeated notice lines were kept off the screen with a recording-only helper, so nothing covers the transcript or the callouts.Checks
claude plugin test plugins/altimate-code: 1347 of 1348 pass at 35a3eeb. The one failure, "a dbt call that starts while another call reads its artifact", also fails onmain(e36c74f). Timing tests ("a line with a great many dbt calls…", "drawLayered draws a 500-node lineage…") fail only under load and pass in isolation.mainat e36c74f): the lineage tests for D, F and G fail one by one.impact-report.test.ts,task-impact.test.tsxanddbt-mods.test.tsxdon't load on the base, because the functions under test don't exist there.claude plugin validate --strict .passes at 35a3eeb (Claude Code 2.1.330).bash tests/*.sh: all 8 pass.🤖 Generated with Claude Code