fix(runtime): preserve Edit diffs in large files - #3652
Conversation
16f607e to
ed57aa2
Compare
eae2546 to
a600527
Compare
a600527 to
2073439
Compare
|
Reviewed the diff on The problem statement is clear: What I checked:
Clean, focused change. LGTM. |
Generate Edit previews from the known replacement span so small changes in large files retain their unified diff without running a full-file quadratic comparison. Keep both calculation and output bounded for oversized replacements. Generated-by: Codex
DiffCodePreview owns diff row classification, leaving the former tool-result helper and barrel export without consumers. Generated-by: Codex
2073439 to
2085904
Compare
jackwener
left a comment
There was a problem hiding this comment.
GO on exact head 208590409572a0bfd086108e01ca51727ad8f235; 0×P0–P3.
The Edit path now uses its already-authoritative match span to bound diff work to the changed window while retaining 3 lines of context. Window line/byte caps and a final output-byte cap make oversized replacements fall back to the existing structured Edit summary without blocking the write. A 5,000-case randomized differential application covered first/middle/last positions plus multiline insert/delete shapes; every emitted patch reconstructed the exact new content. Focused Runtime evidence passed 82/82, and reverting the three new call sites to the old full-file generator made exactly the two large-file regressions fail. Runtime/UI builds and changed-file Biome passed. diffLineKind has no remaining repository consumer, so removing its implementation and barrel export leaves DiffCodePreview as the single classifier.
Fresh gate: PR OPEN, non-draft, MERGEABLE; exact-head test and windows_sandbox_w0_protocol are completed/success; zero stale or current APPROVED reviews existed before this action; no live P0–P2 or hold. Published by the Kabi review lane under @WAWQAQ standing authorization. No merge performed.
Summary
Preserve unified diff previews when Edit makes a small localized replacement in a large file. The runtime now uses the match span already produced by Edit, so diff cost depends on the changed window instead of the full file. Oversized replacements remain bounded and fall back to the existing summary without blocking the edit.
Also removes the unused UI diff-line classifier and barrel export; DiffCodePreview is the remaining rendering authority.
The branch temporarily carries the one-line canonical storage decoder repair already present in #3633 because current main does not build without it. That prerequisite disappears from this diff when #3633 lands.
Verification
AI use
Select exactly one:
Tool(s) and scope: Codex diagnosed the diff cutoff, implemented the localized bounded diff path, removed the proven-dead classifier, and added focused tests.
Checklist
Does this PR entail a change in behavior?