rtk-ai/rtk · error
fixture listed in CORPUS
Error message
fixture listed in CORPUS
What it means
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.
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.
Example fix
// before
.expect("fixture listed in CORPUS")
// after
let fixture = CORPUS.iter().find(|(n, _)| *n == name)
.unwrap_or_else(|| panic!("fixture {name} missing from CORPUS")).1; Defensive patterns
Strategy: validation
Validate before calling
// verify all loop names exist in CORPUS before running
for name in NAMES {
assert!(CORPUS.iter().any(|(n, _)| n == name), "{name} missing from CORPUS");
} Type guard
fn corpus_fixture<'a>(corpus: &'a [(&'a str, &'a str)], name: &str) -> Option<&'a str> {
corpus.iter().find(|(n, _)| *n == name).map(|(_, f)| *f)
} Try / catch
let fixture = corpus_fixture(&CORPUS, name)
.unwrap_or_else(|| panic!("fixture {name} missing from CORPUS")); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- a bodyless region of prose must not force raw
- a table in the message must not force raw
- f.txt entry
- --format=%B must parse
- hg diff must parse
AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19).
Data as JSON: /api/errors/495634c4f3c56d4c.
Report an issue: GitHub.
Appendix: source
Thrown at src/cmds/git/diff_cmd.rs:7109
#[test]
fn metadata_heavy_fixtures_clear_the_admission_bar() {
// Pins the CONTRIBUTING.md 20% admission bar on the metadata-heavy
// corpus fixtures so the percentages cited above can't rot into
// fiction. Content-heavy fidelity fixtures (single-file `diff -u`
// shapes) are deliberately absent: their savings are input-dependent
// and only the never-larger property above binds them.
for name in [
"git_log_p",
"git_diff_multifile",
"git_format_patch_single",
"git_format_patch_series",
"git_format_patch_cover",
"git_format_patch_sha256",
] {
let fixture = CORPUS
.iter()
.find(|(n, _)| *n == name)
.expect("fixture listed in CORPUS")
.1;
let out = condense_unified_diff(fixture);
let (input, output) = (count_tokens(fixture), count_tokens(&out));
// output <= 80% of input <=> savings >= 20%.
assert!(
output * 5 <= input * 4,
"{name}: savings below the 20% admission bar ({input} -> {output} tokens)"
);
}
}
#[test]
fn test_no_truncation_large_diff() {
// Verify compute_diff returns all changes without truncation
let mut a = Vec::new();
let mut b = Vec::new();
for i in 0..500 {
a.push(format!("line_{}", i));View on GitHub (pinned to 0924356b4c)