feat: [#1670] Compile / Execute dbt Model (Full Refresh)#1882
feat: [#1670] Compile / Execute dbt Model (Full Refresh)#1882ralphstodomingo wants to merge 3 commits intomasterfrom
Conversation
…l Refresh) Adds two new command-palette entries that invoke the existing compile / execute flows with `--full-refresh` (or its Python-bridge equivalent), so users previewing an incremental model see the full-refresh shape of the compiled query — i.e. `is_incremental()` evaluates to false and the incremental-only `where` clause is absent. Closes #1670. ## User-facing commands - `dbtPowerUser.compileCurrentModelFullRefresh` — "dbt Power User: Compile dbt Model (Full Refresh)" Invokes `dbt compile --select <model> --full-refresh` so `target/compiled/<project>/<model>.sql` contains the rendered full-refresh version of the model. - `dbtPowerUser.executeSQLFullRefresh` — "dbt Power User: Execute dbt SQL (Full Refresh)" Ctrl+Enter analogue: compiles the current file (via the Python bridge for Core integration, or `dbt show --full-refresh` for CLI-based integrations) with `is_incremental()` forced to false, then runs the preview query. Both commands leave the existing non-full-refresh variants untouched: `dbtPowerUser.compileCurrentModel` and `dbtPowerUser.executeSQL` continue to invoke dbt without `--full-refresh`, and regular Ctrl+Enter behavior is unchanged. ## Implementation Thin consumer wiring over the `fullRefresh` plumbing added in `altimate-dbt-integration` (companion PR AltimateAI/altimate-dbt-integration#44 — required for this PR to function; bump the dep after it merges). - `src/commands/runModel.ts`: `compileModelOnActiveWindow` and `executeQueryOnActiveWindow` gain an optional `fullRefresh` param, passed through to `compileDBTModel` and `executeSQL` which relay it into `DBTProjectContainer`. - `src/dbt_client/dbtProjectContainer.ts`: `compileModel` and `executeSQL` accept `fullRefresh`; `createModelParams` puts it on the `RunModelParams` object so `DBTCommandFactory.createCompileModelCommand` in `altimate-dbt-integration` can append `--full-refresh` to the CLI args. - `src/dbt_client/dbtProject.ts`: `executeSQLOnQueryPanel` and its with-limit variant thread the flag into `dbtProjectIntegration.executeSQLWithLimit`. - `src/commands/index.ts`: two new `commands.registerCommand` calls that invoke the existing `RunModel` methods with `fullRefresh=true`. - `package.json`: the two new command contributions. ## Tests - `src/test/suite/runModelFullRefresh.test.ts` — 6 new Jest cases: * `compileModelOnActiveWindow` passes `fullRefresh=false` by default * `compileModelOnActiveWindow(true)` passes `fullRefresh=true` * `compileModelOnActiveWindow` no-ops with no active editor * `executeQueryOnActiveWindow` passes `fullRefresh=false` by default * `executeQueryOnActiveWindow(true)` passes `fullRefresh=true` * `executeQueryOnActiveWindow` no-ops with no active editor Full Jest suite: 21 suites, 263 passed, 1 skipped, 0 failing. `tsc --noEmit` clean. Docker runtime verification (companion evidence on the upstream PR; this PR's end-to-end run captured in a follow-up comment): extension dispatches `dbt compile --select orders_incremental --full-refresh --target dev` when the new command is invoked, `target/compiled/...` is written without the `is_incremental()` `where` clause, and the existing plain compile command continues to dispatch without `--full-refresh`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds two "Full Refresh" VS Code commands and threads a Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant VSCode as "VS Code Command\n(package.json / index.ts)"
participant RunModel as RunModel
participant Container as DBTProjectContainer
participant Project as DBTProject
participant Integration as dbtIntegration
User->>VSCode: invoke Full Refresh command
VSCode->>RunModel: compileModelOnActiveWindow(fullRefresh=true) / executeQueryOnActiveWindow(fullRefresh=true)
RunModel->>Container: compileModel(..., fullRefresh=true) / executeSQL(..., fullRefresh=true)
Container->>Project: executeSQLOnQueryPanel(..., fullRefresh=true) / compileModel(..., fullRefresh=true)
Project->>Integration: executeSQLWithLimit(..., fullRefresh=true) / compileModel(..., fullRefresh=true)
Integration-->>Project: result
Project-->>Container: result/event
Container-->>RunModel: completion
RunModel-->>VSCode: show output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The `fullRefresh` plumbing lives in `@altimateai/dbt-integration`#44, which has not shipped to npm yet. Until the dep is bumped, CI runs `tsc`/webpack against the published 0.2.12 types that still declare `executeSQLWithLimit` with 3 parameters, so the 4-arg call added in the previous commit fails with `TS2554: Expected 3 arguments, but got 4.`. Widen the method reference locally via `as unknown as` cast with a `TODO(#1670)` comment pointing at the upstream PR. When the dep is bumped to the version containing #44, the cast can be deleted in a one-line follow-up. Verified locally against a freshly-installed `@altimateai/dbt-integration@0.2.12` from npm: `tsc --noEmit` clean, `webpack --mode development` clean, 6/6 unit tests still pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bundle Size Reportdarwin-arm64: 70.1 MB
linux-x64: 71.8 MB
win32-x64: 72.7 MB
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/dbt_client/dbtProjectContainer.ts (1)
423-444:⚠️ Potential issue | 🟠 MajorPreserve
fullRefreshwhen re-running compile history entries.This helper now emits
RunModelParams.fullRefresh, butrerunFromHistory()still rebuilds params throughparseHistoryArgs()and never sets that bit. A history entry created bydbtPowerUser.compileCurrentModelFullRefreshwill therefore replay as a plain compile.parseHistoryArgs()needs to detect--full-refreshand returnfullRefresh: trueas well.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/dbt_client/dbtProjectContainer.ts` around lines 423 - 444, parseHistoryArgs currently rebuilds RunModelParams without preserving the --full-refresh flag, so rerunFromHistory loses fullRefresh even though createModelParams emits it; update parseHistoryArgs to scan the history args for the literal "--full-refresh" (or its short form if supported) and set fullRefresh: true in the returned RunModelParams/RunModelParams-like object, ensuring rerunFromHistory uses that value; reference parseHistoryArgs, rerunFromHistory, RunModelParams, and createModelParams to locate where the params are produced and consumed and add the fullRefresh boolean to the parsed result.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Around line 594-598: The package currently exposes
dbtPowerUser.compileCurrentModelFullRefresh and
dbtPowerUser.executeSQLFullRefresh in package.json but the installed integration
`@altimateai/dbt-integration` is pinned to ^0.2.12 which lacks the fullRefresh
parameter; update package.json and/or installation logic to either bump the
dependency to a release that supports the 4th fullRefresh argument or only
register those commands when the runtime integration version exposes that API.
Specifically, remove or gate registration of the two command IDs in package.json
or the activation code and update src/dbt_client/dbtProject.ts to stop using the
temporary cast (the TODO) unless the checked integration version proves support;
implement a version check against `@altimateai/dbt-integration` and conditionally
wire up dbtPowerUser.compileCurrentModelFullRefresh and
dbtPowerUser.executeSQLFullRefresh or update the dependency to a compatible
version.
---
Outside diff comments:
In `@src/dbt_client/dbtProjectContainer.ts`:
- Around line 423-444: parseHistoryArgs currently rebuilds RunModelParams
without preserving the --full-refresh flag, so rerunFromHistory loses
fullRefresh even though createModelParams emits it; update parseHistoryArgs to
scan the history args for the literal "--full-refresh" (or its short form if
supported) and set fullRefresh: true in the returned
RunModelParams/RunModelParams-like object, ensuring rerunFromHistory uses that
value; reference parseHistoryArgs, rerunFromHistory, RunModelParams, and
createModelParams to locate where the params are produced and consumed and add
the fullRefresh boolean to the parsed result.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 20a42563-46b7-4fbf-89bd-4d6393b2fd77
📒 Files selected for processing (6)
package.jsonsrc/commands/index.tssrc/commands/runModel.tssrc/dbt_client/dbtProject.tssrc/dbt_client/dbtProjectContainer.tssrc/test/suite/runModelFullRefresh.test.ts
| { | ||
| "command": "dbtPowerUser.compileCurrentModelFullRefresh", | ||
| "title": "Compile dbt Model (Full Refresh)", | ||
| "category": "dbt Power User" | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Declared dependency in package.json:\n'
rg -n '"@altimateai/dbt-integration"' package.json
printf '\nResolved dependency in lockfiles (if present):\n'
rg -n '@altimateai/dbt-integration' yarn.lock package-lock.json pnpm-lock.yaml 2>/dev/null || true
printf '\nLocal patch-package overrides touching dbt integration:\n'
fd -i 'altimate*dbt*integration*' patches . -t f 2>/dev/null || true
rg -n 'fullRefresh|executeSQLWithLimit|createCompileModelCommand' patches 2>/dev/null || trueRepository: AltimateAI/vscode-dbt-power-user
Length of output: 411
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Verifying command entries at specified lines in package.json ==="
sed -n '594,598p' package.json
echo ""
sed -n '706,710p' package.json
echo ""
echo "=== Checking dbtProject.ts for the temporary workaround ==="
sed -n '1354,1367p' src/dbt_client/dbtProject.ts || echo "File or line range not found"
echo ""
echo "=== Checking if fullRefresh is used in commands implementation ==="
rg -n 'compileCurrentModelFullRefresh|executeSQLFullRefresh' src --type ts -A 3 | head -30Repository: AltimateAI/vscode-dbt-power-user
Length of output: 1847
🌐 Web query:
@altimateai/dbt-integration releases fullRefresh support 0.2.13 0.3.0 2025 2026
💡 Result:
The npm package @altimateai/dbt-integration is a TypeScript library providing unified integration for dbt projects, supporting dbt Core, dbt Cloud, dbt Fusion, and CLI execution. It handles manifest parsing, dependency graphs, and dbt operations. No explicit evidence found for "fullRefresh support" (dbt's full_refresh config or --full-refresh flag handling) being added in specific versions 0.2.13 or 0.3.0. Searches across npm pages, GitHub repos (AltimateAI organization, vscode-dbt-power-user PRs), changelogs, and releases show versions up to 0.2.12 mentioned (e.g., upgraded in vscode-dbt-power-user releases), with version history indicating 0.2.0-0.2.9 from Oct 2025-Mar 2026 (23 total versions first published Jun 2025). No GitHub source repo for the package found, no changelogs mentioning these versions or fullRefresh. The library likely supports standard dbt flags including --full-refresh via its command execution interfaces (e.g., DBTFacade), as it unifies dbt operations, but specific addition in 0.2.13/0.3.0 or 2025/2026 timeline unconfirmed. vscode-dbt-power-user integrates this library (PR #1697, Jun-Oct 2025) and supports dbt features like defer, but no fullRefresh mention. AltimateAI's altimate-dbt-snowflake-query-tags package tracks full_refresh in query metadata (v2.0.0, Mar 2026).
Citations:
- 1: https://www.npmjs.com/package/@altimateai/dbt-integration
- 2: https://registry.npmjs.org/%40altimateai%2Fdbt-integration
- 3: refactor: use dbt integration library #1697
- 4: https://github.com/innoverio/vscode-dbt-power-user/releases
- 5: https://github.com/AltimateAI
- 6: https://github.com/AltimateAI/vscode-dbt-power-user
- 7: Dbt integration interface #799
- 8: https://www.altimate.ai
- 9: https://www.praguechessfestival.com
- 10: https://www.altf2.ai
- 11: https://www.michelbeaubien.com
- 12: https://github.com/innoverio/vscode-dbt-power-user
Gate these fullRefresh commands on the integration package version that actually supports them.
The commands dbtPowerUser.compileCurrentModelFullRefresh (594-598) and dbtPowerUser.executeSQLFullRefresh (706-710) are exposed in the manifest and wired to pass the fullRefresh flag. However, @altimateai/dbt-integration is still locked to ^0.2.12, which does not support this parameter. The workaround in src/dbt_client/dbtProject.ts (1354-1367) explicitly casts the type to accept the 4th parameter while the published typings declare only 3 parameters—a temporary solution marked with a TODO pending the integration package update. Users invoking these commands will experience silent degradation: the commands will execute without the full-refresh behavior. Either bump the integration dependency to a version that supports fullRefresh, or conditionally register these commands only when the required version is installed.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package.json` around lines 594 - 598, The package currently exposes
dbtPowerUser.compileCurrentModelFullRefresh and
dbtPowerUser.executeSQLFullRefresh in package.json but the installed integration
`@altimateai/dbt-integration` is pinned to ^0.2.12 which lacks the fullRefresh
parameter; update package.json and/or installation logic to either bump the
dependency to a release that supports the 4th fullRefresh argument or only
register those commands when the runtime integration version exposes that API.
Specifically, remove or gate registration of the two command IDs in package.json
or the activation code and update src/dbt_client/dbtProject.ts to stop using the
temporary cast (the TODO) unless the checked integration version proves support;
implement a version check against `@altimateai/dbt-integration` and conditionally
wire up dbtPowerUser.compileCurrentModelFullRefresh and
dbtPowerUser.executeSQLFullRefresh or update the dependency to a compatible
version.
|
Full E2E verification complete across both the dbt-integration library and the power-user extension. What was testedDocker code-server container, jaffle-shop-duckdb fixture, with Fixture has both an incremental model (
Regression coverage: non-full-refresh incremental compile still produces the Phase 1 (bridge-level harness) additionally verifies Evidence lives in Unblocking checklistStill blocked on AltimateAI/altimate-dbt-integration#44 merging and publishing a new
Incidental finding (not caused by this PR — flagging for a separate issue)Worth knowing for anyone debugging this feature: power-user's Core-integration dbt subprocess runs with a different CWD than a user's direct |
Summary
Closes #1670.
Adds two new command-palette entries that invoke the existing compile / execute flows with
--full-refresh(or its Python-bridge equivalent), so users previewing an incremental model can see the full-refresh shape of the compiled query —is_incremental()evaluates to false and the incremental-onlywhereclause is absent.User-facing commands
dbt Power User: Compile dbt Model (Full Refresh)(dbtPowerUser.compileCurrentModelFullRefresh)Invokes
dbt compile --select <model> --full-refresh, sotarget/compiled/<project>/<model>.sqlcontains the rendered full-refresh version of the model. Open "Show Compiled SQL" right after to read it.dbt Power User: Execute dbt SQL (Full Refresh)(dbtPowerUser.executeSQLFullRefresh)Ctrl+Enter analogue. Compiles the current file with
is_incremental()forced to false (via the Python bridge for Core integration, ordbt show --full-refreshfor CLI-based integrations), then runs the preview query in the query panel.Both commands leave the existing non-full-refresh variants untouched —
dbtPowerUser.compileCurrentModelanddbtPowerUser.executeSQLdispatch dbt without--full-refreshexactly as before.Companion upstream PR
Depends on
AltimateAI/altimate-dbt-integration#44, which adds the underlyingfullRefreshplumbing — both the Python-bridgefull_refreshkwarg onDbtProject.compile_sql/compile_node(with a clone-then-set pattern that doesn't mutate global dbt flags) and the CLI-level conditional--full-refreshflag append in all four integration classes + theDBTCommandFactory.createCompileModelCommand.Bump the
@altimateai/dbt-integrationdependency after #44 merges and is published. This PR builds locally against a linked copy of the fix branch for verification.Files
src/commands/runModel.ts—compileModelOnActiveWindowandexecuteQueryOnActiveWindowgain an optionalfullRefreshparam threaded intocompileDBTModelandexecuteSQLsrc/dbt_client/dbtProjectContainer.ts—compileModelandexecuteSQLacceptfullRefresh;createModelParamsputs it onRunModelParamsso the upstream factory can read it when building the CLI argssrc/dbt_client/dbtProject.ts—executeSQLOnQueryPanelandexecuteSQLWithLimitOnQueryPanelthread the flag intodbtProjectIntegration.executeSQLWithLimitsrc/commands/index.ts— two newcommands.registerCommandcalls wiring the new command IDs to the existingRunModelmethods withfullRefresh=truepackage.json— two new command contributionssrc/test/suite/runModelFullRefresh.test.ts— 6 new Jest casesVerification
Unit tests
Full Jest suite: 21 suites, 263 passed, 1 skipped, 0 failing.
tsc --noEmitclean.npx webpack --mode developmentbuilds clean.Docker runtime verification against
origin/masterHEADSame repro recipe as the baseline evidence (see follow-up comment):
.worktrees/master-baselinecode-server container running jaffle-shop-duckdb with anorders_incrementalmodel (materialized='incremental' with an{% if is_incremental() %}where order_date > (select max(order_date) from {{ this }}){% endif %}guard). Afterdbt seed && dbt run --select orders_incrementaltwice so the relation exists andis_incremental()naturally evaluates to true, I built this branch's extension with the patched upstream dist linked intonode_modules/@altimateai/dbt-integration/and openedmodels/orders_incremental.sqlin code-server.Before — master HEAD (plain
dbt Power User: Compile dbt Model):Extension log:
target/compiled/jaffle_shop/models/orders_incremental.sql:This is the #1670 bug — the
whereclause is baked in.After — this branch (
dbt Power User: Compile dbt Model (Full Refresh)):Extension log:
target/compiled/jaffle_shop/models/orders_incremental.sql:Clean, no
whereclause. Then I re-invoked the originalCompile dbt Modelcommand in the same session to confirm it still dispatches without--full-refresh:The new command is fully opt-in — the existing compile flow is unaffected.
Test plan
npx jest src/test/suite/runModelFullRefresh.test.ts— 6/6 passtsc --noEmitcleannpx webpack --mode developmentbuilds cleanCompile dbt Modelon master HEAD produces SQL with theis_incremental()whereclause (bug reproduces); newCompile dbt Model (Full Refresh)on this branch produces SQL without thewhereclause (bug fixed); plainCompile dbt Modelon this branch still dispatches without--full-refresh(no regression)dbt compile --select <model> --full-refresh --target devExecute dbt SQL (Full Refresh)(Ctrl+Enter analogue) — exercised by upstream Python-bridge unit test in Environment configuration pre-requisites? #44; consumer-side manual test pending once the upstream dep is bumped@altimateai/dbt-integrationto the version containing Environment configuration pre-requisites? #44 before mergingCo-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Generated with Claude Code
Summary by CodeRabbit
New Features
Tests