rtk-ai/rtk · warning
intact series must parse
Error message
intact series must parse
What it means
Test panic from `.expect("intact series must parse")`: `condense_unified_diff_strict` returned `Err` on a format-patch series that should still be parseable after a block is restored mid-series. The strict parser refuses input whose structure (bullets, separators, diffstat boundary) it cannot trust, and the test guarantees a well-formed intact series is accepted, with the restored y.txt file reported and no prose misclassified as bullets.
Solutions
- Print the parser's error message (`expect` swallows context) by replacing the expect with a match that logs `err` and the input series.
- Verify the bullet/separator tolerance logic still terminates the prose window at the diffstat line, not earlier.
- If intentionally stricter, update the test fixture to a shape the strict parser accepts.
Example fix
// before
let out = condense_unified_diff_strict(&intact).expect("intact series must parse");
// after
let out = condense_unified_diff_strict(&intact)
.unwrap_or_else(|e| panic!("intact series must parse: {e}\ninput:\n{intact}")); Defensive patterns
Strategy: validation
Validate before calling
// sanity-check the series shape before strict parsing
assert!(series.contains("diff --git ") && series.contains("@@ -1 +1 @@")); Try / catch
let out = condense_unified_diff_strict(&intact)
.unwrap_or_else(|e| panic!("intact series must parse: {e}\ninput:\n{intact}")); Prevention
- Always surface the parser's error message inside expect/panic, never a bare string
- Add every real-world series shape (kernel/b4) as a fixture
- Document where the strict tolerance window ends (diffstat, not ---)
When it happens
Trigger: Calling `condense_unified_diff_strict` with a multi-file format-patch body where inserting `diff --git a/y.txt b/y.txt ... -p +q` before an existing block makes the strict parser bail (e.g. bullet tolerance window exceeded or separator detection fails).
Common situations: Kernel/b4-style patch series with version notes and multiple diff blocks; regressions introduced when tightening strict-mode tolerance so it ends at the diffstat rather than at `---`.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- a bodyless region of prose must not force raw
- a table in the message must not force raw
- f.txt entry
- hg diff must parse
- hg export must parse
AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19).
Data as JSON: /api/errors/cafb09ce23fa3799.
Report an issue: GitHub.
Appendix: source
Thrown at src/cmds/git/diff_cmd.rs:6894
#[test]
fn mbox_marked_lines_past_the_diffstat_fall_back_to_raw() {
// A format-patch series with the second patch's `diff --git` /
// `---` / `+++` / `@@` block stripped (a hand-edited patch, a mail
// client's reflow). The orphaned hunk body sits in the mbox message
// region past the diffstat, where the prose exemption used to
// swallow it; nothing in the output suggested it was incomplete.
let series = "From fe6a6d0d8316535b5ac232f5d7cc6d227b187b9e Mon Sep 17 00:00:00 2001\nSubject: [PATCH 1/2] one\n\n- a bullet in the message\n---\n x.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/x.txt b/x.txt\n--- a/x.txt\n+++ b/x.txt\n@@ -1 +1 @@\n-a\n+b\n-- \n2.54.0\n\nFrom 0e7632a01b00c70cbc9dafcf1f23c71fa6b10de1 Mon Sep 17 00:00:00 2001\nSubject: [PATCH 2/2] two\n\n- another bullet\n---\n y.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n-p\n+q\n-- \n2.54.0\n";
assert!(
condense_unified_diff_strict(series).is_none(),
"orphaned hunk body in an mbox region was dropped"
);
// The intact series (with the block restored) still parses, bullets
// and separators included, and the signature is not counted.
let intact = series.replace(
"\n-p\n+q\n",
"\ndiff --git a/y.txt b/y.txt\n--- a/y.txt\n+++ b/y.txt\n@@ -1 +1 @@\n-p\n+q\n",
);
let out = condense_unified_diff_strict(&intact).expect("intact series must parse");
assert!(out.contains("[file] y.txt (+1 -1)"), "got:\n{out}");
assert!(!out.contains("bullet"), "got:\n{out}");
// Version notes between `---` and the diffstat (the kernel / b4
// convention) are column-0 bullets past the separator; they must
// stay prose, which is why the tolerance ends at the diffstat and
// not at `---`.
let notes = intact.replace(
"---\n y.txt | 2 +-",
"---\nChanges in v2:\n- rebased\n- dropped the hack\n\n y.txt | 2 +-",
);
let out = condense_unified_diff_strict(¬es).expect("version notes must stay prose");
assert!(out.contains("[file] y.txt (+1 -1)"), "got:\n{out}");
assert!(!out.contains("rebased"), "got:\n{out}");
}
#[test]
fn a_prose_table_is_not_a_diffstat() {
// A markdown table in the commit message is space-indented and holdsView on GitHub (pinned to 0924356b4c)