{"record":{"id":"1428c0de72e67d75","repo":"dbt-labs/dbt-core","slug":"test-tracing-subscriber-should-be-valid-1428c0","errorCode":null,"errorMessage":"test tracing subscriber should be valid","messagePattern":"test tracing subscriber should be valid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/dbt-parser/src/resolve/resolve_macros.rs","lineNumber":675,"sourceCode":"    #[test]\n    fn invalid_markdown_doc_reports_warning_and_continues() -> FsResult<()> {\n        let tmp_dir = tempdir().unwrap();\n        let base_path = tmp_dir.path().to_path_buf();\n        fs::create_dir_all(base_path.join(\"models\")).unwrap();\n\n        let (test_layer, _, _, log_records) = TestLayer::new();\n        let subscriber = create_tracing_subcriber_with_layer(\n            tracing::level_filters::LevelFilter::TRACE,\n            test_data_layer(\n                1,\n                None,\n                false,\n                std::iter::empty(),\n                std::iter::once(Box::new(test_layer) as ConsumerLayer),\n            ),\n            &[],\n        )\n        .expect(\"test tracing subscriber should be valid\");\n\n        struct InvalidCase<'a> {\n            name: &'a str,\n            files: Vec<(&'a str, &'a str)>,\n            expected_code: ErrorCode,\n            expected_warning_paths: Vec<&'a str>,\n        }\n\n        let invalid_cases = vec![\n            InvalidCase {\n                name: \"missing_endblock\",\n                files: vec![(\"missing_endblock.md\", \"{% docs broken %}missing endblock\")],\n                expected_code: ErrorCode::MacroSyntaxInvalid,\n                expected_warning_paths: vec![\"models/missing_endblock.md\"],\n            },\n            InvalidCase {\n                name: \"duplicate_name\",\n                files: vec![","sourceCodeStart":657,"sourceCodeEnd":693,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-parser/src/resolve/resolve_macros.rs#L657-L693","documentation":"A test-only `.expect()` in the `invalid_markdown_doc_reports_warning_and_continues` test in resolve_macros: a tracing subscriber composed for capturing span events must be valid. If the subscriber setup is rejected (invalid filters/layer combination or a conflicting global subscriber), the test panics before exercising the markdown-doc warning path.","triggerScenarios":"Running macro resolution tests where the test subscriber is rejected by the tracing registry — typically due to an invalid layer/filter configuration or another test having already installed the default subscriber.","commonSituations":"Running the dbt-parser test suite in parallel or under a harness that installs its own global tracing subscriber; modifying the test telemetry layer with bad filters.","solutions":["Remove conflicting global tracing subscriber setup in the test harness","Use scoped subscribers (`tracing::subscriber::with_default`) as the test already does for events","Validate the layer/filter arguments passed to the subscriber constructor","Run the single test in isolation to identify subscriber conflicts"],"exampleFix":"// before\ntracing::subscriber::set_global_default(subscriber).expect(\"test tracing subscriber should be valid\");\n\n// after\ntracing::subscriber::with_default(subscriber, || {\n    // test body\n});","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"tracing::subscriber::with_default(subscriber, || {\n    // run macro resolution assertions inside the scoped subscriber\n});","preventionTips":["Never install a global default subscriber in tests that also use with_default","Keep test telemetry layers minimal and filter-valid","Run doc-resolution tests in isolation when tracing conflicts occur"],"tags":["rust","tracing","testing","panic"],"backgroundTag":"invalid-state-transition","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}