Visitar URL original
feat: dbt_defer_state tool — Power User defer setting and profile target by hkaltai · Pull Request #1734 · AltimateAI/altimate-code · GitHub
Skip to content

feat: dbt_defer_state tool — Power User defer setting and profile target - #1734

Draft
hkaltai wants to merge 4 commits into
mainfrom
feat/dbt-defer-state-tool
Draft

hkaltai wants to merge 4 commits into
mainfrom
feat/dbt-defer-state-tool

Conversation

@hkaltai

@hkaltai hkaltai commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • New feature

What does this PR do?

Implements the dbt_defer_state tool (package P-04, altimate-code half). Given a dbt project folder it reads dbt.deferConfigPerProject from .vscode/settings.json (comments and trailing commas allowed), finds the entry keyed by the project's path relative to its workspace folder, and returns { enabled, favorState, mode, stateDir, reason, defaultTarget, targets }.

  • Local mode: manifestPathForDeferral (with ${workspaceFolder} and ${env:NAME} expanded, relative paths resolved against the project) is returned as stateDir only when it is a directory; otherwise reason says why.
  • Remote mode: reported as mode: remote with enabled: false and a clear reason. The request shape of dbt/v1/fetch_artifact_url could not be verified, so no download is attempted and api/fetch-artifact-url.ts is not added.
  • The profile's default target and its output names come from profiles.yml (DBT_PROFILES_DIR, the project folder, then ~/.dbt).
  • Read-only.

This branch includes the foundation commits (dbt Power User tool foundation); retarget/rebase once that PR merges. The plugin half is in the altimate-claude-plugin PR for feat/defer-target, which should merge after this one.

How did you verify your code works?

  • bun test test/altimate/dbt-defer-state.test.ts: 8 tests pass (local mode, defer off, no entry, root project key, non-directory state path, remote reported unsupported, missing settings/profiles, comments and trailing commas).
  • bun typecheck passes.

Cost side effects

None. The tool only reads local files; it adds no model calls, warehouse queries or cloud resources.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

Changelog

  • Added dbt_defer_state: reads the dbt Power User defer-to-production setting and the profile's default target for a dbt project.

🤖 Generated with Claude Code


Summary by cubic

Adds the dbt_defer_state tool, which reads the dbt Power User defer setting from .vscode/settings.json and reports whether defer is on, the state directory, and the profile's default target, plus the foundation the other dbt Power User tools build on.

  • Local mode returns the configured state directory even while defer is off, so a session can switch it on; the directory must hold a manifest.json. Remote mode, missing or unparseable settings, unknown manifest types, and non-directory paths are reported with reasons instead; env_var() in the profile, target, and state path is resolved.
  • Adds dbtAdapterFor, the gate every adapter-backed tool goes through: it refuses read-only calls, plan mode, sessions in other projects, and adapters that failed to start.
  • Adds AltimateApi.apiRequest for endpoint files to call the backend with the stored credentials.
  • Exposes nine dbt tool stubs; the eight beyond dbt_defer_state return "not implemented" placeholders.
  • dbt_defer_state is read-only; it adds no API calls, warehouse queries, or cloud resources.

Written for commit 983309a. Summary will update on new commits.

View guided diff Turn on auto-fix

hkaltai and others added 3 commits November 13, 2026 16:30
Nine tool stubs exposed through `altimate tool run` (dbt_run_results,
dbt_defer_state, dbt_map_relations, docs_share_comments, dbt_cost_estimate,
dbt_health, dbt_sql_graph, dbt_docs_coverage, dbt_cte_profile), an exported
`AltimateApi.apiRequest` that calls the backend with the stored credentials,
and `dbtAdapterFor`, the one gate every adapter-backed tool goes through:
it refuses read-only calls, other projects, and an adapter that did not start.

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

Reads dbt.deferConfigPerProject from .vscode/settings.json (comments allowed),
returns whether defer is on, favor state, the local state directory, and the
profile's default target and output names. Remote mode reports that it is not
supported yet instead of guessing a download request.

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

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

…er is off and rejects unreadable settings

The state directory is resolved whether or not defer is on, so a session can
switch it on; settings that do not parse and unknown manifest types no longer
enable defer; a state directory needs a manifest.json; profile and target
written as env_var() are resolved with the shared profiles helpers.

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

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

This branch has not been deployed

No deployments
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