{"record":{"id":"e31bef612960d8b0","repo":"Hmbown/CodeWhale","slug":"entries","errorCode":null,"errorMessage":"entries","messagePattern":"entries","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/models/src/model_catalog.rs","lineNumber":278,"sourceCode":"        }\n    }\n\n    #[test]\n    fn bundled_snapshot_ttl_is_bounded_to_a_month() {\n        // A ten-year TTL made staleness unfirable and shipped a frozen list\n        // as current (audit A2). Thirty days is the ceiling.\n        let bundled = bundled_catalog();\n        assert!(\n            bundled.ttl_secs <= 2_678_400,\n            \"bundled ttl_secs {} exceeds 31 days\",\n            bundled.ttl_secs\n        );\n    }\n\n    #[test]\n    fn stale_bundled_snapshot_still_resolves() {\n        let bundled = bundled_catalog();\n        let some_model = bundled.entries.keys().next().cloned().expect(\"entries\");\n        let past = bundled.fetched_at + Duration::seconds(bundled.ttl_secs as i64 + 60);\n        let catalog = MergedCatalog::from_sources(BTreeMap::new(), None, bundled, past);\n        assert!(catalog.bundled_stale());\n        assert!(\n            catalog.resolve(&some_model).is_some(),\n            \"offline fallback must keep resolving\"\n        );\n    }\n\n    #[test]\n    fn bundled_snapshot_parses_and_is_nonempty() {\n        let bundled = bundled_catalog();\n        assert_eq!(bundled.schema_version, 1);\n        assert!(!bundled.entries.is_empty());\n        assert_eq!(\n            bundled.entries[\"deepseek-v4-pro\"].provenance,\n            MetadataProvenance::Bundled\n        );","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/models/src/model_catalog.rs#L260-L296","documentation":"The `stale_bundled_snapshot_still_resolves` test calls `bundled.entries.keys().next().cloned().expect(\"entries\")`, panicking if the compiled-in bundled catalog has zero entries. The bundled catalog must always ship at least one model for the offline fallback to be meaningful, so an empty map is treated as a build/data error.","triggerScenarios":"Running the test when `bundled_catalog()` returns a `MergedCatalog` with an empty `entries` map — e.g. the bundled catalog generation step produced no models (empty/missing source data, a build script change, or a filtered-out provider list).","commonSituations":"Regenerating the bundled catalog from a source file that was emptied or renamed; a build script silently failing to embed catalog data; a refactor changing the entries field type so the generator writes elsewhere.","solutions":["Regenerate or restore the bundled catalog data so it contains at least one entry","Check the build script / codegen that populates `bundled_catalog()` for silent failures","Inspect `bundled_catalog().entries.len()` in a debug print to see why it is empty","If the catalog legitimately can be empty in some build, assert with a skip instead of expect"],"exampleFix":"// before\nlet some_model = bundled.entries.keys().next().cloned().expect(\"entries\");\n// after\nassert!(!bundled.entries.is_empty(), \"bundled catalog must ship entries\");\nlet some_model = bundled.entries.keys().next().cloned().unwrap();","handlingStrategy":"validation","validationCode":"let bundled = bundled_catalog();\nif bundled.entries.is_empty() {\n    panic!(\"bundled catalog is empty; check the generation step before running resolution tests\");\n}","typeGuard":null,"tryCatchPattern":"let some_model = match bundled.entries.keys().next() {\n    Some(k) => k.clone(),\n    None => panic!(\"bundled catalog empty — regenerate catalog data\"),\n};","preventionTips":["Add a build-time (build script) assertion that the generated bundled catalog is non-empty","Regenerate the bundled catalog after touching its source data and eyeball the entry count","Keep a unit test asserting `!bundled_catalog().entries.is_empty()`"],"tags":["rust","test","catalog","offline-fallback"],"backgroundTag":"empty-result-set","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}