{"record":{"id":"495634c4f3c56d4c","repo":"rtk-ai/rtk","slug":"fixture-listed-in-corpus","errorCode":null,"errorMessage":"fixture listed in CORPUS","messagePattern":"fixture listed in CORPUS","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmds/git/diff_cmd.rs","lineNumber":7109,"sourceCode":"    #[test]\n    fn metadata_heavy_fixtures_clear_the_admission_bar() {\n        // Pins the CONTRIBUTING.md 20% admission bar on the metadata-heavy\n        // corpus fixtures so the percentages cited above can't rot into\n        // fiction. Content-heavy fidelity fixtures (single-file `diff -u`\n        // shapes) are deliberately absent: their savings are input-dependent\n        // and only the never-larger property above binds them.\n        for name in [\n            \"git_log_p\",\n            \"git_diff_multifile\",\n            \"git_format_patch_single\",\n            \"git_format_patch_series\",\n            \"git_format_patch_cover\",\n            \"git_format_patch_sha256\",\n        ] {\n            let fixture = CORPUS\n                .iter()\n                .find(|(n, _)| *n == name)\n                .expect(\"fixture listed in CORPUS\")\n                .1;\n            let out = condense_unified_diff(fixture);\n            let (input, output) = (count_tokens(fixture), count_tokens(&out));\n            // output <= 80% of input  <=>  savings >= 20%.\n            assert!(\n                output * 5 <= input * 4,\n                \"{name}: savings below the 20% admission bar ({input} -> {output} tokens)\"\n            );\n        }\n    }\n\n    #[test]\n    fn test_no_truncation_large_diff() {\n        // Verify compute_diff returns all changes without truncation\n        let mut a = Vec::new();\n        let mut b = Vec::new();\n        for i in 0..500 {\n            a.push(format!(\"line_{}\", i));","sourceCodeStart":7091,"sourceCodeEnd":7127,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/cmds/git/diff_cmd.rs#L7091-L7127","documentation":"Test panic from `.expect(\"fixture listed in CORPUS\")`: `CORPUS.iter().find(...)` returned `None` because the fixture name (e.g. `git_format_patch_cover` or `git_format_patch_sha256`) is not a key in the CORPUS list of `(name, fixture_content)` pairs. This is a test-suite wiring error: the loop iterates names that must exist in the corpus, and a missing entry is a hard error before any token-savings assertion runs.","triggerScenarios":"Adding a new fixture name to the loop's array (e.g. a new format-patch fixture) without adding the corresponding `(name, include_str!(...))` entry to the CORPUS constant, or renaming/deleting a fixture file referenced by CORPUS.","commonSituations":"Renaming fixture files under tests/fixtures without updating CORPUS, typo'd fixture names in the test loop, or a merge that keeps one side's list.","solutions":["Add the missing `(name, include_str!(\"...\"))` entry to the CORPUS constant for the listed name.","Fix the typo in the loop's name array so it matches an existing CORPUS key exactly.","Optionally replace the find/expect with a debug_assert or a compile-time check that every loop name exists in CORPUS."],"exampleFix":"// before\n.expect(\"fixture listed in CORPUS\")\n// after\nlet fixture = CORPUS.iter().find(|(n, _)| *n == name)\n    .unwrap_or_else(|| panic!(\"fixture {name} missing from CORPUS\")).1;","handlingStrategy":"validation","validationCode":"// verify all loop names exist in CORPUS before running\nfor name in NAMES {\n    assert!(CORPUS.iter().any(|(n, _)| n == name), \"{name} missing from CORPUS\");\n}","typeGuard":"fn corpus_fixture<'a>(corpus: &'a [(&'a str, &'a str)], name: &str) -> Option<&'a str> {\n    corpus.iter().find(|(n, _)| *n == name).map(|(_, f)| *f)\n}","tryCatchPattern":"let fixture = corpus_fixture(&CORPUS, name)\n    .unwrap_or_else(|| panic!(\"fixture {name} missing from CORPUS\"));","preventionTips":["Derive the loop names from CORPUS keys instead of duplicating the list","Grep for the fixture file path whenever renaming fixtures","Add a test asserting every name referenced in loops exists in CORPUS"],"tags":["rust","test-fixture","lookup-failed"],"backgroundTag":"resource-not-found","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}