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
.voldocdescriptor blob and the sameDocumentExactroot node id asR0(descriptor_idandroot_nodeare copied verbatim), soR0andR1both materialize the same original bytes and neither weakensmaterialize(root) == original_bytes; - replaces only the
SEL_PAGE(p)binding in the hierarchical observation index with a newPageContentnode whose single dependency is a rawLiteralholding 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 holdspand 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§
- Edit
Report - 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.