Skip to content

feat: add cost_optimization_features to dbtcloud_job, fix CI/Merge SAO and deferral bugs (closes #664)#670

Open
trouze wants to merge 5 commits intomainfrom
feat/issue-664-cost-optimization
Open

feat: add cost_optimization_features to dbtcloud_job, fix CI/Merge SAO and deferral bugs (closes #664)#670
trouze wants to merge 5 commits intomainfrom
feat/issue-664-cost-optimization

Conversation

@trouze
Copy link
Copy Markdown
Contributor

@trouze trouze commented Apr 9, 2026

Summary

  • Adds cost_optimization_features Set attribute as the preferred replacement for deprecated force_node_selection to enable State-Aware Orchestration (SAO). The attribute bridges to force_node_selection under the hood since the dbt Cloud API uses force_node_selection: bool — setting ["node_selection"] enables SAO, and the provider reads force_node_selection back to keep state consistent
  • Fixes CI/Merge jobs erroring with 405 when SAO validation runs — SAO fields are now skipped for CI/Merge job types
  • Fixes CI/Merge jobs losing deferring_environment_id after apply
  • Adds 5 new acceptance tests (note: clearing cost_optimization_features is not tested as the acceptance test account has account-level SAO enforcement that prevents disabling force_node_selection)

Closes #664

🤖 Generated with Claude Code

…O and deferral bugs (closes #664)

- Adds cost_optimization_features Set attribute as the preferred way to enable
  State-Aware Orchestration (SAO), replacing deprecated force_node_selection
- Fixes CI/Merge jobs erroring with SAO validation (405 error) by skipping
  SAO validation for CI and Merge job types
- Fixes CI/Merge jobs losing deferring_environment_id by preserving the value
  from the API response during Read
- Adds 5 new acceptance tests

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@trouze trouze requested a review from a team as a code owner April 9, 2026 19:55
trouze and others added 4 commits April 9, 2026 14:58
The dbt Cloud API uses force_node_selection (bool) under the hood, not a
cost_optimization_features array. Bridge in both directions:
- Write: cost_optimization_features=["node_selection"] -> force_node_selection=true
- Read: force_node_selection=true -> cost_optimization_features=["node_selection"]

Fixes inconsistent result after apply in TestAccDbtCloudJobCostOptimizationFeatures
and TestAccDbtCloudJobCIWithCostOptimizationFeatures.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…AO enforcement

- Fix Update path: use plan.ForceNodeSelection.IsNull() instead of
  job.ForceNodeSelection == nil for bridge condition, so clearing
  cost_optimization_features correctly sends force_node_selection=false
- Fix test step 2: account has account-level SAO enforcement so
  force_node_selection cannot be disabled; replace the clear step with
  a name-update step that verifies cost_optimization_features is stable

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@will-sargent-dbtlabs will-sargent-dbtlabs self-requested a review April 24, 2026 16:50
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.

feat: add cost_optimization_features to dbtcloud_job + fix CI/Merge SAO and deferral bugs

1 participant