{"record":{"id":"2b94795cbd0ddf37","repo":"dbt-labs/dbt-core","slug":"query-ctx","errorCode":null,"errorMessage":"query ctx","messagePattern":"query ctx","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/query_ctx.rs","lineNumber":202,"sourceCode":"        });\n    }\n\n    /// dbt-compute usage attribution reads project/model name off the node and the\n    /// invocation id off the Jinja `invocation_id` global, the same key the BigQuery\n    /// job-label path already reads.\n    #[test]\n    fn project_model_and_run_id_are_read_for_usage_attribution() {\n        let mut model = DbtModel::default();\n        model.__common_attr__.unique_id = \"model.analytics.customer_orders_summary\".to_string();\n        model.__common_attr__.name = \"customer_orders_summary\".to_string();\n        model.__common_attr__.package_name = \"analytics\".to_string();\n        let yaml_model = dbt_yaml::to_value(&model).expect(\"model yaml\");\n\n        let mut ctx: BTreeMap<String, Value> = BTreeMap::new();\n        ctx.insert(\"model\".to_string(), Value::from_serialize(&yaml_model));\n        ctx.insert(\"invocation_id\".to_string(), Value::from(\"run-42\"));\n        with_state(ctx, |state| {\n            let query_ctx = query_ctx_from_state(state).expect(\"query ctx\");\n            assert_eq!(\n                query_ctx.project_name().map(String::as_str),\n                Some(\"analytics\")\n            );\n            assert_eq!(\n                query_ctx.model_name().map(String::as_str),\n                Some(\"customer_orders_summary\")\n            );\n            assert_eq!(query_ctx.run_id().map(String::as_str), Some(\"run-42\"));\n        });\n    }\n}\n","sourceCodeStart":184,"sourceCodeEnd":215,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/query_ctx.rs#L184-L215","documentation":"Test-only assertion in project_model_and_run_id_are_read_for_usage_attribution: constructing the query context from a DbtModel must succeed so the test can assert that project/model name and invocation id are picked up for dbt-compute usage attribution. Fires only if QueryCtx construction from a model regresses.","triggerScenarios":"Thrown at crates/dbt-adapter/src/query_ctx.rs:202 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the underlying QueryCtx construction failure revealed by this test","Run the test with output to see the actual construction error","Treat failure here as a regression in usage-attribution context building, not a runtime user error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}