{"record":{"id":"94027b51d32f1ed0","repo":"Hmbown/CodeWhale","slug":"concentrate-catalog-delta","errorCode":null,"errorMessage":"Concentrate catalog delta","messagePattern":"Concentrate catalog delta","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/tui/src/client.rs","lineNumber":7717,"sourceCode":"        let server = MockServer::start().await;\n        Mock::given(method(\"GET\"))\n            .and(path(\"/v1/models\"))\n            .respond_with(ResponseTemplate::new(200).set_body_json(json!({\n                \"object\": \"list\",\n                \"data\": [\n                    {\"id\": \"claude-fable-5\", \"object\": \"model\", \"owned_by\": \"anthropic\"},\n                    {\"id\": DEFAULT_CONCENTRATE_MODEL, \"object\": \"model\", \"owned_by\": \"deepseek\"},\n                    {\"id\": \"gpt-5.6-sol\", \"object\": \"model\", \"owned_by\": \"openai\"}\n                ]\n            })))\n            .expect(1)\n            .mount(&server)\n            .await;\n\n        let delta = concentrate_client(&server, DEFAULT_CONCENTRATE_MODEL)\n            .fetch_catalog_delta()\n            .await\n            .expect(\"Concentrate catalog delta\");\n        assert_eq!(delta.provider, \"concentrate\");\n        assert_eq!(delta.offerings.len(), 3);\n        let default = delta\n            .offerings\n            .iter()\n            .find(|offering| offering.wire_model_id == DEFAULT_CONCENTRATE_MODEL)\n            .expect(\"default row\");\n        assert!(default.default_for_provider);\n        let unknown = delta\n            .offerings\n            .iter()\n            .find(|offering| offering.wire_model_id == \"claude-fable-5\")\n            .expect(\"unclaimed row\");\n        assert!(!unknown.default_for_provider);\n        assert_eq!(unknown.canonical_model, None);\n        assert_eq!(\n            unknown.cost, None,\n            \"no pricing claim from a gateway catalog\"","sourceCodeStart":7699,"sourceCodeEnd":7735,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L7699-L7735","documentation":"This .expect(\"Concentrate catalog delta\") is in crates/tui/src/client.rs:7717, unwrapping the Result of ConcentrateClient::fetch_catalog_delta() in a test that mounts a mock catalog endpoint. It panics when the client cannot fetch or parse the provider's model catalog delta.","triggerScenarios":"fetch_catalog_delta() returning Err: the mock route for the catalog endpoint is missing or returns a non-2xx body, the response JSON doesn't match the expected catalog schema, or the request fails transport-wise (client misconfigured to wrong base URL).","commonSituations":"Changing the gateway catalog response shape (renamed fields like offerings/wire_model_id) without updating the deserializer; forgetting to mount the mock before calling; provider base-URL config drift so the client hits an unmocked path.","solutions":["Read the panic's error payload: a 404 means the mock route path/method no longer matches; a serde error names the mismatched JSON field.","Compare the mounted mock JSON against the CatalogDelta deserialization types and fix whichever drifted.","Verify the client is constructed with the same base URL the mock server exposes.","Re-run `cargo test -p codewhale-tui fetch_catalog` style filters after the fix; the test then asserts provider==concentrate and 3 offerings."],"exampleFix":"// before\nlet delta = concentrate_client(&server, DEFAULT_CONCENTRATE_MODEL)\n    .fetch_catalog_delta()\n    .await\n    .expect(\"Concentrate catalog delta\");\n// after\nlet delta = concentrate_client(&server, DEFAULT_CONCENTRATE_MODEL)\n    .fetch_catalog_delta()\n    .await\n    .unwrap_or_else(|e| panic!(\"Concentrate catalog delta failed: {e:?}\"));","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// surface the underlying error instead of a bare expect\nmatch client.fetch_catalog_delta().await {\n    Ok(delta) => { /* assertions on delta */ }\n    Err(e) => panic!(\"catalog delta fetch failed: {e:?}\"),\n}","preventionTips":["Keep the catalog mock fixture and the CatalogDelta serde types in lockstep; bump both when fields change.","Mount all mocks before constructing/using the client.","Assert the client's base URL matches the wiremock server URI."],"tags":["rust","test","catalog","deserialization"],"backgroundTag":"api-error-response","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}