gabriel / muse public
fix BREAKING diff task/diff-file-change-sigil #1 / 1
gabriel · 60 days ago · Apr 16, 2026 · Diff

fix(diff): use PatchOp.file_change for file-level sigil — not child op counts

The renderer inferred file status from child op direction: a PatchOp whose children were all DeleteOps was classified as 'D' (deleted), even when the file still existed in the working tree. This misled agents into treating a modified file that lost all its symbols as a deleted file.

Root cause: build_diff_ops knew which path bucket each file came from (added / removed / modified) but discarded that information, forcing the renderer to guess from children. _classify_patch_op and _op_category encoded this broken heuristic.

Fix: - Add file_change: NotRequired['added' | 'deleted' | 'modified'] to PatchOp - build_diff_ops sets file_change from the path bucket at construction time - _patch() forwards file_change to the PatchOp it wraps - _print_structured_delta reads op.get('file_change', 'modified') directly - JSON categorizer reads file_change instead of calling _op_category - Delete _classify_patch_op and _op_category (dead code) - Delete TestClassifyPatchOp and TestOpCategory (tested deleted functions) - Add 17 new tests covering the four cases (added/deleted/modified/renamed) at both unit and integration level

sha256:6aea7eaff3fd7a8d67ac602837a94e1724aed5e9140f201bc2770088d0c6d47d sha
sha256:6fbd1fcd94b73f132c7f017528f7b0bf6bf326dadf1d1b97d0c331ced57f1418 snapshot
← Older Oldest on task/diff-file-change-sigil
All commits
Newer → Latest on task/diff-file-change-sigil

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:6aea7eaff3fd7a8d67ac602837a94e1724aed5e9140f201bc2770088d0c6d47d --body "your comment"