Skip to content

Compare removal-only edits and notebook cells with the working tree (CF-5) - #328

Merged
BunsDev merged 2 commits into
mainfrom
cf5-edit-compare
Oct 19, 2026
Merged

BunsDev merged 2 commits into
mainfrom
cf5-edit-compare

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Part of #278 (CF-5), tracker #273. The claim is here. This takes CF-5's last offline items and the evidence for CF-8's "Missing artifact" row.

What changes

Compare with working tree (from #302) read two kinds of patch as "Not compared". Both are now compared, in main/engine/patch-state.ts.

  • An Edit that only removed text. Claude Code's Edit needs old_string to be unique unless replace_all is set, so after the edit that text isn't in the file. The verdict:

    • "Still has this turn's edit" while the text stays gone;
    • "Changed since this turn" once it's back;
    • "Deleted since this turn" if the file is gone.

    A MultiEdit checks its added text and its removed text together. A removal whose text another edit in the same MultiEdit puts back proves nothing, so it isn't checked. An edit with no text on either side stays "Not compared".

  • A NotebookEdit. Claude Code 2.1.302's input is notebook_path, cell_id?, new_source, cell_type? and edit_mode (replace, insert or delete, defaulting to replace); the source is the CLI's bundled tool text. The verdicts are checked in the .ipynb's cells:

    • A replaced cell must have that id and source.
    • An inserted cell must have that source. Its id isn't checked, because an inserted cell gets a new id and cell_id names the cell it went after.
    • A deleted cell's id must be gone.
    • Sources are joined from Jupyter's line list, and a final newline is ignored.
    • A delete that names no cell, or a file that isn't a readable notebook, stays "Not compared" and says why.

As before, only verdicts reach the window, and nothing is written or run.

A missing attachment. A new test pins down that opening an attachment whose file was deleted is refused ("no longer on disk") and reveals nothing. Together with the existing tests, it covers CF-8's "Missing artifact" negative variant. Those existing tests cover:

  • symlinks, .. and non-canonical paths;
  • foreign-thread ids;
  • refused URLs;
  • image symlink reads, spoofed formats and traversal.

Tests, red first

  • test/patch-state.test.ts: two tests that pinned the old "Not compared" behaviour are replaced by four new ones:

    • a removal-only Edit (holds, changed, deleted; an empty edit stays unknown);
    • a MultiEdit with a removal and an addition;
    • replaced and inserted notebook cells (holds, changed, deleted);
    • a deleted cell (holds; changed when the id is back), a delete with no id, and an unreadable notebook.

    All four failed against main (cad3e54), and all 21 tests in the file pass now.

  • test/attachment-commands.test.ts: the deleted-attachment test passed at once. It records behaviour the store already had, as evidence rather than a new feature.

Checks on 7e1d27e

macOS (Apple Silicon), Node 24.18.1, pnpm 10.34.5. The load average was about 15–22.

Command Result
pnpm build passed
pnpm typecheck passed
pnpm --filter @modex/desktop test 1,626 passed, 16 skipped of 1,642 (existing skips); second stage 21/21
pnpm --filter @modex/store-desktop test 16/16
e2e turn-patch-state, conversation-evidence, attachments 14/14

Not run locally: the full pnpm test:e2e. CI runs it.

Still open on #278

  • Structured web-search results. Codex's results are opaque JSON. There's no sample without a live Codex run, and Val has said not to make live runs for now.

Coven-Harness: Claude Code / claude-opus-5-5

Two kinds of patch read as "Not compared": an Edit that only removed
text, and any NotebookEdit.

Claude Code's Edit needs old_string to be unique unless replace_all is
set, so text an edit only removed is not in the file afterwards. It
now holds while that text stays gone, and reads as changed once the
text is back. In a MultiEdit, a removal whose text another edit puts
back is not checked.

A NotebookEdit (Claude Code 2.1.302: notebook_path, cell_id,
new_source, edit_mode) is checked in the .ipynb's cells. A replaced
cell must have that id and source, an inserted cell that source, and
a deleted cell's id must be gone. A delete that names no cell, or a
file that is not a readable notebook, stays Not compared.

Also pins down that a deleted attachment cannot be opened and nothing
is revealed, the evidence for CF-8's "Missing artifact" row.

Part of #278 (CF-5), tracker #273.

Coven-Harness: Claude Code / claude-opus-5-5
@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 19, 2026 5:56pm UTC

Request Review

Coven-Harness: Claude Code / claude-opus-5-5
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main c345779 cf5-edit-compare e4561c0 +/-
63% 63% 0%
View coverage of the 3 most impacted files.
File main c345779 cf5-edit-compare e4561c0 +/-
apps/desktop/sr...ent-commands.ts 100% 100% 0%
apps/desktop/sr.../attachments.ts 100% 100% 0%
apps/desktop/sr.../patch-state.ts 98% 99% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@BunsDev
BunsDev merged commit b71e89e into main Oct 19, 2026
13 checks passed
@BunsDev
BunsDev deleted the cf5-edit-compare branch October 19, 2026 18:30
BunsDev added a commit that referenced this pull request Oct 19, 2026
Brings in #328 (CF-5 removal-only and notebook comparison).

Coven-Harness: Claude Code / claude-opus-5-5
BunsDev added a commit that referenced this pull request Oct 19, 2026
Coven-Harness: Claude Code / claude-opus-5-5
BunsDev added a commit that referenced this pull request Oct 19, 2026
… cycle 15) (#331)

* Name what is still open for each fidelity child in status.md (steward cycle 15)

"Still open" listed only CF-4, live-provider acceptance and VoiceOver. CF-3,
CF-5, CF-6 and CF-7 dropped off as their first slices landed, but #276 to #281
are all still open. Each now names what remains, from its issue and the #273
checkpoints.

Coven-Harness: Claude Code / claude-opus-5-5

* Drop CF-5 comparison from Still open now that #328 landed it

Coven-Harness: Claude Code / claude-opus-5-5

* Rewrap the Still open line

Coven-Harness: Claude Code / claude-opus-5-5
BunsDev added a commit that referenced this pull request Oct 19, 2026
Brings in #328 (CF-5 removal-only and notebook comparison) and #331 (status Still open).

Coven-Harness: Claude Code / claude-opus-5-5

This branch was successfully deployed

1 active deployment
Preview — e4561c0e Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant