Skip to content

[Bug] full_refresh incorrectly moved from snapshot config to meta block #248

@christopherekfeldt

Description

@christopherekfeldt

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

  1. Create a snapshot YAML file with full_refresh: false at 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
  1. Run dbt-autofix refactor

  2. 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: snapshot

Actual 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions