RTree private descendant access
Status: accepted in the qualified 014045 combination, after a standalone screen against
d8635bfe951e98561d0b25703155a030d6e7054d / 005041.
The measured report
and decision record
the isolated result and residual regressions. The
combined qualification
and final comparison establish
the accepted composition. The proposal below preserves the standalone design.
Independent source review approved exact patch
7b82022cd4d74ed34bb73e408e211b33b5da8728eacff0ad93aad16572b1ae3d
and reconstructed both files from the immutable baseline.
RTree allocates every node with exactly 400 initialized payload bytes. Its compiled writer is the only producer of internal child links. The previous path repeated checked block admission on every descent, suspended-parent reload and node write. The candidate uses the same public collection-author API as Map:
- Public operation admission still verifies the live resource, Store identity, owner, kind, schema and changing metadata. Roots take checked block admission.
- Child links reached from admitted nodes use private 400-byte reads. Mutations publish private node ranges only after loading or allocating that live node; resource revisions still advance and frees remain checked.
- A live cursor frame may retain the same proof across calls only after the existing tree/revision/query checks succeed. No backing pointer or borrowed slice survives a read callback.
SearchCursor::decode is public, so its bytes can contain forged frame identities
even when the tree and revision fields match. Every decoded frame therefore
starts with its own transient admitted = false. It takes checked ownership,
incarnation and exact-size admission when reached. A successful checked load
marks only that frame; child frames discovered from its node are admitted. Older
pending decoded frames remain untrusted until individually loaded.
The proof bit is private, unencoded and excluded from logical cursor equality.
Cloning preserves the proof, while decoding never restores it. Frame entry/depth
fields use u8, with compile-time bounds for the fixed fanout and maximum depth;
this also reduces transient cursor storage. Node layout, cursor encoding,
schemas, public APIs, traversal order, node/result budgets and condensing
behavior are unchanged. No Store-specific RTree privilege or pool is introduced.
Four new focused tests cover both placements:
- Current-revision forged frames naming another resource or an undersized block, including a forged pending frame after a valid frame is consumed.
- Freed/reused block incarnations, stale live and decoded cursors, retirement and final reclamation.
- Cursor encoding/decoding and Store reopening after every tiny-budget page.
- An original in-memory cursor attempting to cross Store identities.
Existing spatial and condensing tests remain required for splitting, duplicates,
root collapse, extreme coordinates, rollback, cursor equality and budget limits.
The candidate patch and exact file hashes are in candidate.patch and
manifest.json; no build directory is included.
The screen should compare sparse point queries, full paged scans, population and mutations in both placements. Reduced node admission is a hypothesis about one cost; full scans also allocate/materialize results and cursors. Neither the earlier scan regression nor a future gain can be attributed solely to page tracking without separate evidence. Instruction intervals and storage snapshots must use the same conventions as the baseline benchmark.
The IC review notes that removing an ordinary stable header/payload pair can change overlapping memory reads and first-read behavior as well as admission CPU work. Retained reads avoid copying but still pay for actual callback touches. The exact 400-byte node extent introduces no read-ahead expansion. Full page loops share one update's access history; sparse and single-page cases are useful controls. Generated Wasm and transient allocation changes remain possible contributors even with unchanged persisted layout.