Skip to content

feat: dbt helpers from dbt Power User in Claude Code sessions (1.6.0) - #23

Merged
hkaltai merged 57 commits into
mainfrom
feat/implement-items-7-8-9-12-15-with-e2e-demo
Nov 19, 2026
Merged

hkaltai merged 57 commits into
mainfrom
feat/implement-items-7-8-9-12-15-with-e2e-demo

Conversation

@hkaltai

@hkaltai hkaltai commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds five dbt helpers to the altimate-code Claude Code plugin, items 07, 08, 09, 12 and 15 of the "Mods from dbt Power User" concept. They run the project's own dbt (.venv/venv in the project, else dbt on PATH) and never call a model. The code is in a new hooks/dbt-mods.tsx, with dbt-mods-core.ts for parsing dbt's output and files and pane-size.tsx for pane sizes, and is wired into the existing hooks module.

  • 07 Compile and validate. After Claude edits or writes a model under model-paths, the plugin runs dbt show for that model (selected by path, package and name, limit 1). dbt's error, plus any columns the query no longer returns or returns undocumented compared with schema.yml, are sent to Claude with the edit result and shown in a line above the prompt. A problem opens a dbt check pane. If the query returns no rows or nothing is documented, it says the columns were not compared. It checks again when the model or its schema file changes.
  • 08 Explain and Fix. When a dbt run, test, build, seed, snapshot or retry that Claude ran fails, the failed nodes appear above the prompt with Explain and Fix with Altimate Code. Failures come from the run_results.json that command wrote, together with dbt's printed errors. The failure clears only when the same kind of run (or a build), with the same selection and flags, passes from the same folder and environment. Display-only flags don't count. Output that can't be split per command never clears it.
  • 09 Query results pane (renamed from "dbt results"). Rows from Claude's dbt show and from /dbt-show open as a table beside the chat, with Re-run, Bookmark and a history kept on this machine. The pane, and the lineage pane, have Min / Default / Max sizes, remembered per pane. Default is the widest dock the surface allows, and the grid stops truncating columns when there is room. Claude Code places panes itself (dock, inline or widget), so a plugin can't put one at the bottom or in the main area. Environment values set in front of a command are never written to disk. Nothing from profiles.yml beyond the adapter type, profile and target names reaches Claude or the panes; dbt's quoted profiles.yml parse error is replaced with a fixed message.
  • 12 Model context. When Claude reads a model, its materialization, columns (types, descriptions, tests), parents, children and DAG depth from target/manifest.json go with the file, once per turn. A manifest over 4 MiB is sliced through the project's Python.
  • 15 Environment doctor. At session start it checks dbt-core, Python, the profile's adapter, installed packages and manifest freshness, and offers Run dbt parse / Run dbt deps. The adapter comes from profiles.yml, read with dbt's own Python and PyYAML; DBT_PROFILE, DBT_TARGET and the default target are honoured, and when it can't tell, it says so instead of guessing. /dbt-doctor adds the warehouse connection test, which session start never runs.

The dbt_mods option turns all of this off. Version 1.8.0 (main already shipped 1.6.x and 1.7.0; main is merged in). README, CHANGELOG, PRIVACY and CONTRIBUTING are updated. The docs page is in the companion altimate-code PR.

Supported scope

The helpers are built for dbt 1.5+ on a normal project, and for Claude commands that run one dbt invocation (optionally after cd, a venv/uv prefix, or piped through tail/head).

Outside that, they take the conservative path: no band, nothing cleared, nothing saved, or "could not tell". That covers:

  • compound commands with several dbt invocations, || fallbacks, killed runs, and contradictory repeated flags;
  • YAML beyond plain mappings, anchors and env_var;
  • non-terminal surfaces.

