{"record":{"id":"70b7026c6423d453","repo":"dbt-labs/dbt-core","slug":"ok","errorCode":null,"errorMessage":"ok","messagePattern":"ok","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/time_machine/metadata.rs","lineNumber":918,"sourceCode":"        let args = args_fetch_view_definitions([\"a.b.c\", \"d.e.f\"]);\n        assert!(matches!(\n            args,\n            MetadataCallArgs::FetchViewDefinitions { relations } if relations == vec![\"a.b.c\", \"d.e.f\"]\n        ));\n    }\n\n    #[test]\n    fn test_view_definition_vec_round_trips_via_recording_json() {\n        use crate::metadata::ViewDefinition;\n        let original = vec![ViewDefinition {\n            fqn: r#\"\"DB\".\"S\".\"V\"\"#.to_string(),\n            definition: \"SELECT 1\".to_string(),\n            dialect: AdapterType::Snowflake,\n            default_catalog: \"DB\".to_string(),\n            default_schema: \"S\".to_string(),\n        }];\n        let json = original.to_recording_json();\n        let restored = <Vec<ViewDefinition>>::from_recording_json(&json).expect(\"ok\");\n        assert_eq!(restored.len(), 1);\n        assert_eq!(restored[0].fqn, original[0].fqn);\n        assert_eq!(restored[0].definition, original[0].definition);\n        assert_eq!(restored[0].dialect, original[0].dialect);\n        assert_eq!(restored[0].default_catalog, original[0].default_catalog);\n        assert_eq!(restored[0].default_schema, original[0].default_schema);\n    }\n\n    #[test]\n    fn test_view_definition_fetch_result_round_trips_unresolvable() {\n        use crate::metadata::{ViewDefinition, ViewDefinitionFetchResult};\n        let original = ViewDefinitionFetchResult {\n            definitions: vec![ViewDefinition {\n                fqn: r#\"\"DB\".\"S\".\"V\"\"#.to_string(),\n                definition: \"SELECT 1\".to_string(),\n                dialect: AdapterType::Snowflake,\n                default_catalog: \"DB\".to_string(),\n                default_schema: \"S\".to_string(),","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/time_machine/metadata.rs#L900-L936","documentation":"A test panic from `expect(\"ok\")` on `<Vec<ViewDefinition>>::from_recording_json(&json)`. The recording codec must reconstruct a Vec<ViewDefinition> from its `to_recording_json` output; any deserialize error (missing fields, non-serializable AdapterType dialect, field drift) panics the test. It means the ViewDefinition recording format is not round-trip safe at `crates/dbt-adapter/src/time_machine/metadata.rs:918`.","triggerScenarios":"`Vec<ViewDefinition>::from_recording_json` receiving JSON from `to_recording_json` where a ViewDefinition field (fqn, definition, dialect, default_catalog, default_schema) is missing, renamed, or of unexpected type.","commonSituations":"Adding or renaming a field on ViewDefinition without updating its recording JSON impl; AdapterType serde representation changing; replaying old recordings against a newer struct definition.","solutions":["Inspect the underlying error by replacing expect with unwrap_or_else that prints the error and the json payload.","Verify every field of ViewDefinition is serialized by to_recording_json and read back by from_recording_json (fqn, definition, dialect, default_catalog, default_schema).","Update the ViewDefinition recording impl after any struct field change, and regenerate old recordings.","Add serde round-trip property tests so drift is caught at compile/CI time."],"exampleFix":"// before\nlet restored = <Vec<ViewDefinition>>::from_recording_json(&json).expect(\"ok\");\n// after\nlet restored = <Vec<ViewDefinition>>::from_recording_json(&json)\n    .unwrap_or_else(|e| panic!(\"view definitions failed to deserialize: {e}; json={json}\"));","handlingStrategy":"validation","validationCode":"fn view_definitions_roundtrip(v: &[ViewDefinition]) -> bool {\n    v.to_recording_json()\n        .and_then(|j| <Vec<ViewDefinition>>::from_recording_json(&j))\n        .map(|r| r.len() == v.len())\n        .unwrap_or(false)\n}","typeGuard":"fn is_valid_recording_json(j: &serde_json::Value) -> bool {\n    j.is_object() && j.get(\"definitions\").map_or(false, |d| d.is_array())\n}","tryCatchPattern":"match <Vec<ViewDefinition>>::from_recording_json(&json) {\n    Ok(v) => v,\n    Err(e) => { log::warn(\"view definition replay decode failed: {e}\"); Vec::new() }\n}","preventionTips":["Keep ViewDefinition fields in sync with its recording JSON impl after any struct edit.","Pin AdapterType serde representation in replay tests.","Version recordings and reject mismatches early."],"tags":["rust","serialization","roundtrip","view-definition"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}