dbt-labs/dbt-core · error

Should match SQL ignoring whitespace differences

Error message

Should match SQL ignoring whitespace differences

What it means

Test-only assertion in the whitespace-normalization test: SQL differing only in whitespace must still match a recorded event when compared via the compacted form. Fires only if whitespace-insensitive semantic matching regresses.

Solutions

  1. Keep the SQL compaction/normalization applied before semantic comparison
  2. Re-run the semantic matching tests with whitespace-variant fixtures
  3. Treat failure as a matching-engine regression
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-adapter/src/time_machine/event_replay.rs:3317 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/885c19c1cb031b63. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-adapter/src/time_machine/event_replay.rs:3317

                timestamp_ns: seq as u64 * 1000,
            }
        }

        // Create events with SQL that differs only by whitespace
        let events = vec![make_sql_event(
            "node1",
            0,
            "execute",
            "SELECT   *\nFROM    users\nWHERE   id = 1",
            SemanticCategory::Write,
        )];
        let recording = make_recording(events);

        // Should match with compact SQL (whitespace removed)
        let compact_sql = serde_json::json!(["SELECT * FROM users WHERE id = 1"]);
        let event = recording
            .take_semantic_match("node1", "execute", &compact_sql, SemanticCategory::Write)
            .expect("Should match SQL ignoring whitespace differences");
        assert_eq!(event.method, "execute");
    }

    // -------------------------------------------------------------------------
    // SAO (State Aware Orchestration) tests
    // -------------------------------------------------------------------------

    use super::super::event::{RecordedRunCacheCloneDecision, RunCacheCloneEvent, SaoStatus};

    /// Helper to create a test Recording with SAO events
    fn make_recording_with_sao(
        adapter_events: Vec<AdapterCallEvent>,
        sao_events: Vec<SaoEvent>,
    ) -> Recording {
        let mut adapter_events_by_node: BTreeMap<String, Vec<AdapterCallEvent>> = BTreeMap::new();
        for event in adapter_events {
            adapter_events_by_node
                .entry(event.node_id.clone())

View on GitHub (pinned to 0267ce9170)