Expand description
Parsing and Phase-1 safety checks for the hashline patch language.
This module deliberately separates a patch’s requested coordinates from execution. Every address is resolved against the retained snapshot before a caller plans a mutation, and exact verification compares that snapshot with one caller-owned baseline. That keeps later operations in the same patch from silently renumbering the coordinates of earlier input.
Structs§
- Baseline
- A complete Phase-1 baseline owned by one patch and one canonical path.
- Baseline
Cache - A per-patch cache that makes the one-baseline-per-canonical-path contract
explicit. Calling
load_onceagain returns the original byte buffer rather than silently replacing the evidence used by another section. - CutOperation
- Hashline
Rejection - Transport-neutral details for a Phase-1 rejection.
- Hashline
Request - The hashline edit entry point accepts exactly one argument field,
patch, while hashline validation is enabled. - Line
Span - A fully resolved inclusive span in pre-request coordinates.
- MvOperation
- Patch
- A parsed patch. Section order is patch order and must be retained by later planning and execution stages.
- Patch
Section - A per-file patch unit headed by the requested path and its snapshot tag.
- PutOperation
- Recovery
Plan - The exact records from the old addressed span that a recovery plan can use to remap the operation.
- RemOperation
- Resolved
Gap - A gap resolves to adjacent snapshot rows rather than a current live-file
offset.
Noneanchors name BOF/EOF facts retained in the snapshot. - Resolved
Operation - Resolved
Patch Section - Resolve all sections against their snapshot handles before any later apply stage can mutate a path. A canonical path may appear in several sections, but all of those sections must use equivalent verification evidence.
- Section
Header - The lossless path spelling paired with a normalized tag.
Enums§
- Address
- One parsed pre-request address.
- GapSide
- Hashline
Rejection Code - A stable pre-execution rejection code.
- Line
Reference - A reference whose value is resolved solely from
Snapshot::total_lines. - Operation
- One hashline operation. Body-bearing PUTs retain logical body lines so the apply layer can select the target file’s terminator policy after verification.
- PutSource
- Register
Ref - Named registers are durable only for the life of the session; the anonymous register is represented explicitly so it cannot collide with an empty name.
- Rejection
Stage - The one canonical Phase-1 adjudication stage enum.
- Resolved
Address - The result of resolving one parsed address against its retained snapshot.
- Verification
Outcome - The result of exact verification. An addressed-span mismatch is deliberately not a rejection: the recovery planner receives its exact old records. An anchor mismatch remains a loud verification-stage rejection because moving a gap or boundary insertion would change its meaning.
Functions§
- check_
eligibility - Prove that the retained snapshot authorizes every record and boundary fact an address will use. This is deliberately separate from exact verification: an unread row is never eligible merely because current bytes happen to match.
- expand_
block - Substitute an authoritative language-aware block span for a parsed block anchor. The supplied span is still constrained to pre-request coordinates.
- parse_
address - Parse line, range, gap, block, and EOF-relative forms without consulting a live file. Resolution happens later against a snapshot’s recorded line count.
- parse_
hashline_ patch - Parse a complete patch after raw tool arguments selected the hashline path.
Accept an optional
*** Begin Patch/*** End Patchenvelope, but reject any other preamble or trailing content instead of ignoring it. - parse_
section_ header - Parse one recognizable header and distinguish absent and malformed tags.
- resolve_
address - Resolve an address against the snapshot that minted its handle. This function
never reads filesystem state, including for
$and EOF-relative forms. - resolve_
patch_ sections - resolve_
snapshot - Normalize and resolve one case-insensitive four-hex snapshot tag using the snapshot store’s recorded result for the requested canonical path.
- validate_
raw_ arguments - Validate raw tool arguments before any legacy edit normalization can run.
- verify_
exact - Verify an already-resolved address against one common baseline. Anchor rows are checked before addressed rows so a stale gap cannot be auto-remapped.