Skip to main content

Module edit

Module edit 

Source
Expand description

Immutable node-level edit of a procedural field (Phase 11.12).

§The shape of the witness

A field is not a stack of unrelated whole-document snapshots: it is a content-addressed procedural trajectory. replace_page_content makes that concrete. Given an already-ingested, indexed field R0 and a page p, it installs caller-supplied bytes as the new decoded content of exactly that page and returns a new root R1 that:

  • reuses the exact same .voldoc descriptor blob and the same DocumentExact root node id as R0 (descriptor_id and root_node are copied verbatim), so R0 and R1 both materialize the same original bytes and neither weakens materialize(root) == original_bytes;
  • replaces only the SEL_PAGE(p) binding in the hierarchical observation index with a new PageContent node whose single dependency is a raw Literal holding the new content bytes;
  • carries every other selector binding forward by content id, so the new index tree shares all unchanged leaf nodes with R0 (content addressing makes an unchanged leaf hash to an unchanged id; only the leaf that holds p and the internal spine above it are rewritten);
  • and never reads the descriptor blob, never re-parses the document, and never re-bakes the old source.

The derived per-page projections (ContentOperators, TextRuns, PagePreview) are then recomputed lazily from the new content by the ordinary observation path, unchanged.

§What is shared vs copied, stated exactly

Shared by id (never re-written): the descriptor blob, the DocumentExact root, every unaffected PageContent/PdfObject/PdfStreamEncoded/ PdfStreamDecoded/PdfRevision seed node, and every index leaf that does not contain the edited page’s selector.

Copied/newly written: two new seed nodes (the Literal and its PageContent), the index leaf containing SEL_PAGE(p) and the internal spine from that leaf to a new root, and one new manifest.

§The honest supported subset

This is not generic document editing. It is a single, narrow operation: decode-level content override of one existing page of an indexed field. The exact archive is untouched, so this is a procedural edit, not a rewrite of the PDF. It makes no authorial-intent claim, offers no insert/delete/ reorder, no cross-reference or object-graph mutation, no re-encoding, and no change to any other page. The caller-supplied content is bounded by MAX_EDIT_CONTENT_BYTES (it must fit one canonical seed node). Any page whose content was overridden reports no source byte span in its index entry and no content-stream object numbers in its structure observation, because the new bytes are not present in the source; text and preview projections are computed from the new bytes as usual.

Structs§

EditReport
What one immutable edit produced.

Constants§

MAX_EDIT_CONTENT_BYTES
Maximum caller-supplied content bytes one edit may install.

Functions§

io_of
The raw physical-I/O accounting of an interval, re-exported for callers that want to attribute an edit without unpacking the report.
replace_page_content
Replace one page’s decoded content with new_content, returning a new field root; the input field is never mutated.