Skip to content

feat(dbt-tools): build entire project when altimate-dbt build has no --model#465

Open
mdesmet wants to merge 2 commits intomainfrom
feat/dbt-build-project-shorthand
Open

feat(dbt-tools): build entire project when altimate-dbt build has no --model#465
mdesmet wants to merge 2 commits intomainfrom
feat/dbt-build-project-shorthand

Conversation

@mdesmet
Copy link
Contributor

@mdesmet mdesmet commented Mar 25, 2026

Summary

  • altimate-dbt build without --model now builds the entire project (calls unsafeBuildProjectImmediately), instead of returning an error
  • build-project command still works as before
  • Updated all 5 dbt skill altimate-dbt-commands.md reference files to document the new behavior

Test plan

  • altimate-dbt build in a dbt project directory builds the full project
  • altimate-dbt build --model <name> still builds a single model
  • altimate-dbt build --model <name> --downstream still builds with downstream

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated command docs to use altimate-dbt build for full-project builds and altimate-dbt build --model <name> [--downstream] for single-model builds; removed altimate-dbt build-project.
  • New Features
    • altimate-dbt build now performs full project compile+run+test when no --model is provided.
  • Tests
    • Added test coverage validating full-project vs. model-scoped build behavior.

`altimate-dbt build` without arguments now builds the whole project via
`unsafeBuildProjectImmediately`, replacing the need for the separate
`build-project` command. Updated all dbt skill references accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

Replaced documentation references to altimate-dbt build-project with altimate-dbt build and updated the build command implementation to run a full project build when --model is not provided (delegates to project(adapter)). Added tests covering project vs. model build flows.

Changes

Cohort / File(s) Summary
Documentation: Dbt Skill Command References
\.opencode/skills/dbt-analyze/SKILL.md, \.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md, \.opencode/skills/dbt-develop/references/altimate-dbt-commands.md, \.opencode/skills/dbt-docs/references/altimate-dbt-commands.md, \.opencode/skills/dbt-test/references/altimate-dbt-commands.md, \.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md
Replaced altimate-dbt build-project with altimate-dbt build as the documented full-project command; clarified altimate-dbt build --model <name> [--downstream] is for single-model builds.
Build Command Implementation
packages/dbt-tools/src/commands/build.ts
When --model is absent, build now delegates to project(adapter) to perform a full project build instead of returning a missing-model error.
Tests
packages/dbt-tools/test/build.test.ts
Added tests that mock a DBTProjectIntegrationAdapter and assert: full-project invocation calls unsafeBuildProjectImmediately; --model calls unsafeBuildModelImmediately with correct options; --downstream sets the downstream operator.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as "CLI"
  participant BuildCmd as "build(command)"
  participant Adapter as "DBTProjectIntegrationAdapter"

  CLI->>BuildCmd: invoke `altimate-dbt build` or `altimate-dbt build --model <name> [--downstream]`
  alt full-project?
    BuildCmd->>Adapter: unsafeBuildProjectImmediately()
    Adapter-->>BuildCmd: project build result
  else model-specific
    BuildCmd->>Adapter: unsafeBuildModelImmediately({modelName, plusOperatorLeft, plusOperatorRight})
    Adapter-->>BuildCmd: model build result
  end
  BuildCmd-->>CLI: stdout / exit code
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • suryaiyer95

Poem

🐰 I hopped through docs and code today,
Replaced an old command along the way.
Now build can run the whole brigade,
Or target a model, downstre ams made.
Hooray — carrots for every CI parade! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately summarizes the main feature: enabling altimate-dbt build to build an entire project when the --model flag is absent.
Description check ✅ Passed The pull request description covers all required template sections: Summary explains the changes, Test Plan outlines the validation approach, and Checklist is present with items marked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dbt-build-project-shorthand

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Covers: no-model → project build, --model → single model, --downstream flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/dbt-tools/test/build.test.ts (1)

38-46: Consider adding result and mutual-exclusion assertions for consistency.

Tests 1 and 2 assert both the return value and that the "other" method was not called. This test only checks the call parameters. Adding similar assertions would make the suite consistent.

Suggested enhancement
   test("build --model <name> --downstream sets plusOperatorRight", async () => {
     const adapter = makeAdapter()
-    await build(adapter, ["--model", "orders", "--downstream"])
+    const result = await build(adapter, ["--model", "orders", "--downstream"])
     expect(adapter.unsafeBuildModelImmediately).toHaveBeenCalledWith({
       plusOperatorLeft: "",
       modelName: "orders",
       plusOperatorRight: "+",
     })
+    expect(adapter.unsafeBuildProjectImmediately).not.toHaveBeenCalled()
+    expect(result).toEqual({ stdout: "model built" })
   })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/dbt-tools/test/build.test.ts` around lines 38 - 46, Capture the
return value from await build(adapter, ["--model", "orders", "--downstream"])
into a result variable and assert it equals the mocked return value of
adapter.unsafeBuildModelImmediately (mock its return if not already mocked), and
also add a mutual-exclusion assertion that adapter.unsafeBuildModelQueued was
not called; locate the test using makeAdapter(), build(),
adapter.unsafeBuildModelImmediately and adapter.unsafeBuildModelQueued and add
expect(result).toEqual(<mockedValue>) and
expect(adapter.unsafeBuildModelQueued).not.toHaveBeenCalled().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/dbt-tools/test/build.test.ts`:
- Line 2: The import statement imports an unused symbol "project" from
"../src/commands/build"; remove "project" from the import so only "build" is
imported (i.e., change `import { build, project } ...` to `import { build }
...`), then run tests/lint to confirm the unused-import error is resolved.

---

Nitpick comments:
In `@packages/dbt-tools/test/build.test.ts`:
- Around line 38-46: Capture the return value from await build(adapter,
["--model", "orders", "--downstream"]) into a result variable and assert it
equals the mocked return value of adapter.unsafeBuildModelImmediately (mock its
return if not already mocked), and also add a mutual-exclusion assertion that
adapter.unsafeBuildModelQueued was not called; locate the test using
makeAdapter(), build(), adapter.unsafeBuildModelImmediately and
adapter.unsafeBuildModelQueued and add expect(result).toEqual(<mockedValue>) and
expect(adapter.unsafeBuildModelQueued).not.toHaveBeenCalled().
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8e27511c-8b32-4f04-b66a-502f08543363

📥 Commits

Reviewing files that changed from the base of the PR and between 99aacab and a885a7e.

📒 Files selected for processing (1)
  • packages/dbt-tools/test/build.test.ts

@@ -0,0 +1,47 @@
import { describe, test, expect, mock } from "bun:test"
import { build, project } from "../src/commands/build"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused project import.

project is imported but never used in this file.

Suggested fix
-import { build, project } from "../src/commands/build"
+import { build } from "../src/commands/build"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { build, project } from "../src/commands/build"
import { build } from "../src/commands/build"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/dbt-tools/test/build.test.ts` at line 2, The import statement
imports an unused symbol "project" from "../src/commands/build"; remove
"project" from the import so only "build" is imported (i.e., change `import {
build, project } ...` to `import { build } ...`), then run tests/lint to confirm
the unused-import error is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant