mirror of
https://github.com/rtk-ai/rtk.git
synced 2026-09-19 07:33:17 +08:00
ee614e4c63
Parse the stream into (prologue)(file-header)(hunk)* regions before
classifying: hunk extent comes from the @@ line budget (one old-budget per
parent, so @@@ combined headers parse too), content is classified only
inside hunks, and any structural disagreement (invalid body prefix, budget
over/under-run, budget owed at EOF, malformed @@) falls back to raw
passthrough. Detector precedence is a documented total order on
condense_unified_diff_strict.
Fixes, each with its reproducer from
claudedocs/diff-classifier-review-2026-08-29.md as a test:
- SQL/Lua '-- comment' removals (--- on the wire) no longer dropped
- added '++ text' lines no longer parsed as file headers
- format-patch mbox prose and the '-- ' signature no longer counted
- +++ /dev/null deletions named by their --- side
- binary / rename-only / mode-only sections reported instead of vanishing
- --color input stripped (was: silently empty output), non-UTF-8 stdin
read lossily (was: hard error, no fallback)
- CRLF content bytes survive verbatim (split('\n'), not lines())
- b/ prefix stripped exactly once; timestamps tab-split from header names
- the '... +N more' trailer removed: it claimed truncation that never
happened (all lines were printed above it)
Fixture corpus: 13 real-producer captures (git 2.54, GNU diff) in
tests/fixtures/diff -- multi-file, -U0, -W, rename/delete/binary,
log -p, show --cc, format-patch single/series/cover, diff -u/-ru/-rN,
CRLF. Property tests: every marked body line survives to the output,
counters equal rendered lines, the fallback fires on zero corpus fixtures.
35 lines
697 B
Plaintext
35 lines
697 B
Plaintext
diff --git a/main.rs b/main.rs
|
|
index 5d804c0..0658d30 100644
|
|
--- a/main.rs
|
|
+++ b/main.rs
|
|
@@ -1,6 +1,7 @@
|
|
fn main() {
|
|
println!("one");
|
|
- println!("two");
|
|
+ println!("2");
|
|
println!("three");
|
|
println!("four");
|
|
+ println!("five");
|
|
}
|
|
diff --git a/notes.md b/notes.md
|
|
index d4d7d60..976bcb5 100644
|
|
--- a/notes.md
|
|
+++ b/notes.md
|
|
@@ -3,3 +3,4 @@ Some intro text.
|
|
---
|
|
A horizontal rule above.
|
|
increment operator: x
|
|
+++ can also start a line
|
|
diff --git a/schema.sql b/schema.sql
|
|
index bb42838..07010ac 100644
|
|
--- a/schema.sql
|
|
+++ b/schema.sql
|
|
@@ -1,7 +1,4 @@
|
|
--- users table
|
|
--- created 2024
|
|
CREATE TABLE users (
|
|
id INTEGER PRIMARY KEY,
|
|
- -- legacy column
|
|
name TEXT
|
|
);
|