Skip to main content

Module edits

Module edits 

Source
Expand description

F48 Phase B — applying an editor’s edit operations to file content.

A PURE function: (content, edits) → new content, or a typed error. No filesystem, no manifest, no gate. The gate layer reads the file and decides what to do with the result; this module only reconstructs.

Why it is pure, and why it is specified before it is used. After Phase B the gate judges a RECONSTRUCTION of the post-edit file rather than refusing to judge at all. A reconstruction that is subtly wrong produces a confident verdict on a file that never existed — and a real violation in the true post-edit content passes, because it was never in the synthesized content. That inverts Phase A’s posture silently, with everything still green. So the rules live here, pinned by tests/edit_application.rs, testable without a gate anywhere near them.

Every error is a refusal, never a fallback. A caller that cannot reconstruct the file faithfully must deny, exactly as Phase A denied when there was no content at all. The failure direction does not move.

Structs§

LineSpan
A 1-based, INCLUSIVE line range: the region of the file a family claims its target sits in.
Replacement
One replacement, as an editor’s edit tool describes it.

Enums§

EditError
Why a reconstruction could not be produced. Each variant is a deny at the gate; none of them may be absorbed into a plausible-looking string.

Functions§

apply_edits
Applies edits to content, in order, each against the RESULT of the previous one — the semantics MultiEdit documents. Atomic: any failure discards the whole application rather than returning a partially-edited file, which would match no state the editor could produce.