-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Bug Summary
When running dbt-autofix refactor on snapshot YAML files, the tool incorrectly moves full_refresh: false from the config block into the nested meta block. This renders the setting ineffective and silently removes protection against accidental full refreshes.
Environment
- dbt-autofix version: 0.17.2
- dbt-core version: 1.10.15
- Adapter: dbt-bigquery 1.10.3
- Python version: 3.12
Steps to Reproduce
- Create a snapshot YAML file with
full_refresh: falseat the config level:
version: 2
snapshots:
- name: snp_tenant_segment
config:
unique_key: id
strategy: check
check_cols: all
full_refresh: false
meta:
dagster:
group: snapshot-
Run
dbt-autofix refactor -
Observe the resulting YAML:
version: 2
snapshots:
- name: snp_tenant_segment
config:
unique_key: id
strategy: check
check_cols: all
meta:
dagster:
group: snapshot
full_refresh: false # <-- INCORRECT: moved inside meta!Expected Behavior
full_refresh: false should remain at the config level:
config:
unique_key: id
strategy: check
check_cols: all
full_refresh: false # <-- Should stay here
meta:
dagster:
group: snapshotActual Behavior
full_refresh: false is moved inside the meta block where it has no effect on dbt's behavior.
Impact
This is a data-destructive bug. The full_refresh: false setting is specifically used to prevent accidental full refreshes of snapshot tables, which would destroy historical SCD Type 2 data. By silently moving this setting to meta, the protection is removed without any warning, and subsequent dbt snapshot --full-refresh commands would destroy snapshot history that users explicitly intended to protect.
Root Cause Hypothesis
It appears the refactor logic may be treating full_refresh as a "custom config" that should be moved to meta, when in fact full_refresh is a valid, documented dbt config property for snapshots (and other resource types).
Workaround
Manually move full_refresh: false back to the config level after running dbt-autofix refactor.