Repository navigation
feat: dbt helpers from dbt Power User in Claude Code sessions (1.6.0) - #23
Conversation
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code Review SummaryStatus: 12 Issues Found | Recommendation: Address before merge Overview
Incremental review at Issue Details (click to expand)SUGGESTION
Files Reviewed (11 files)
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
Incremental review at Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous review (commit feb9afa)Status: 11 Issues Found | Recommendation: Address before merge Overview
Incremental review at No code changed since Issue Details (click to expand)SUGGESTION
Files Reviewed (5 files)
Previous review (commit b21ee75)Status: 10 Issues Found | Recommendation: Address before merge Overview
Incremental review at
The ten earlier findings were re-checked at this HEAD and are unchanged. Active human inline review comments ( Fix these issues in Kilo Cloud Issue Details (click to expand)SUGGESTION
Files Reviewed (5 files)
Previous review (commit d793b0e)Status: 10 Issues Found | Recommendation: Address before merge Overview
Incremental review at Fix these issues in Kilo Cloud Issue Details (click to expand)SUGGESTION
Files Reviewed (9 files)
Previous review (commit 6b22aae)Status: 10 Issues Found | Recommendation: Address before merge Overview
Incremental review at Fix these issues in Kilo Cloud Issue Details (click to expand)SUGGESTION
[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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
|
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):
|
|
Thanks for round 3. Everything is addressed; each inline comment has its own reply.
Checks at 5f5af0e: 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. |
… dbt's Python has them, on a runner whose python3 lacks them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Follow-up to the approval at 5f5af0e: 6b22aae changes only |
|
review-loop: APPROVED at 6b22aae (reviewers: gpt-6-astra high, gpt-6.1-sol high) |
…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>
|
|
||
| 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. |
There was a problem hiding this comment.
SUGGESTION: Two problems in this new note.
folder,,has a doubled comma.- The first clause says the helpers read the
target-paththatdbt_project.ymlnames, buttargetPath()(hooks/dbt-mods-core.ts:468-473) falls back totargetfor any value containing{{, so a Jinjatarget-pathsuch as{{ env_var('DBT_TARGET_DIR', 'build') }}is not followed, with the same three consequences this note lists forDBT_TARGET_PATHand--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.
| 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). |
There was a problem hiding this comment.
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>
|
review-loop: APPROVED at 488d2d1 (reviewers: gpt-6-astra high, gpt-6.1-sol high) |
sahrizvi
left a comment
There was a problem hiding this comment.
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
hostURL; sslmodeortargetreading the password variable;- a YAML alias into
threads; - a Trino JWT with a line break;
- an all-digit password;
- a
keyfile_jsonstring; - a Snowflake
private_keytemplate 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):
- dbt's Jinja filters (
| as_text) stop the variable's value from being recorded. Edge: it needs a filter plus an echoing misconfiguration. - A shell or non-Python dbt launcher, or a Python without PyYAML, silently loads nothing. Unusual layout.
- The load cache is marked done before the script finishes. Timing race.
- A variable used only under
useris skipped. Documented exclusion. - A date-shaped password is not collected. Edge input.
--profiles-dir "$HOME/…"is not followed. Claude already saw that output.- Ordinary words and
dbname/hostvalues are redacted from ordinary errors. Cosmetic. - The
dbt lsauthorship race (round-3 minor, partly fixed). Timing. - History loads before values are known. Only affects entries that were already contaminated.
- 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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 }) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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)): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 ~.
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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
selectorwarehouseas the password, everyselectin a SQL error, or thewarehouseinwarehouse_orders, becomes‹redacted›. dbname. dbt-postgres and dbt-redshift name the databasedbname, which isn't inIDENTIFIERS(onlydatabaseis). Withdbname: analytics, the most common model error readsrelation "‹redacted›.public.stg_orders" does not exist.host. A host namedpostgresturnsrole "postgres" does not existintorole "‹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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)) : [])) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
Round 4 (488d2d1): Claude + Codex, combined commentApproved; the formal review has the minors inline. This comment covers what isn't tied to a diff line. Scope and merge state
Round-3 findings
Profile payloads: real dbt output through the real hooks
A shared Checks at head (base in brackets), run one after the other
Mutation checks on the scrub (head copy, restored after each)
Live checkA Nit
|
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>
|
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 |
There was a problem hiding this comment.
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.
|
review-loop: APPROVED at a56d3b6 (reviewers: gpt-6-astra high, gpt-6.1-sol high) |
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/venvin the project, elsedbton PATH) and never call a model. The code is in a newhooks/dbt-mods.tsx, withdbt-mods-core.tsfor parsing dbt's output and files andpane-size.tsxfor pane sizes, and is wired into the existing hooks module.model-paths, the plugin runsdbt showfor 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 withschema.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.run_results.jsonthat 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.dbt showand from/dbt-showopen 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 fromprofiles.ymlbeyond 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.target/manifest.jsongo with the file, once per turn. A manifest over 4 MiB is sliced through the project's Python.profiles.yml, read with dbt's own Python and PyYAML;DBT_PROFILE,DBT_TARGETand the default target are honoured, and when it can't tell, it says so instead of guessing./dbt-doctoradds the warehouse connection test, which session start never runs.The
dbt_modsoption 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 throughtail/head).Outside that, they take the conservative path: no band, nothing cleared, nothing saved, or "could not tell". That covers:
||fallbacks, killed runs, and contradictory repeated flags;env_var;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 validateand--strict: pass.tests/*.sh: 8/8 pass, includingtests/dbt-scripts.sh, which runs the three embedded Python scripts for real against fixtures holding a sentinel secret. pytest: 65 passed./dbt-showwith bookmarks;/dbt-doctorwith the connection test.Follow-ups (not blocking)
run_results.jsonfrom 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.ymlscript 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 --strictfails on 4isCollapsedband-fixture type errors inlineage.test.tsxand on the missing plugin icon. ThedrawLayered … under 300 msperf test inlineage-layout.test.tscan flake under load.Cost side effects
dbt show --limit 1against 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.dbt_mods: falseturns it off./dbt-show, Re-run, Run dbt parse/deps and the connection test run only when the person asks.🤖 Generated with Claude Code