How did you verify your code works?

  • claude plugin test plugins/altimate-code: 824 pass, 0 fail (with main merged in). The new tests drive the real hooks through the mods test kit. claude plugin validate and --strict: pass. tests/*.sh: 8/8 pass, including tests/dbt-scripts.sh, which runs the three embedded Python scripts for real against fixtures holding a sentinel secret. pytest: 65 passed.
  • End to end in a real Claude Code session on a local dbt + DuckDB project (recorded):
    • the doctor and dbt parse;
    • model context, quoted back by Claude;
    • a column rename caught by compile and validate;
    • a failed build, then Explain, then Fix with Altimate Code turning the check green;
    • /dbt-show with bookmarks;
    • /dbt-doctor with the connection test.
  • Independent peer review (claude and codex CLIs) with attack-the-fix gates; both reviewers approved the final round.

Follow-ups (not blocking)

  • run_results.json from another writer that produces a new invocation during Claude's own dbt command can still be read as that command's. This is outside the supported scope of one dbt invocation per command.

  • The embedded profiles.yml script can't be run by the test kit, which can't spawn processes. It was run by hand under Python with PyYAML against 17 fixtures (anchors, merges, env_var, missing output or type, invalid YAML).

  • Pre-existing, not from this PR: claude plugin validate --strict fails on 4 isCollapsed band-fixture type errors in lineage.test.tsx and on the missing plugin icon. The drawLayered … under 300 ms perf test in lineage-layout.test.ts can flake under load.

Cost side effects

  • Each model edit: compile and validate runs one dbt show --limit 1 against the warehouse, after each model edit and when the model or its schema file changes outside Claude. A newer edit replaces a queued check before it runs.
  • Billing: on warehouses that bill by bytes scanned, or that wake a suspended warehouse, this costs money. It's documented in the README, and dbt_mods: false turns it off.
  • On request only: /dbt-show, Re-run, Run dbt parse/deps and the connection test run only when the person asks.

🤖 Generated with Claude Code

hkaltai and others added 22 commits November 13, 2026 14:47
Compile and validate each model Claude edits, Explain and Fix on a failed
dbt run, a results pane for dbt show, the manifest's facts on a model Claude
reads, and an environment doctor at session start. Each runs the project's
own dbt and calls no model; the dbt_mods option turns them off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checks say what they did not compare instead of claiming a match, and only
run again when the model or its schema file changes. A passing run clears a
failed one only when it ran the same thing. The doctor reads the project's
own paths and profiles dir. Re-run keeps target, profile, vars and limit.
History updates no longer overwrite each other, and a manifest over 4 MiB is
read through the project's Python. A /clear drops the check and the failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-run replays Claude's own dbt invocation as the shell tokenized it, from the
folder it ran in, and only when it did not depend on the shell. Checks select
the edited file by path, are keyed by project and file, skip a query a newer
edit replaced, and say nothing to a conversation that ended. A failed run
clears only for the same target and selection. The doctor reports unreadable
folders and deleted files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rechecks belong to the conversation that asked and run again after schema or
macro edits in the model's project. Failure context includes environment set
for the command. Compile failures in JSON logs keep Explain and Fix. The doctor
finds deleted files the manifest lists (the project's own), reads the one
profiles.yml dbt reads and the project's target-path. Escaped shell characters
and path spellings no longer split one project or one command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The project's own model wins over an installed package's at the same path.
Environment for a dbt command is the effective value per variable and part of
a query's identity. A deleted schema file rechecks its model, and the doctor
finds any deleted file the manifest names. Pending rechecks keep only edits
that concern them. Two more dbt show output forms reach the results pane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validation selects the edited file within the project's own package and reads
that node's preview. Every dbt invocation in a shell command is read in the
whole command: several runs are one compound result, the rows go to the show
that previewed them, and Claude's shell folder (not the session root) locates
the project. The doctor honours packages-install-path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g and preview attribution

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…parsing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…file targets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n and Fix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at runs; doc files in the doctor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntity

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… per resource

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t values kept only as hashes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…env values never persisted, display-only --no flags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… of the terminal, templated profile targets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ws dbt's profile and target selection

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or names why it cannot tell the adapter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iews with emoji; column widths

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…res project files; templated adapter types

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hkaltai
hkaltai marked this pull request as ready for review November 14, 2026 03:42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/hooks/lineage.tsx Resolved
@kilo-code-bot

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

Copy link
Copy Markdown

Code Review Summary

Status: 12 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 12

Incremental review at a56d3b6: the newest commit fixes the three round-4 edges (an in-flight profile-value load is awaited instead of skipped, date-shaped values are collected, dbt's as_* filters render in the redaction script) and adds the /clear-race test. The three changes are correct: keep() now stringifies every non-str, non-None scalar (dates included), the done promise is set before it is awaited so a second caller shares the same load, and the four identity filters let env_var(...) | as_text be recorded. One new test-quality issue is inline at dbt-mods.test.tsx:277. The remaining findings are the previous suggestions, re-checked at this HEAD (their line numbers follow the current file).

Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/dbt-mods.test.tsx 277 (new) The comment says the hold is on "the second" session.cwd read but the ordinal is 8; if any feature changes the count the hold never fires, endDbtMods clears failureAtom anyway, and the /clear race test passes without exercising the race
plugins/altimate-code/README.md 141 The sentence says a failed run's nodes are not read from the other target-path folder, but failuresFromText(output) (dbt-mods.tsx:694) still adds dbt's printed failures from splittable output to the band; the removed "(a failure dbt printed still shows)" was accurate
plugins/altimate-code/hooks/dbt-mods.tsx 702 redactValues(command) also redacts the command explainPrompt/fixPrompt (dbt-mods-core.ts:641, :649) hand Claude, so Explain/Fix work from DB_PASSWORD=‹redacted› dbt build … instead of the command Claude actually ran
plugins/altimate-code/hooks/dbt-mods-core.ts 316 The comment "Values never leave this function in the clear" is contradicted by assignments: one.env (:357), which returns the raw NAME=value strings; the use is fine (stdin plus the in-memory key), the comment is stale
plugins/altimate-code/hooks/dbt-mods.tsx 1128 repr(part)[1:-1] duplicates the str repr redactionForms already adds (dbt-mods-core.ts:119-129), and JS then re-escapes it into double-escaped forms that cannot match; only the bytes repr is new, so the two escaping rules can drift
plugins/altimate-code/hooks/dbt-mods-core.ts 92 The comment says the values are "cleared when the conversation ends", but clearRedactions (:99) has no production caller; command assignment values are held for the plugin's lifetime too
plugins/altimate-code/hooks/dbt-mods-core.ts 265 flagOf/profilesDirOf (:274) reject ~ before profileCandidates' HOME expansion (dbt-mods.tsx:1148) can run, so --profiles-dir ~/foo falls back to the default candidates and that file's secrets are never held
plugins/altimate-code/hooks/dbt-mods-core.ts 133 redactValues/redactionValues flatten every loaded file, now including values from a command's NAME=value assignments, so a value is cut from every project's dbt text
plugins/altimate-code/hooks/dbt-mods.tsx 1081 The for value in recorded loop runs before the secret and key not in PLAIN check (:1083), so a type/threads/method/port env_var value or default of 6+ characters becomes a redaction value; the docs say those fields are never treated as secrets
plugins/altimate-code/hooks/dbt-mods.tsx 1055 A plain jinja2.Environment() is not a sandbox, so "nothing executed" (:1012) is false; every candidate profiles.yml is rendered when a dbt command runs, and dbt-mods.test.tsx:3743 describes the plain Environment
plugins/altimate-code/hooks/dbt-mods.test.tsx 381 The PROFILE_REDACT stub keys on argv[4] and ignores argv[5] (the profile, passed at dbt-mods.tsx:1196), and tests/dbt-scripts.sh's redact() (:92-96) never passes a profile, so the sys.argv[3] read and the --profile path stay unpinned
plugins/altimate-code/README.md 148 (active inline comment) "32 KiB a query" reads as unconditional, but fitSaved (dbt-mods-core.ts:837) keeps a query whole when its inline SQL alone exceeds the cap, bounded only by the history's 2 MiB budget; CHANGELOG.md:15 is worded correctly
Files Reviewed (11 files)
  • plugins/altimate-code/hooks/dbt-mods.tsx - new: redaction race fix, date values, as_* filters; 5 carried suggestions (702, 1081, 1055, 1128) and the anchors used by others
  • plugins/altimate-code/hooks/dbt-mods-core.ts - unchanged since 488d2d1; carried 92, 133, 265, 316 re-verified
  • plugins/altimate-code/hooks/dbt-mods.test.tsx - new: holdRedact, the awaited-load test, the 8 ordinal; 1 new inline, carried 381 re-verified
  • plugins/altimate-code/README.md - carried 141, 148 (148 has an active inline comment)
  • plugins/altimate-code/.claude-plugin/plugin.json - no issues; the "not used yet" health settings now match the merged health feature
  • tests/dbt-scripts.sh - no issues; both new fixtures fail on the previous keep() and filter code
  • plugins/altimate-code/hooks/health.test.tsx, features/docs.test.tsx - the dbt_mods: false wrappers match the call forms used in each file
  • plugins/altimate-code/hooks/tool-chain.ts, tool-chain.test.ts - callStart and the 35 s editAfter deadline match EDIT_AFTER_TIMEOUT_MS
  • plugins/altimate-code/hooks/features/index.ts, lineage.tsx, integrations.tsx, lineage-graph.ts - merge content only; dbt helpers still called last in every phase

Fix these issues in Kilo Cloud

Previous Review Summaries (5 snapshots, latest commit 488d2d1)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 488d2d1)

Status: 11 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 11

Incremental review at 488d2d1: one docs commit since feb9afa touches only README.md:141 and CHANGELOG.md:17 (2 added lines, 2 replaced). Both now say a Jinja target-path is not followed, which matches targetPath() (dbt-mods-core.ts:468-473, falling back to target above), and the doubled comma in the README sentence is gone. No new inline comments; the remaining docs gap is that the README sentence no longer says a failure dbt printed still shows, which still holds for splittable output (dbt-mods.tsx:694). No code changed since b21ee75, so the nine code findings are carried after a targeted re-check at this HEAD (their line numbers hold).

Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/README.md 141 The sentence says a failed run's nodes are not read from the other target-path folder, but failuresFromText(output) (dbt-mods.tsx:694) still adds dbt's printed failures from splittable output to the band; the previously removed "(a failure dbt printed still shows)" is still accurate
plugins/altimate-code/hooks/dbt-mods.tsx 702 redactValues(command) also redacts the command explainPrompt/fixPrompt (dbt-mods-core.ts:641, :649) hand Claude, so Explain/Fix work from DB_PASSWORD=‹redacted› dbt build … instead of the command Claude actually ran
plugins/altimate-code/hooks/dbt-mods-core.ts 316 The comment "Values never leave this function in the clear" is contradicted by assignments: one.env (:357), which returns the raw NAME=value strings; the use is fine (stdin plus the in-memory key), the comment is stale
plugins/altimate-code/hooks/dbt-mods.tsx 1124 repr(part)[1:-1] duplicates the str repr redactionForms already adds (dbt-mods-core.ts:119-129), and JS then re-escapes it into double-escaped forms that cannot match; only the bytes repr is new, so the two escaping rules can drift
plugins/altimate-code/hooks/dbt-mods-core.ts 92 The comment says the values are "cleared when the conversation ends", but clearRedactions (:99) has no production caller; command assignment values are held for the plugin's lifetime too
plugins/altimate-code/hooks/dbt-mods-core.ts 265 flagOf/profilesDirOf (:274) reject ~ before profileCandidates' HOME expansion (dbt-mods.tsx:1138) can run, so --profiles-dir ~/foo falls back to the default candidates and that file's secrets are never held
plugins/altimate-code/hooks/dbt-mods-core.ts 133 redactValues/redactionValues flatten every loaded file, now including values from a command's NAME=value assignments, so a value is cut from every project's dbt text
plugins/altimate-code/hooks/dbt-mods.tsx 1077 The for value in recorded loop runs before the secret and key not in PLAIN check (:1079), so a type/threads/method/port env_var value or default of 6+ characters becomes a redaction value; the docs say those fields are never treated as secrets
plugins/altimate-code/hooks/dbt-mods.tsx 1054 A plain jinja2.Environment() is not a sandbox, so "nothing executed" (:1012) is false; every candidate profiles.yml is rendered when a dbt command runs, and dbt-mods.test.tsx:3743 describes the plain Environment
plugins/altimate-code/hooks/dbt-mods.test.tsx 376 The PROFILE_REDACT stub keys on argv[4] and ignores argv[5] (the profile, passed at dbt-mods.tsx:1188), and tests/dbt-scripts.sh's redact() (:92-96) never passes a profile, so the sys.argv[3] read and the --profile path stay unpinned
plugins/altimate-code/README.md 148 (active inline comment) "32 KiB a query" reads as unconditional, but fitSaved (dbt-mods-core.ts:837) keeps a query whole when its inline SQL alone exceeds the cap, bounded only by the history's 2 MiB budget; CHANGELOG.md:16 is worded correctly
Files Reviewed (4 files)
  • plugins/altimate-code/README.md - 2 issues (141 revised, 148 carried with active inline comment)
  • plugins/altimate-code/CHANGELOG.md - no issues; the artifact-folder bullet matches targetOf/targetPath and the unused parsed --target-path
  • plugins/altimate-code/hooks/dbt-mods.tsx - carried 702, 1054, 1077, 1124 re-checked
  • plugins/altimate-code/hooks/dbt-mods-core.ts - carried 92, 133, 265, 316 re-checked
  • plugins/altimate-code/hooks/dbt-mods.test.tsx - carried PROFILE_REDACT stub re-checked (line 376)

Fix these issues in Kilo Cloud

Previous review (commit feb9afa)

Status: 11 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 11

Incremental review at feb9afa: two docs commits since b21ee75 (5a0dcc7, feb9afa) touch only README.md and CHANGELOG.md (3 added lines, 1 replaced). One new issue, on the new README sentence: a doubled comma, and its claim that artifacts are read from the target-path dbt_project.yml names misses that targetPath() falls back to target for a Jinja value (the same not-followed consequences the note lists for DBT_TARGET_PATH). The new CHANGELOG bullet matches the code (targetOf/targetPath, and the parsed --target-path has no consumer). The narrowed note also dropped "(a failure dbt printed still shows)", which is still true for splittable output (dbt-mods.tsx:694), so a --target-path run now reads as showing no failure at all.

No code changed since b21ee75, so the ten earlier findings are carried unchanged after a targeted re-check at this HEAD (their line numbers hold). The README "32 KiB a query" finding already has an active inline comment at README.md:148, so it is carried here only.

Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/README.md 141 (new) folder,, doubled comma (fixed by the inline suggestion); the same sentence says artifacts come from the target-path dbt_project.yml names, but targetPath() (dbt-mods-core.ts:468-473) returns target when the value holds {{, so a Jinja target-path is not followed; the removed "(a failure dbt printed still shows)" is still accurate
plugins/altimate-code/hooks/dbt-mods.tsx 702 redactValues(command) also redacts the command explainPrompt/fixPrompt (dbt-mods-core.ts:641, :649, called at :1405, :1410) hand Claude, so Explain/Fix work from DB_PASSWORD=‹redacted› dbt build … instead of the command Claude actually ran
plugins/altimate-code/hooks/dbt-mods-core.ts 316 The comment "Values never leave this function in the clear" is contradicted by assignments: one.env (:357), which returns the raw NAME=value strings; the use is fine (stdin plus the in-memory key), the comment is stale
plugins/altimate-code/hooks/dbt-mods.tsx 1124 repr(part)[1:-1] duplicates the str repr redactionForms already adds (dbt-mods-core.ts:119-129), and JS then re-escapes it into double-escaped forms that cannot match; only the bytes repr is new, so the two escaping rules can drift
plugins/altimate-code/hooks/dbt-mods-core.ts 92 The comment says the values are "cleared when the conversation ends", but forgetRedactions clears only the load cache and clearRedactions has no production caller; command assignment values are held for the plugin's lifetime too
plugins/altimate-code/hooks/dbt-mods-core.ts 265 flagOf/profilesDirOf (:274) reject ~ before profileCandidates' HOME expansion (dbt-mods.tsx:1138) can run, so --profiles-dir ~/foo falls back to the default candidates and that file's secrets are never held
plugins/altimate-code/hooks/dbt-mods-core.ts 133 redactValues/redactionValues flatten every loaded file, now including values from a command's NAME=value assignments, so a value is cut from every project's dbt text
plugins/altimate-code/hooks/dbt-mods.tsx 1077 The for value in recorded loop runs before the secret and key not in PLAIN check (:1079), so a type/threads/method/port env_var value or default of 6+ characters becomes a redaction value; the docs say those fields are never treated as secrets
plugins/altimate-code/hooks/dbt-mods.tsx 1054 A plain jinja2.Environment() is not a sandbox, so "nothing executed" (:1012) is false; every candidate profiles.yml is rendered when a dbt command runs, and dbt-mods.test.tsx:3737 pins not.toMatch(/SandboxedEnvironment/)
plugins/altimate-code/hooks/dbt-mods.test.tsx 376 The PROFILE_REDACT stub keys on argv[4] and ignores argv[5] (the profile), and tests/dbt-scripts.sh's redact() (:92-96) never passes a profile, so the sys.argv[3] read and the --profile path stay unpinned
plugins/altimate-code/README.md 148 (active inline comment) "32 KiB a query" reads as unconditional, but fitSaved (dbt-mods-core.ts:846) keeps a query whole when its inline SQL alone exceeds the cap, bounded only by the history's 2 MiB budget; CHANGELOG.md is worded correctly
Files Reviewed (5 files)
  • plugins/altimate-code/README.md - 1 new issue (141), carried 148 (active inline comment)
  • plugins/altimate-code/CHANGELOG.md - no new issues; the artifact-folder bullet matches targetOf/targetPath and the unused parsed --target-path
  • plugins/altimate-code/hooks/dbt-mods.tsx - carried 702, 1054, 1077, 1124 re-checked
  • plugins/altimate-code/hooks/dbt-mods-core.ts - carried 92, 133, 265, 316 re-checked
  • plugins/altimate-code/hooks/dbt-mods.test.tsx - carried PROFILE_REDACT stub re-checked (now line 376)

Previous review (commit b21ee75)

Status: 10 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 10

Incremental review at b21ee75: one fix commit since d793b0e, touching three files (29 added lines, 3 removed). Both fixes check out, and no new issue was found in them.

  • debugInfo (dbt-mods-core.ts:778) now scrubs the whole text after the failure marker before cutting it to 300 characters, so a value that straddles the cut is replaced whole. The outer profilesError(text) already runs on the full output with the looser check, so scrubbing a suffix with loose = false cannot produce a PROFILES_UNREADABLE outcome the outer condition would have missed. The new kitTest (dbt-mods.test.tsx:3854) is a real regression test: on the old order the 10-character start of the value survives the cut. The only residue is cosmetic - the cut can now split the ‹redacted› placeholder itself, which holds no value.
  • The redaction load cache key now includes the project root (dbt-mods.tsx:1182). That is the right missing piece: the script's first argument is ${root}/dbt_project.yml, which selects the profile inside a shared profiles.yml, so two projects reading one file must each load. setRedactions/redactionValues flatten the values, so the extra keys only duplicate identical lists (deduped); the mtime/30 s refresh and forgetRedactions are unaffected. placeOf → projectRoot → ensureRedactions and the kit's new extraProjects hook (175, 255) were traced: /proj2 and /proj2/dbt_project.yml are the only extra paths made to exist, which is exactly what projectRoot probes. One coverage note: the new test pins that the second project's script run happens, not that its values are held - the kit project has no .venv, so pythonFor returns python3 and the PROFILE_REDACT stub exits 1 for it - but the skip it guards against is still caught.

The ten earlier findings were re-checked at this HEAD and are unchanged. Active human inline review comments (dbt-mods-core.ts:68, :585, dbt-mods.tsx:237, :498, :508, :682, :797) remain in the discussion; this review does not duplicate them.

Fix these issues in Kilo Cloud

Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/dbt-mods.tsx 702 redactValues(command) also redacts the command fixPrompt (dbt-mods-core.ts:651, called at :1409) tells Claude to re-run, so Fix hands Claude DB_PASSWORD=‹redacted› dbt build …, which fails on authentication instead of on the model (Claude already has the real command from its tool call)
plugins/altimate-code/hooks/dbt-mods-core.ts 316 The comment "Values never leave this function in the clear" is contradicted by assignments: one.env (:357), which returns the raw NAME=value strings; the use is fine (stdin plus the in-memory key), the comment is stale
plugins/altimate-code/hooks/dbt-mods.tsx 1124 repr(part)[1:-1] duplicates the str repr redactionForms already adds (dbt-mods-core.ts:119-129), and JS then re-escapes it into double-escaped forms that cannot match; only the bytes repr is new, so the two escaping rules can drift
plugins/altimate-code/hooks/dbt-mods-core.ts 92 The comment says the values are "cleared when the conversation ends", but forgetRedactions clears only the load cache and clearRedactions has no production caller; command assignment values are held for the plugin's lifetime too
plugins/altimate-code/hooks/dbt-mods-core.ts 265 flagOf/profilesDirOf (:274) reject ~ before profileCandidates' HOME expansion (dbt-mods.tsx:1144) can run, so --profiles-dir ~/foo falls back to the default candidates and that file's secrets are never held
plugins/altimate-code/hooks/dbt-mods-core.ts 133 redactValues/redactionValues flatten every loaded file, now including values from a command's NAME=value assignments, so a value is cut from every project's dbt text
plugins/altimate-code/hooks/dbt-mods.tsx 1077 The for value in recorded loop runs before the key not in PLAIN check, so a type/threads/method/port env_var value or default of 6+ characters becomes a redaction value; the docs say those fields are never treated as secrets
plugins/altimate-code/hooks/dbt-mods.tsx 1054 A plain jinja2.Environment() is not a sandbox, so "nothing executed" (:1012) is false; every candidate profiles.yml is rendered when a dbt command runs, and dbt-mods.test.tsx:3737 pins not.toMatch(/SandboxedEnvironment/)
plugins/altimate-code/hooks/dbt-mods.test.tsx 375 The PROFILE_REDACT stub keys on argv[4] and ignores argv[5] (the profile), and tests/dbt-scripts.sh's redact() (:96) never passes a profile, so the sys.argv[3] read and the --profile path stay unpinned
plugins/altimate-code/README.md 146 (active inline comment) "32 KiB a query" reads as unconditional, but fitSaved (dbt-mods-core.ts:833-837) keeps a query whole when its inline SQL alone exceeds the cap, bounded only by the history's 2 MiB budget; CHANGELOG.md is worded correctly
Files Reviewed (5 files)
  • plugins/altimate-code/hooks/dbt-mods-core.ts - no new issues; the scrub-before-cut change (778) and the new test's assumptions verified; carried 92, 133, 265, 316 re-checked
  • plugins/altimate-code/hooks/dbt-mods.tsx - no new issues; the per-project redaction cache key (1178-1194) traced through placeOf, projectRoot, profileCandidates, pythonFor and runQueued; carried 702, 1054, 1077, 1124 re-checked
  • plugins/altimate-code/hooks/dbt-mods.test.tsx - no new issues; the extraProjects kit option (175, 255), the two-project test (3717-3721) and the debug cut test (3854-3866)
  • plugins/altimate-code/README.md - carried 146 (active inline comment)
  • tests/dbt-scripts.sh - carried redact() argument list (96) re-checked

Previous review (commit d793b0e)

Status: 10 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 10

Incremental review at d793b0e: since 6b22aae the branch only gains the merge of main (1a9d7c0, which brings in the docs / defer / to-model / cte-profile work already on main) and one test-only commit. The merge resolutions checked out: features/docs.test.tsx now opts its tests out of the dbt helpers (dbt_mods: false), and dbt-mods.test.tsx holds the session.cwd read of the dbt helpers (the second read: defer's bashRewrite reads it first for a dbt command, and the kit's dbt_project.yml makes findProject succeed, so the hold still lands where the /clear test needs it). tool-chain.test.ts pins the longer editAfter deadline, and lineage.test.tsx pins Min/Default/Max against a 200-column terminal. No issue was found in any of it. The ten earlier findings were re-checked at HEAD and are unchanged.

Fix these issues in Kilo Cloud

Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/dbt-mods.tsx 702 redactValues(command) also redacts the command fixPrompt (dbt-mods-core.ts:651, called at :1409) tells Claude to re-run, so Fix hands Claude DB_PASSWORD=‹redacted› dbt build …, which fails on authentication instead of on the model (Claude already has the real command from its tool call)
plugins/altimate-code/hooks/dbt-mods-core.ts 316 The comment "Values never leave this function in the clear" is contradicted by assignments: one.env (:357), which returns the raw NAME=value strings; the use is fine (stdin plus the in-memory key), the comment is stale
plugins/altimate-code/hooks/dbt-mods.tsx 1124 repr(part)[1:-1] duplicates the str repr redactionForms already adds (dbt-mods-core.ts:119-129), and JS then re-escapes it into double-escaped forms that cannot match; only the bytes repr is new, so the two escaping rules can drift
plugins/altimate-code/hooks/dbt-mods-core.ts 92 The comment says the values are "cleared when the conversation ends", but forgetRedactions clears only the load cache and clearRedactions has no production caller; command assignment values are held for the plugin's lifetime too
plugins/altimate-code/hooks/dbt-mods-core.ts 265 flagOf/profilesDirOf (:274) reject ~ before profileCandidates' HOME expansion (dbt-mods.tsx:1144) can run, so --profiles-dir ~/foo falls back to the default candidates and that file's secrets are never held
plugins/altimate-code/hooks/dbt-mods-core.ts 133 redactValues/redactionValues flatten every loaded file, now including values from a command's NAME=value assignments, so a value is cut from every project's dbt text
plugins/altimate-code/hooks/dbt-mods.tsx 1077 The for value in recorded loop runs before the key not in PLAIN check, so a type/threads/method/port env_var value or default of 6+ characters becomes a redaction value; the docs say those fields are never treated as secrets
plugins/altimate-code/hooks/dbt-mods.tsx 1054 A plain jinja2.Environment() is not a sandbox, so "nothing executed" (:1012) is false; every candidate profiles.yml is rendered when a dbt command runs, and dbt-mods.test.tsx:3737 pins not.toMatch(/SandboxedEnvironment/)
plugins/altimate-code/hooks/dbt-mods.test.tsx 375 The PROFILE_REDACT stub keys on argv[4] and ignores argv[5] (the profile), and tests/dbt-scripts.sh's redact() (:96) never passes a profile, so the sys.argv[3] read and the --profile path stay unpinned
plugins/altimate-code/README.md 146 (active inline comment) "32 KiB a query" reads as unconditional, but fitSaved (dbt-mods-core.ts:833-837) keeps a query whole when its inline SQL alone exceeds the cap, bounded only by the history's 2 MiB budget; CHANGELOG.md is worded correctly
Files Reviewed (9 files)
  • plugins/altimate-code/hooks/dbt-mods.test.tsx - no new issues; the cwdCalls hold change (269-275) verified against dbtModsCallStart (dbt-mods.tsx:1565) and defer's bashRewrite (features/defer.tsx:433-441)
  • plugins/altimate-code/hooks/features/docs.test.tsx - no new issues; the dbt_mods: false wrapper (1-5)
  • plugins/altimate-code/hooks/lineage.tsx - merge only; pane-size wiring and commandDir re-checked
  • plugins/altimate-code/hooks/lineage.test.tsx - no new issues; Min/Default/Max and store.get/store.set mocks
  • plugins/altimate-code/hooks/tool-chain.test.ts - no new issues; the 35 s editAfter deadline assertion
  • plugins/altimate-code/types/index.d.ts - from main; no issue
  • plugins/altimate-code/hooks/inert-features.ts - from main; no issue
  • plugins/altimate-code/hooks/altimate-cli.ts - from main; no issue
  • plugins/altimate-code/hooks/dbt-mods-core.ts, dbt-mods.tsx, README.md, tests/dbt-scripts.sh - targeted re-check of the ten carried findings

Previous review (commit 6b22aae)

Status: 10 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 10

Incremental review at 6b22aae: the only new commit touches tests/dbt-scripts.sh, making the throwaway venv install pyyaml jinja2 and running the PROFILE_REDACT checks under that interpreter ($YPY) instead of the bare python3. This closes a real gap rather than opening one — both embedded scripts need jinja2 for the render fixtures (dbt-mods.tsx:949, :1054), so a runner with PyYAML but no jinja2 previously ran PROFILE_REDACT under an interpreter that would fail the filter/quote assertions, and the two blocks now gate on import yaml, jinja2 with a loud skip (a failure under CI) when neither the system Python nor a venv can supply them. No new issue was found in it. The ten earlier findings were re-checked at HEAD and are unchanged.

Fix these issues in Kilo Cloud

Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/dbt-mods.tsx 702 redactValues(command) also redacts the command fixPrompt (dbt-mods-core.ts:651, called at :1409) tells Claude to re-run, so Fix hands Claude DB_PASSWORD=‹redacted› dbt build …, which fails on authentication instead of on the model (Claude already has the real command from its tool call)
plugins/altimate-code/hooks/dbt-mods-core.ts 316 The comment "Values never leave this function in the clear" is contradicted by `assignmen

[Snapshot truncated.]

Additional previous summary content was truncated to keep this comment within platform limits.


Reviewed by deepseek-v4.1-flash-1017 · Input: 139.8K · Output: 41.8K · Cached: 3M

…and profile messages, bookmark after clear, pane sizes loaded once

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_results script keeps only the fields used

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd what it cannot catch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Opening a dbt folder runs two programs the repository supplies, with no action from you: at session start the plugin runs the project's own `.venv/bin/dbt --version` (a `venv` or `Scripts\dbt.exe` too) and the Python that dbt's launcher names, to check them. Trust the folder before you open it in Claude Code.


- **Compile and validate, on every edit.** After Claude edits or writes a model's `.sql` file, the plugin runs the model with `dbt show --limit 1`: dbt compiles it and the warehouse runs it, so a Jinja error or a column the warehouse does not have shows at once. The columns the query returns are held to the ones `schema.yml` documents. The result goes to Claude with the edit's result (it waits up to 30 seconds; a slower check rides on Claude's next tool result) and stays above the prompt. When the query returns no row, or `schema.yml` documents no columns for the model, the check says the columns were not compared rather than calling them a match. When the newest check finds a problem (an older check of another file that lands after a newer one starts does not change the band or open the pane), the **dbt check** pane opens beside the chat (**Details** brings it back): every column the warehouse returned against the ones `schema.yml` documents, or dbt's full error, with **Check again**. When the model's file or its schema file changes afterwards outside Claude's edits (a fix altimate-code made), or Claude edits a schema file or another SQL file (a macro), the check runs again; when the model's file is deleted, its check is dropped. One `dbt show` runs per edit: when the manifest does not name the model, `dbt ls` (which runs no query) gives its name first. Secret values from the `profiles.yml` a dbt command reads (the one its `--profiles-dir` or `DBT_PROFILES_DIR` names, else the one in the folder it ran in, the project's, or `~/.dbt`'s: the string fields of its outputs, and the env vars it names with their defaults) are removed from dbt's messages (errors, logs, the doctor's details, the failure band, Explain and Fix, and the error text kept in the query history) that the helpers show, save or send, and dbt's errors about a `profiles.yml` it cannot read, validate or render are replaced with a fixed message. Identifiers such as schema, database, dataset, project, catalog, warehouse, role and user are not treated as secrets, nor are values under 6 characters or the `type`, `threads`, `method` and `port` fields; query results and manifest facts are shown as they are. The plugin reads those values locally, keeps them in memory only, and never logs, stores or sends them. Redaction is best effort, not a guarantee about every text dbt prints: it matches those values as written, JSON-escaped and in Python's string and byte forms, including values set for the command (`NAME=value dbt …`, `env`, `export`); it cannot catch a value dbt or an adapter prints in another form (encoded, transformed or split), or one the profile builds other than through `env_var`. Other dbt errors (a missing target or profile name, a model's own missing `env_var`) are kept, since they carry no secret. A dbt command Claude runs itself shows its output to Claude unchanged. An error that is not the model's own (a parent not built yet, a connection) does not ask Claude to fix the model or to build upstream models. A model whose path holds a space is not checked (dbt would split its selection and run other models), and when dbt cannot be run at all (no `dbt` on the plugin's `PATH` and none in the project's `.venv`), the check says "dbt could not be run here" instead of an error in the model and tries nothing more until `/dbt-doctor` finds dbt. A column documented with `quote: true` is compared with its exact case. Macros, tests and analyses are not run.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: The added sentence says redaction covers 'values set for the command (NAME=value dbt …, env, export)', but only run-type invocations load them. dbtModsCallStart takes const runs = invocations.filter(one => RUN_VERBS.includes(one.verb)) (hooks/dbt-mods.tsx:1563) and, when there is none, returns before ensureForRuns (:1570-1571); dbtModsBashAfter passes the same run-only list (:1596, :1600). A DB_PASSWORD=… dbt show … (or a dbt show --profiles-dir …) therefore never sends its assignments or profile to PROFILE_REDACT, so the error runShowWith keeps in the pane and saves to the query history is scrubbed only with values loaded for some other invocation. Either scope the claim to run/test/build/seed/snapshot/retry, or load redactions for show invocations too. The same sentence is in PRIVACY.md:37 and CHANGELOG.md:15.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted, README scope nit: command-set values are loaded for run-type verbs (and the show/ls the plugin itself runs); a non-run dbt show Claude runs is shown to Claude unchanged anyway, per the README. Not changing.

…he command ran in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hkaltai

hkaltai commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

review-loop: APPROVED at 5f5af0e (reviewers: codex gpt-6-astra, codex gpt-6.1-sol; high reasoning, fresh sessions, whole PR against the merge base with main)

Both reviewers returned an explicit APPROVE, with no CRITICAL or MAJOR inside the supported scope. Every finding from the three human review rounds was checked as resolved at this head.

Non-blocking follow-ups (MINOR, README wording):

  • "One dbt show runs per edit" doesn't mention the second show that runs only when the manifest names the model differently. The CHANGELOG and the docs page describe that exception.
  • "32 KiB a query" doesn't mention that a query whose SQL alone is larger is kept whole, within the 2 MiB history budget.

@hkaltai

hkaltai commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for round 3. Everything is addressed; each inline comment has its own reply.

  • The critical: profile values are now redacted from dbt's messages, which closes your four shapes and the Trino JWT. The bounds are stated in the README, CHANGELOG, PRIVACY and the docs page.

  • feat: foundation for the dbt Power User features #30 landed first, so this PR now merges main and integrates with it as you listed:

    • one userConfig block;
    • one band;
    • the four hooks routed through the tool chain (bashAfter / editAfter / readOrEditAfter, plus a callStart step for the /clear guards);
    • one dbt command parser (dbt-command.ts, extended with argv/env/cds);
    • merged state.

    It still ships as 1.8.0, above main's 1.7.0.

  • The four minors are fixed with tests.

Checks at 5f5af0e: claude plugin test 695 pass; validate --strict passes; tests/*.sh 8/8, with dbt-scripts.sh running the embedded scripts for real; pytest 65.

A fresh review by two Codex reviewers (gpt-6-astra and gpt-6.1-sol) of the whole PR at this head approved. Its two remaining README wording minors are listed in the approval comment as follow-ups.

@hkaltai
hkaltai requested a review from sahrizvi November 17, 2026 18:07
… dbt's Python has them, on a runner whose python3 lacks them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hkaltai

hkaltai commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up to the approval at 5f5af0e: 6b22aae changes only tests/dbt-scripts.sh. The macOS runner's python3 has neither PyYAML nor jinja2, so the throwaway venv now installs both, and the PROFILE_REDACT checks use that interpreter too. With a bare python3 and CI=1, every check runs and passes locally. No plugin code changed.

@hkaltai

hkaltai commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

review-loop: APPROVED at 6b22aae (reviewers: gpt-6-astra high, gpt-6.1-sol high)

hkaltai and others added 5 commits November 18, 2026 13:33
…elpers' own folder read after the merge with main

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…files.yml's values for each project

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/README.md Outdated

What dbt Power User does in VS Code, inside the Claude Code session. Each helper runs the project's own dbt (`.venv` or `venv` in the project folder, `bin/dbt` or `Scripts\dbt.exe`, else `dbt` on `PATH`), one at a time per project, and makes no model-provider call on its own (only **Explain** and **Fix with Altimate Code**, when you press them, hand a failure to Claude or Altimate Code).

The helpers read dbt's artifacts (`manifest.json`, `run_results.json`) from the `target-path` the project's `dbt_project.yml` names, else `target/`. A path set by `DBT_TARGET_PATH` or a command's `--target-path` is not followed: with one, the check cannot compare columns, model context and the doctor's freshness use the project's folder,, and a failed run's nodes are not read from the other folder.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Two problems in this new note.

  1. folder,, has a doubled comma.
  2. The first clause says the helpers read the target-path that dbt_project.yml names, but targetPath() (hooks/dbt-mods-core.ts:468-473) falls back to target for any value containing {{, so a Jinja target-path such as {{ env_var('DBT_TARGET_DIR', 'build') }} is not followed, with the same three consequences this note lists for DBT_TARGET_PATH and --target-path.

Separately, the removed "(a failure dbt printed still shows)" was accurate for output the helpers can split: recordRun adds failuresFromText(output) even when no artifact is read (dbt-mods.tsx:694), so dropping it makes a --target-path run look like it shows no failure at all.

Suggested change
The helpers read dbt's artifacts (`manifest.json`, `run_results.json`) from the `target-path` the project's `dbt_project.yml` names, else `target/`. A path set by `DBT_TARGET_PATH` or a command's `--target-path` is not followed: with one, the check cannot compare columns, model context and the doctor's freshness use the project's folder,, and a failed run's nodes are not read from the other folder.
The helpers read dbt's artifacts (`manifest.json`, `run_results.json`) from the `target-path` the project's `dbt_project.yml` names, else `target/` (a Jinja `target-path` falls back to `target/`). A path set by `DBT_TARGET_PATH` or a command's `--target-path` is not followed: with one, the check cannot compare columns, model context and the doctor's freshness use the project's folder, and a failed run's nodes are not read from the other folder (a failure dbt printed still shows).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 488d2d1: the doubled comma is gone, and the note and the CHANGELOG line now also say that a Jinja target-path in dbt_project.yml is not followed (targetPath() falls back to target, dbt-mods-core.ts:468-473). The "(a failure dbt printed still shows)" clause stays out: it is not stated for every output, so the README does not promise it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@hkaltai

hkaltai commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

review-loop: APPROVED at 488d2d1 (reviewers: gpt-6-astra high, gpt-6.1-sol high)

@sahrizvi sahrizvi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve. Panel: Claude (lead) and Codex (default model, codex exec -s read-only), with one independent pass and one cross-check. Both exited 0. Reviewed at 488d2d1.

The round-3 critical is resolved. I recorded real dbt-core 1.10.23 output with the plugin's own show and debug argv and ran it through the real hooks. The redaction list came from the real PROFILE_REDACT script, run with dbt's Python. These shapes all came out clean on every surface (edit note, check pane, band, /dbt-show pane and history, toasts, /dbt-doctor pane and note, Explain/Fix):

  • the password in a host URL;
  • sslmode or target reading the password variable;
  • a YAML alias into threads;
  • a Trino JWT with a line break;
  • an all-digit password;
  • a keyfile_json string;
  • a Snowflake private_key template default.

I searched every surface for the 16-character secret and every 8-character substring of it. A shared ~/.dbt/profiles.yml loads each project's own profile, and --profile and DBT_PROFILE are followed.

Remaining minors, none blocking (inline):

  1. dbt's Jinja filters (| as_text) stop the variable's value from being recorded. Edge: it needs a filter plus an echoing misconfiguration.
  2. A shell or non-Python dbt launcher, or a Python without PyYAML, silently loads nothing. Unusual layout.
  3. The load cache is marked done before the script finishes. Timing race.
  4. A variable used only under user is skipped. Documented exclusion.
  5. A date-shaped password is not collected. Edge input.
  6. --profiles-dir "$HOME/…" is not followed. Claude already saw that output.
  7. Ordinary words and dbname/host values are redacted from ordinary errors. Cosmetic.
  8. The dbt ls authorship race (round-3 minor, partly fixed). Timing.
  9. History loads before values are known. Only affects entries that were already contaminated.
  10. The 6-character floor. Edge, and documented.

Codex first rated 1–3 critical and 4–6 major. Under this round's bar it reclassified all of them as edge inputs or layouts, and agrees with approving. Details, suites and mutation results are in the combined comment.

engine = None
if jinja2 is not None:
try:
engine = jinja2.Environment()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (edge input; Codex raised it, rated it critical, then edge under this round's bar). The jinja2.Environment() has env_var but none of dbt's filters (as_text, as_number, as_bool, as_native). A template that uses one fails to compile before env_var runs, so recorded stays empty and only the template text is kept.

Reproduced with dbt-core 1.10.23 and dbt-postgres 1.11.0. Set password and sslmode both to "{{ env_var('PG_PASSWORD') | as_text }}". The redact list then holds only the template, and invalid sslmode value: "<secret>" reaches the edit note, the check pane, the band, /dbt-show and its history, and Explain/Fix. A filter on port alone does no harm, since port is a PLAIN field.

It doesn't block because it needs two things at once: a filter on the secret's variable, and a misconfiguration that makes dbt echo the field. Fix: register the four filters as identity functions. Or, when rendering fails, fall back to the CALL regex so the variable's value and default are still recorded.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a56d3b6: the redaction script now defines dbt's as_text, as_number, as_bool and as_native filters, so a template that uses one renders and its env_var reads are collected. Regression: tests/dbt-scripts.sh, 'dbt's own filters render'.

const beside = dbt.replace(/dbt(\.exe)?$/, (_, exe) => (exe ? 'python.exe' : 'python'))
if (await $.fs.exists(beside).catch(() => false)) return beside
}
return (await dbtShebang($, dbt)) ?? 'python3'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (unusual layout; Codex, rated critical, then edge). When dbt is a shell wrapper with a non-env shebang, pythonFor returns that shell (#!/bin/sh gives /bin/sh). A native or env launcher, such as dbt Fusion or a Docker wrapper, falls back to python3. In the first case PROFILE_REDACT exits non-zero. In the second, when python3 lacks PyYAML, it prints {"redact": []} for literal values. I checked this with a bare venv: the alias profile gave []. Either way only the heading scrub is left, and nothing tells the user.

It doesn't block because the leak also needs a profile that makes dbt echo a value. Follow-up: when the script fails or reports no PyYAML, treat the profile's values as unknown. For example, replace dbt's error text with the fixed message rather than passing it through.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted as a documented edge (a non-env shell wrapper or a native launcher without PyYAML on python3), as you rate it; the heading scrub still applies and a profile has to make dbt echo a value for it to matter. Treating a failed or PyYAML-less script as unknown and saying so is left for a follow-up, not folded in here.

const now = await $.clock.now()
const seen = redactionLoaded.get(key)
if (seen && stat && seen.mtimeMs === stat.mtimeMs && now - seen.at < REDACTION_REFRESH_MS) continue
redactionLoaded.set(key, { mtimeMs: stat?.mtimeMs ?? 0, at: now })

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (timing; Codex, rated critical, then edge). redactionLoaded.set runs before the script is awaited. A second ensureRedactions for the same key, for example Claude's Bash callStart while an edit check is loading, sees the entry and returns at once with no values loaded yet.

It doesn't block because a leak needs that second caller's dbt to exit before the first caller's Python script (about 0.1 s) does. Fix: store the in-flight promise per key and await it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a56d3b6: redactionLoaded now holds the in-flight load, and a second ensureRedactions for the same key awaits it instead of returning with no values. Regression: hooks/dbt-mods.test.tsx, 'a check that starts while another call loads the profile values waits for them' (fails without the await).

del recorded[:]
if '{{' in text or '{%' in text:
rendered = render(text)
if key in IDENTIFIERS:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (documented exclusion; Codex, rated major, then edge). An env_var called only under an identifier key is never collected. Take user: "{{ env_var('PG_PASSWORD') }}" with the variable used nowhere else: password authentication failed for user "<secret>" passes unchanged.

It doesn't block because the variables are swapped by mistake and PRIVACY.md names this exclusion. Possible follow-up: collect an identifier's env_var value when the variable's name looks like a secret (PASSWORD, TOKEN, SECRET, KEY).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Declined: an env_var used only under an identifier key is the documented exclusion (PRIVACY.md, and the comment above PROFILE_REDACT at dbt-mods.tsx:1010). Collecting by variable name is a heuristic over names, which would redact ordinary values too; kept as a possible follow-up.

def keep(value):
if isinstance(value, bool):
return
if isinstance(value, (int, float)):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (edge input; Codex, rated major, then edge). keep turns int and float into strings, but not date or datetime. PyYAML parses an unquoted 2026-11-18 as a date, while dbt renders it as a string. I reproduced password: &pw 2026-11-18 with sslmode: *pw: invalid sslmode value: "2026-11-18" reached the edit note, the panes, the history and Explain/Fix.

It doesn't block because it needs a date-shaped password echoed through an alias. Fix: str() any scalar that isn't a bool, or use isoformat() for dates.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a56d3b6: keep() now turns any non-bool, non-string scalar into text, so PyYAML's date and datetime values are collected as dbt renders them. Regression: tests/dbt-scripts.sh, 'a date-shaped password reused through an alias'.

if (word === flag) found = words[i + 1] ?? null
else if (word.startsWith(`${flag}=`)) found = word.slice(flag.length + 1)
}
return found !== null && /[$`~*?]/.test(found) ? null : found

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (no new exposure; Codex, rated major, then edge). --profiles-dir "$HOME/.config/dbt", or any value with $ or ~, gives null. The helper then loads its default candidates rather than the file dbt read, and a --profile "$P" has the same gap.

It doesn't block because this path only handles output of Claude's own command, and Claude already received that output unchanged in its tool result, as the README says. The band shows the values to the user, who owns them. Follow-up: expand $HOME and ~ here as profileCandidates already does for ~.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted: it only affects where the helper looks for the profile for Claude's own command, whose output Claude already received unchanged, as you note. Expanding $HOME and ~ in --profiles-dir/--profile is left for a follow-up.

except Exception:
pass
PLAIN = ('type', 'threads', 'method', 'port')
IDENTIFIERS = ('schema', 'database', 'dataset', 'project', 'catalog', 'warehouse', 'role', 'user')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (cosmetic reverse cost; Codex + Claude). Redaction is a plain substring replace across all of dbt's text, so ordinary values cost readability:

  • A word used as a password. With select or warehouse as the password, every select in a SQL error, or the warehouse in warehouse_orders, becomes ‹redacted›.
  • dbname. dbt-postgres and dbt-redshift name the database dbname, which isn't in IDENTIFIERS (only database is). With dbname: analytics, the most common model error reads relation "‹redacted›.public.stg_orders" does not exist.
  • host. A host named postgres turns role "postgres" does not exist into role "‹redacted›" ….

No secret is exposed, and a model's own env_var default stays readable (checked). Suggested fix: add dbname and host to IDENTIFIERS, and match single-word values only at word boundaries.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted as cosmetic, no secret is exposed. The plain substring cut is the deliberate trade (a value that is also a word is cut everywhere it appears); adding dbname to the identifier keys is a small change that I will take in a follow-up with the rest of the redaction-readability items.

const done = await $.process.run(command, { cwd: options.cwd ?? root, timeoutMs: options.timeoutMs ?? DBT_TIMEOUT_MS })
if (tracked) {
const after = await seenInvocation($, root).catch(() => null)
const own = printedInvocation(done.stdout) ?? (after !== null && after !== before ? after : null)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (timing; Codex). Round-3 minor, partly fixed. show now finds its own run by the invocation id dbt prints. ls runs with --log-format text, so it prints none, and the before/after fallback still applies. If Claude's concurrent dbt build writes invocation B while the plugin's ls runs, B is recorded as the plugin's own, and recordRun drops B's failures.

It doesn't block because it needs a concurrent write in a short window, and the only effect is a missing band. Fix: run ls with --log-format json too, or don't treat ls as tracked, since it writes no run_results.json.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted: it needs a concurrent write in a short window and the only effect is a missing band. Running ls with json logs, or not tracking it, is left for a follow-up.


async function loadHistory($: EngineInterface) {
const saved = await $.store.get(HISTORY_KEY).catch(() => null)
await update($, historyAtom, () => (Array.isArray(saved) ? (saved as SavedQuery[]).map(one => (one?.error ? { ...one, error: scrubDbt(one.error) } : one)) : []))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (edge; Codex). loadHistory runs at session start, before any ensureRedactions, so it can only apply the heading scrub. A saved error that holds a value without a heading, such as invalid sslmode value: "<secret>", loads as it is and is never scrubbed again.

It doesn't block because new saves are scrubbed with the values when written. Only an entry saved by an earlier build, or one that was already an edge leak, stays. Fix: call ensureRedactions before loading, or redact the error again when the pane renders it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted: new saves are scrubbed with the values when written, and only an entry saved by an earlier build can hold an unscrubbed value. Redacting again when the pane renders it is left for a follow-up.

if isinstance(value, (int, float)):
value = str(value)
# Short values (and so every number under 6 digits) are skipped: too common to cut from dbt's text.
if not isinstance(value, str) or len(value) < 6:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor (edge input; Claude, Codex accepts). Values under 6 characters aren't collected. A 5-character password aliased into threads ('Ab3x9' is not of type 'integer', real dbt output) reaches the edit note, the check pane, the band, /dbt-show history and Explain/Fix.

It doesn't block because it's below the floor PRIVACY.md documents, and needs the alias misconfiguration. Possible follow-up: a lower floor for values under keys whose names look like secrets (password, token, secret, private_key).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted as documented (PRIVACY.md's 6-character floor) and needing the alias misconfiguration. A lower floor under secret-named keys is left for a follow-up.

@sahrizvi

Copy link
Copy Markdown
Collaborator

Round 4 (488d2d1): Claude + Codex, combined comment

Approved; the formal review has the minors inline. This comment covers what isn't tied to a diff line.

Scope and merge state

  • Commits reviewed: everything since round 3 (bef5422), not only the five newest: 2c196bb, bfcb1d4, f87d721, 2d1541e, a2954ca, b0fb341, 5f5af0e, 6b22aae, d793b0e, b21ee75, 5a0dcc7, feb9afa and 488d2d1, plus the merges 8b23c76 and 1a9d7c0.
  • Merge: git merge-tree onto current main (100897c) is clean, and main has not moved since.
  • Main's content: features/index.ts calls the dbt helpers last in every phase and keeps main's features in order. plugin.json and marketplace.json are 1.8.0, above main's 1.7.0. CHANGELOG has 1.8.0 above 1.7.0. PRIVACY.md keeps main's sections and dated notes, and adds the dbt helpers section and a 17 November note. Codex found no merge defect either.

Round-3 findings

Round-3 finding Round 4
Critical: errors that echo a profile field's value Resolved. Value redaction, checked with real dbt output (table below).
noteOwnRun authorship by file time Partly fixed. show now uses dbt's printed invocation id. ls still uses the before/after fallback (inline, minor).
persistHistory removing a refreshed same-id entry Fixed. It now matches on id and at.
bad interpreter naming another program's python3 Fixed. Only a script ending in /dbt or dbt.exe counts.
Untested scrub sites Fixed. With the failuresFromText scrub removed, 15 tests fail; with the loadHistory scrub removed, 1 fails.

Profile payloads: real dbt output through the real hooks

  • Setup: dbt-core 1.10.23 with dbt-postgres 1.11.0, dbt-trino, dbt-bigquery and dbt-snowflake. The plugin's own argv: show --select … --output json --log-format json, and debug --log-format text.
  • Redaction list: from the real PROFILE_REDACT script, run with dbt's Python.
  • Surfaces searched: edit note, check pane, band, /dbt-show pane, the plugin store, toasts, the /dbt-doctor pane, the prompt context sent to Claude, ui.log, and Explain/Fix for Claude's own failed command.
  • Search: each surface was searched for the secret and for every 8-character substring of it.
Profile shape Secret on any surface?
Password inside a host URL no
sslmode reading the password variable no
target reading the password variable no
Password aliased into threads no
Trino JWT with a line break no
All-digit password (11 digits) no
BigQuery keyfile_json as a string no
Snowflake private_key template with a secret default no
user defaulted, sslmode reading the password variable no
Password select or warehouse (ordinary word) no; the word is redacted wherever it appears (inline, cosmetic)
5-character password aliased into threads yes: below the 6-character floor (inline, edge)
Password and sslmode as env_var(…) | as_text yes: filter not known to the renderer (inline, edge)
Date-shaped password aliased into sslmode yes: dates are not collected (inline, edge)

A shared ~/.dbt/profiles.yml with two profiles loads each project's own values. --profile pb and DBT_PROFILE=pb are followed too. A model's own env_var default stays readable.

Checks at head (base in brackets), run one after the other

  • claude plugin validate plugins/altimate-code, --strict plugins/altimate-code and --strict .: pass (pass).
  • claude plugin test plugins/altimate-code: 824 pass, 0 fail (529 pass, 0 fail).
  • tests/*.sh: 8/8 pass, and dbt-scripts.sh ran with PyYAML and jinja2, with no SKIP lines (7/7).
  • pytest tests/: 65 pass (65).
  • Type check: CONTRIBUTING.md names no separate tsc. The type check inside validate --strict passes.

Mutation checks on the scrub (head copy, restored after each)

Mutant Result
Drop the value load (setRedactions never called) killed, 24 failures
Scrub dbt debug's detail after the cut instead of before killed, 1
Scrub run_results messages after the 2000-character cut killed, 1
Scrub only the edit note, not the pane, band or history killed, 7
Drop the per-line forms of a multi-line value killed, 1
Drop the failuresFromText scrub / the loadHistory scrub killed, 15 / 1

Live check

A claude --plugin-dir session with an isolated home and config directory stops at the login screen, and we don't sign in there, so no model turns ran. The real-output replay above stands in for it.

Nit

  • debugInfo (dbt-mods-core.ts:778) keeps 3 lines from Connection test: [ERROR]. With real dbt debug --log-format text output those lines are Connection test: [ERROR] 10:42:09 1 check failed:, so the doctor's Connection detail never reaches the database error itself. This is pre-existing and fails safe, but it isn't useful. Skipping blank and timestamp-only lines before taking 3 would fix it.

hkaltai and others added 3 commits November 18, 2026 17:13
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…haped value and dbt's as_* filters are read for redaction; keep health tests to their own lines

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@hkaltai

hkaltai commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the round-4 review. The merge of main (including #24, #26, #27 and #33) is resolved at a56d3b6. Folded in: an in-flight profile-value load is now awaited by a second caller, a date-shaped value is collected, and dbt's as_* filters render in the redaction script (each with a regression test). The remaining minors are accepted as documented edges and listed in the thread replies. The health tests now run with the dbt helpers off so they assert their own lines; the plugin suite has only the cost/runs failures that #37 fixes. The debugInfo nit is left for a follow-up.

on('session.cwd', async () => {
// The first read is the defer feature's gate (features/defer.tsx), before the call starts; the hold is on
// the dbt helpers' own read of the folder, the second.
if (options.holdCwd && ++cwdCalls === 8) await options.holdCwd

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: The comment above still describes this hold as the dbt helpers' own read of the folder, "the second", but the ordinal is now 8: six other session.cwd reads run first.

A hard-coded ordinal is a silent tripwire. If another feature adds or drops one session.cwd call, the hold never fires; the Bash call then finishes before $.session.end(), and endDbtMods clears failureAtom (dbt-mods.tsx:1735) anyway, so 'a /clear while the shell folder is being read does not let the failed run back in' passes without ever exercising the race it exists for. Hold on something named (for example, set a held = true flag here and assert it fired in that test), or at least update the comment and the count together.

@hkaltai

hkaltai commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

review-loop: APPROVED at a56d3b6 (reviewers: gpt-6-astra high, gpt-6.1-sol high)

@hkaltai
hkaltai requested a review from sahrizvi November 18, 2026 12:27

@sahrizvi sahrizvi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving again

@hkaltai
hkaltai merged commit 5d8fb04 into main Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants