Gate P11 — Cascade-bounded lazy maintenance, payload GC and scale¶
Status: G0 passed (2026-11-20); implementation and G1–G8 pending. This records design acceptance only; P11 is not implemented. Normative contract: SPEC v1.11.0, especially SD14a, SD8.4, §3.4, §6.1 contract 17, §6.2, §6.4 (P11 supplement), §7 and §5 P11. Design and review history: ADR 0019 r0.7, accepted.
G0 — Design review and acceptance¶
The reviews did not implement anything. ADR 0019 §12 records every finding and how it was answered.
| Round | Findings / disposition | Result |
|---|---|---|
| r0.1 | two independent reviews (lazy and format; GC and layout): 7 blockers, 14 majors, 27 minors | revised in r0.2 |
| r0.2 closure | lazy: 7 of 12 closed, 5 partial, 1 new blocker, 3 new majors; GC: 4 closed, 3 closed in substance, 2 partial, 1 new blocker, 5 new majors | revised in r0.3: ChangeLog at ack, only the store drains, keep set from the op_log window, exact certificate pins |
| r0.3 second closure | lazy: 1 blocker, 1 major, 6 minors; GC: 2 majors, 6 minors | revised in r0.4: no settle in replace_kernel, no Weak<Snapshot>, dry-run presence |
| r0.4 final check | no blocker or major; two implementation notes (§3.7, §5.1 K5) | recorded |
| owner, O1–O5, 2026-11-20 | all as recommended | recorded in ADR §0.1 |
| owner review of r0.4 | ledger fail-stop; the A(base)→B temporary Pending |
closed in r0.5 |
| owner review of r0.5 | multi-entry aggregation (P1); GC-only version barrier and key header kind 2 (P2); stale confirmation text (P3) | closed in r0.6 |
| owner review of r0.6 | §3.6 rule 2 limited to variant and reason while unsettled; G3 reading synced with §3.6 | closed in r0.7 |
| owner acceptance, 2026-11-20 | accepted r0.7 | G0 passed; ADR accepted; SPEC v1.11.0 |
Owner decisions, all on 2026-11-20 (SPEC §5 P11, ADR §0 and §0.1):
- D1, cascade-bounded lazy. Lazy maintenance is cascade-bounded, which narrows the per-node selection in SPEC §P11.
- D2, Postgres. Out of P11.
- D3, GC. An explicit
ctx gc: a dry run by default,--applyto collect. - D4, layout. Measured, and adopted only if it beats the threshold.
- O1, lazy default. Lazy is on by default.
Eis fixed in milestone 1 from the measured unit rate, aiming at a cascade ack of about 50 ms. - O2, read wait.
read_settle_ms = 50; Advisory reads do not wait. - O3, GC grace.
keep_epochs = 10,000, with a floor of 100. - O4, disk reclaim. Offline, with
ctx gc --compact. - O5, mirrors. E4 is amended: GC does not raise
PayloadGone, and a collected mirror body is verified by its hash and front matter.
Gate status and required evidence¶
| Gate | Status | Required evidence |
|---|---|---|
| G0 | passed | ADR 0019 r0.7, the owner reviews closed, owner acceptance, SPEC v1.11.0 |
| G1 | pending | fmt, clippy with -D warnings, workspace tests and dependency checks under SPEC §4 |
| G2 | pending | T61, S13-rows-e2e (StructuralUnknown), T67, extended T107, the new goldens of ADR §9 |
| G3 | pending | PROP1-lazy at 10,000 seeds; the §6.4 validate contract and its companion property; PROP2/2b on settled diffs, PROP11 on settled states, PROP10 on mixed format-6/7 logs; PROP20; mutation coverage of the P11 code |
| G4 | pending | fuzz of the format-7 frame result, the GC ledger and the kind-2 key header; kill points (deferred commit, idle drain, settle-time projections, --apply (a)–(c) including poison and reopen, --compact, the version barrier); the v0.4.1 downgrade golden |
| G5 | pending | the budgets below, measured on the local baseline machine |
| G6 | to be set by the owner | SPEC §4.1 requires an end-to-end scenario and, from P4 on, real-agent dogfooding. ADR 0019 §9 does not define one; the owner sets it before milestone 6 |
| G7 | pending | regressions of earlier gates, P9 and P10 included; team accept stays eager |
| G8 | pending | README, setup, CHANGELOG, threat model (collected payloads, rollback past GC, mirrors over collected history) and an independent implementation review |
G0 claims no implementation, migration or performance evidence. Format 7 and protocol 9 are planned contracts; the released v0.4.x (v0.4.2 at present) remains format 6 / protocol 8 until P11 is implemented and released.
G5 — Budgets¶
Initial budgets, calibrated at the gate. All measurements are at 1M revisions on the local baseline machine. The remote baseline in ADR §1.3 is informational only.
- P1 budgets on multi_support and hub.
- Cascade commit ack (store, file projections) ≤ 150 ms on hub and chain with the default
E. - Total settle time ≤ 1.25 × eager.
- A deferred cascade's op_log frame ≤ 1 KiB.
- Reported:
- seeding time for a base toggle and for a SetHead on a record that 10⁵ rules cite through Sem;
- the next commit's ack after a cascade, with and without an idle gap;
clone_fallbacks;- the fraction of Certified reads that answer StructuralUnknown, on hub and chain;
ctx gcphase 1 and phase 2 times;- reopen time.
Layout candidates (ADR §6) are A1 radix heap, A2 packed rows and A3 pending vectors. Each is measured alone against the post-milestone-1 code on multi_support, hub and chain at 1M, 5 runs each. The noise band is the baseline's max/min spread.
A candidate is adopted only if:
- it is ≥ 15 % better on live heap or on cascade/settle time, outside the band;
- no metric is > 5 % worse outside the band;
- P1 and PROP1-lazy stay green.
Rejected candidates keep their numbers here.
Test traceability¶
| Tests | Contract |
|---|---|
| T61 | STRICT consumers never get a positive verdict eager would not give; the §6.4 validate contract (A(base)→B, multi-entry B/C, issue/validate across a frontier, strict, expect_certificate, require_certified merge, gate) |
| S13-rows-e2e | StructuralUnknown through ctxd with a hub cascade and a small E |
| T67 | PROP10 and keep-set readability after --apply and --compact; Collected; MissingBlob and re-staging; crash points; mirrors over collected history; team catch-up; ctx reindex |
| T107 | MissingBlob on collected contents for the §6.2 ops; the team catch-up exemption |
| PROP1-lazy | lockstep with eager Counting, FullRecompute and the oracle under random E, C, settles and idle slices; settledness soundness |
| PROP20 | GC at random points, with re-staging, §6.2 ops, forks, sessions, held snapshots and reopen |
Implementation plan¶
These milestones (ADR §9) organise the work. G0 marks none of them complete.
- Core. Interleaved pass, units, chunks, frontier, ChangeLog at ack, incremental history, settledness,
dimensions, theKernel::run/dryassertions and eager dry runs. Then PROP1-lazy. Measure the unit rate and fixE(O1). - Store. Format 7 and mixed-format scanning,
Store::settle, settle-time projections, thechangescap and group ending. - ctxd. Idle drain, pull, publication generation,
Drainsteps, mirror export settlement, responses and protocol 9. Then T61 and S13-rows-e2e. - GC. Keep set K1–K5, the two-phase step, the ledger and key positions, re-staging, §6.2 and team catch-up, compact, mirrors and the CLI. Then T67 and PROP20.
- Layout ablation and G5.
- Gate evidence and docs.
Milestone 1 — Core lazy maintenance¶
Implemented (contextdb-core):
- One pass. The counting pass and the L1/L2 status walk run as one interleaved, resumable pass (
lazy.rs). Eager commits run the same code to the end. - Frontier. It lives in
Db, andDb::draintakesUnits,RankorFull. - At ack. The ChangeLog is recorded and the epoch's history transition is opened. Changes are appended as nodes settle.
- At full drain. The transition is put in eager order. The derived-snapshot patch, the statistics (including
CommitStats.units), DA5 and the rebuild check also run then. - Settledness.
Db::settledis the cursor test plus a backward search of at mostS = 4,096nodes. - Unsettled reads.
Db::nodewithholds an unsettled node's state.current_l0returnsOption<bool>. WHY, WHY_NOT anddiffat the frontier epoch returnTxError::Unsettled.Snapshot(e)at the frontier epoch takes the head from the inputs. - Refusals.
Dbcommits,Db::dryandKernel::runrefuse a frontier withTxError::Unsettled; debug builds panic.
One clarification of ADR §3.2. A fan-out entry counts as one unit when it is examined, not only when it is newly marked. Otherwise a node whose downstream incidences are already dirty could loop over its whole row without spending its budget. Seeding still counts only marks and pushes.
Unit rate and E (O1). Measured with p11_cascade 1000000 3 <E> 1 on the local baseline machine (core only; informational, not G5 evidence). Each cascade is a base toggle of revision 0 on a 1M-revision shape and runs about 13.0M units.
| Shape | Eager commit | Units/ms (whole commit) | Ack at E = 750,000 | Ack at E = 1,000,000 | Ack + drain at E = 1,000,000 |
|---|---|---|---|---|---|
| hub | 1086–1193 ms | 10,896–11,970 | 31.9–47.5 ms | 43.1–63.5 ms (one 63.5 ms run, the rest ≤ 44.0 ms) | 1079–1196 ms (one run 2179 ms) |
| chain | 687–798 ms | 16,289–18,921 | 36.1–51.2 ms | 46.8–48.3 ms | 673–692 ms |
The first slice runs faster per unit than the whole commit, because it is mostly the cheap fan-out. E is fixed at 1,000,000 units (LAZY_BUDGET), which puts the core ack at about 43–48 ms (target ≈ 50 ms). The store's frame and projections come on top of this; G5 measures them in milestone 5.
Tests.
p11_prop1_lazyis PROP1-lazy at 10,000 seeds. It runs in lockstep with eagerCounting,FullRecomputeand the oracle, with randomE,Cand drains.p11_lazy_goldenscovers:- a hub that pauses in fan-out, with an unrelated node still settled;
- the chain S-bound case;
- P-1 through a Sem head;
- commits and dry runs refused while a frontier exists;
diffand WHY waiting for settlement.- On 1,000 seeds, 3,770 of 12,000 commits were deferred, with 7,059 drain slices and 19,316 unsettled reads checked.
- A deliberate fault, treating nodes up to 3 ranks above the cursor as settled, failed the property at seed 0.
Results. The full workspace (cargo test --workspace --all-features --locked --no-fail-fast) ran on the remote Linux host: 183 test binaries, 917 tests passed, 0 failed. PROP1-lazy took 48.6 s and the goldens 11.0 s.
Deferred to later milestones. The validate early return and T61 are M3; until then validate only ever answers negatively for an unsettled entry. The settledness memo in the published snapshot and the Kernel-level lazy commit and drain are M2/M3. The Kernel::run refusal is in place, but no kernel test can create a frontier yet.
Milestone 2 — Store¶
Implemented (contextdb-store, plus the Kernel lazy API in contextdb-core).
op_log format 7.
- A frame body gains settling after client_hash. A settling frame holds exactly the acknowledged result, whose l0_flips and status_diff are empty.
- Format-6 segments stay as they are. Each frame decodes with its segment's format, and every checksum is read from the frame instead of recomputed by re-encoding.
- A segment of a lower format than the one before it is refused (ChainBroken, SegmentHeader).
- migrate, the migrate5 check and doctor's repair plan read logs that mix format 6 and format 7.
- ctx migrate 5 → 6 still writes format 6, so migrated checksums are kept.
- Kernel snapshots keep their own format 6, because their layout did not change.
- ctx ui takes a settling frame's diff from its replay.
Version barrier. A commit appends only to a current-format segment. The first commit after the upgrade rolls over to a new format-7 segment, synced before any frame. An empty older-format tail segment is rewritten in place under the same name.
Kernel. commit_detailed_lazy, frontier and drain. drain returns the settled diffs with global ids. Merges and the sole ops stay eager.
Store.
- OpenOptions.lazy (off by default; ctxd turns it on in milestone 3), Store::drain, settle, take_settled and frontier_epoch.
- The deferred commit's context is its own op_log frame: drain reads the frame back when the epoch settles and writes that epoch's projection rows from it, so the store holds no extra state.
- settle runs before each group's idempotency check, and in what_if_detailed, impact_exact and snapshot. It never runs in replace_kernel.
- A commit that leaves a frontier ends its group: the writes after it get no result and are submitted again.
- Open replays eagerly. For a settling frame it compares only the input-level result (epoch, allocations, net_delta, trailer).
- changes serves up to the last settled epoch, without Truncated.
Open for milestone 3.
- TxnStatus and commit responses do not yet carry settling; the flag is on the row (LogRow.settling).
- ~~Daemon readers of a frame's stored diffs see empty diffs on settling frames.~~ Checked in milestone 3: these readers use only net_delta and allocations, which a settling frame records exactly.
Tests.
- p11_store (8 tests) covers:
- a lazy ack whose frame is settling and at most 1 KiB, with the projection watermark at e−1 and changes without Truncated, and whose settle equals an eager store, diff_log included;
- the group ending;
- the idempotent retry of a settling commit;
- a crash before settlement;
- a format-6 log continuing in a format-7 segment with its old checksums unchanged, read by migrate and doctor;
- an empty format-6 tail segment;
- the refusal of a format-6 segment after a format-7 one;
- dry runs and snapshots settling first.
Results.
- During the work, mutations confirmed that the tests catch a missing rollover, a full compare of settling frames, a missing settle and checksums recomputed by re-encoding.
- The full workspace run on the remote Linux host (--no-fail-fast): 184 test binaries, 925 passed, 0 failed.
Milestone 3 — ctxd¶
Unit A, certificate validate (794aa97).
- validate_certificate_at decides once which required heads are settled. Settled heads keep the eager path. An unsettled head gives only its input-level result (Denied, Invalid{Changed}, Conflicted) or Pending.
- Lag is computed over settled heads only.
- The Ambiguous/vector′ recompute runs only when every head is settled.
- summary_at does not evaluate observation lag for an unsettled node.
- Tests in p11_validate:
- the owner's A(base)→B and B/C cases, N1 strict, issue on an unsettled entry, and issue/validate across a frontier;
- the validate-contract property (rules 1–3, 10,000 seeds). Run against the milestone-2 cert.rs it fails, because stale rules came from an unsettled head.
Unit B, the actor (07c8b53).
- The store records Step::{Commit, Drain} in execution order, and the spare replays them with the same budget.
- While a frontier exists, replace_kernel's debug check compares inputs and a frontier signature.
- The actor:
- runs an idle drain of E units when nothing is queued;
- serves Message::Settle;
- publishes after any step;
- requeues writes behind a settling commit at the head of its queue;
- keeps a publication generation, which wait_generation and pull use;
- lets the ctx_changes long poll wait on that generation.
- <data>/ctxd.toml [maintenance]: lazy (default on, O1), lazy_budget, read_settle_ms (default 50).
- Protocol 9: Committed and TxnStatus carry settling.
- Tests in p11_actor (8): ack and idle settle, the pull, FIFO requeue, 12 mixed rounds with 0 replay mismatches, retries, lazy = false, and an invalid config.
Unit C, read paths.
- One pull helper in service.rs. It runs the read on a snapshot. If the read needs unsettled nodes, it drops the snapshot, sends Settle up to their maximum rank (or to the end) and waits for a newer publication generation, then runs the read again. Side effects happen once, on the final snapshot.
- Deadlines:
- Certified reads, certificate issue and validate: read_settle_ms.
- Advisory reads send Settle without waiting.
- The hook gate and the pre-push range check: 250 ms, half the hooks' default 500 ms timeout.
- Mirror export: 30 s, the request timeout.
- WHY, WHY_NOT and DIFF at the frontier epoch answer Settling{epoch} on timeout. Mirror export never renders from a snapshot with a frontier. A TxError::Unsettled that still reaches a response becomes Settling.
- Tests in p11_reads (7) cover S13-rows-e2e (StructuralUnknown) and T61 through ctxd:
- ctx_check is never Valid on an unsettled entry, and with the pull it answers the eager verdict;
- the hook gate's check, expect_cert_valid and a require_certified merge;
- WHY, DIFF and mirror export, during and after a frontier.
- The tests that check a completed pull use a 10 s read_settle_ms, so that the pull finishes on a loaded host. With the 50 ms default a debug build under parallel load once answered Pending; the release default is for the release daemon.
Owner decisions (2026-11-25). The owner confirmed the hook gate and pre-push deadline of 250 ms and the mirror-export deadline of 30 s (SPEC v1.11.1, SD14a).
Open.
- Advisory reads other than ctx_read and ctx_recall (briefing, updates, drift) send no Settle; the idle drain covers them.
- A response envelope's epoch is that of the request's first snapshot.
Results. The full workspace ran on the remote Linux host (--no-fail-fast): 187 test binaries, 949 tests passed, 0 failed. p11_reads took 49.2 s, p11_actor 1.4 s and p11_validate 73.0 s.
Milestone 4 — Payload GC¶
U2, core (38730ad).
- One helper, txn::live_again, refuses MissingBlob{content} for SetHead{new}, AssertBase, every AddRule member, Rebind{to} and MirrorAttach of an existing revision. It runs on both the staged and the fast path.
- It also refuses a merge that makes a collected revision a head, a base or a rule member on the target. Bases are an addition beyond ADR §5.4's list: a merged base = true revives a revision exactly as AssertBase does. SPEC §6.2 was updated.
- Exempt: Channel::Replica, shredded contents (P9 rules), and a batch that carries the content itself.
- WHAT_IF and IMPACT take the store's presence: everything counts as present, but a collected content still refuses, so a dry run and its commit agree. Replay keeps AllPresent.
U1, store (296e6c6).
- Key log. Key positions are (segment, byte offset). Header kind 2 adds collect_generation.
- Ledger. gc/ledger holds (content, key_pos, generation, cutoff, now) records. A live key is one that no ledger entry names. Reads go Shredded → live record → Collected → Missing.
- Two phases.
- gc_plan runs on a snapshot: K1 from every branch and sync state; K2 from artifacts, metas and notes (a log scan) and the nested document hashes; K3 from the frames in (cutoff, e0].
- gc_apply runs in the actor: settle, re-check (e0, now], the pinned set (K4) and the held bound (K5); then the version barrier, the ledger append and sync, the pack index update and the key rewrite.
- Failures. Any error after the ledger append starts poisons the store; reopen re-applies complete entries.
- Compaction and truncation. Offline compact writes compact/*.new and renames it over the pack segment. It also writes a new ledger generation, prunes snapshots and checks PROP10. doctor refuses a truncation below the GC cutoff without force.
- The nested decoder runs on K2 payloads only. ReviewDoc is an artifact payload, and decoding every K1 revision would decrypt the whole store in phase 1.
U3, ctxd and CLI.
- K5. A HeldEpochs multiset, with a drop guard on every published and spare Snapshot. Its lock is a leaf lock, and it keeps no Weak.
- K4. The vector and entries revisions of every certificate ctxd keeps: session certs, root proofs, the session cert, pending handoffs, and up to 256 recently ended sessions.
- The request. Request::Gc{keep_epochs, apply} (protocol 9, store owner only).
- A dry run reports the cutoff and its cause (keep_epochs or a held snapshot), the collectable count and bytes, and the kept counts.
- --apply runs phase 1 on the connection thread, then phase 2 as one exclusive actor step. On PlanOutdated it plans once more.
- Projections. vectors, jobs and candidates each purge with their own collected_through mark, after every apply and at start.
- nested. docs::nested_hashes; its test classifies every document field.
- Config. [gc] keep_epochs: default 10,000, floor 100.
- CLI.
- ctx gc [--apply] [--keep-epochs N].
- ctx gc --compact runs offline and refuses while ctxd holds the lock.
- ctx doctor counts unavailable payloads by reason and reports a Collected head as a problem. --truncate-before … --force overrides the GC-cutoff guard.
- ctx team status reports a Collected mirror head.
- Team catch-up. It now re-stages the replica's bytes for a SetHead or AssertBase naming an existing collected revision.
U4, mirrors.
- The failure, as found. At 296e6c6, payload_gone and the export refusal already checked only shredded contents. The failure was in validate: re-rendering an old tip turned a collected body into a placeholder, so after GC any cache miss became MirrorModified.
- The fix. render_at now fills each collected body from the tip's own tree. It accepts a blob only when blake3(body) == content and its front matter equals the re-rendered one.
- The clean-cache mark includes the GC generation.
- --rebuild refuses a collected head with an error naming its path. A current head is always in K1; it can read Collected only after a team catch-up whose replica lacked the bytes, which doctor also reports.
Tests.
- p11_collected (10).
- p11_gc in the store (8). It includes PROP20 at 1,000 seeds and a check that reviving a collected revision through the store's presence refuses until the bytes are staged again.
- p11_gc in the daemon (2): T67 through ctxd with K4 and K5, MissingBlob on commit and WHAT_IF, supersede back to the old text, compaction and restart under PROP10, and the keep_epochs floor.
- p11_gc_cli (1).
- p11_mirror (5).
- p10_team, with a catch-up re-staging test.
- Mutation runs during development showed each listed check is load-bearing: K3, the open-time key drop, merged bases, the catch-up fix, and the mirror's fill, hash and front-matter checks.
Open.
- The embedder can still write a vector for a content that a GC collected moments earlier; no later purge removes that row. Harmless: the row is never read for a collected head.
- ctx reindex does not clear vectors or candidates, so T67's reindex comparison is weak.
Results. The full workspace ran on the remote Linux host (--no-fail-fast): 192 test binaries, 979 tests passed, 0 failed.
Milestone 5 — Layout ablation and G5¶
Harness. Build with cargo build --release -p contextdb-bench --bins. Every run prints one line, ending in errors=N, and exits 1 when N > 0. An error is a failed operation or a failed work check; stderr describes each one. A line that does not end in errors=0 is not evidence.
- Ablation, one shape per process:
p11_ablation <multi_support|hub|chain> [n=1000000] [samples=1000], on aDb<Counting, CommitStats>with the generator dropped. load_ms: the load.live_heap_B_per_incidence: live requested heap (stats_alloc, ascontextdb-bench) per shape incidence, after the commit samples.commit_p99_ns:samplesSetRuleEnabled commits near the tail, each a real change. Hub and multi_support use the P1 choice. Chain disables tail rules downward and enables them upward, so each chain commit flips one node; hub and chain check exactly one L0 flip per commit.why_depth3_p99_ns: WHY at depth 3 on the same revision after each commit.cascade_eager_ms: median of 3 retractions of revision 0's base.cascade_lazy_ack_ms,cascade_lazy_drain_msandcascade_lazy_total_ms: the same toggle with the defaultBudget, drained withDrain::Full, median of 3.lazy_deferredcounts the toggles that left a frontier.- Work:
unitsof the eager cascade, itsstatus_diffandl0_flips, the shape'sincidences, andcommit_flips. Each cascade's L0 flips must equal a count computed from the generated batches alone. The lazySettled.status_diffmust equal the eager one, and so must itsunits. - Interleaved runs:
scripts/p11-ablation.sh run <results> <runs> base=<path/to/p11_ablation> cand=<path>…. For each run and shape, the script runs the binaries in the order given (A, B, A, B, …). It appends each line prefixed by<label> run=<k>, with anuptimeline before each process. It refuses to start while the 1-minute load average exceeds half the cores;--forceoverrides that.scripts/p11-ablation.sh summary <results>prints, per shape, metric and label, the median, min, max and max/min, and the error and failed-run totals. The noise band is the baseline's max/min. - G5, one item per process:
p11_g5 <item> [n=1000000] [hub|chain]. Stores use file projections andStdDiskwith full sync, as ctxd opens them; the daemon items start ctxd in process with the default[maintenance]. cascade: the store's ack of a base retraction (ack_ms,ack_max_ms), its op_log frame (frame_max_bytes),settle_ms, andtotal_ms = ack + settleagainsteager_ms, the same toggle on the store opened eager. Each of the 3 samples reopens the store lazy, then eager. The line prints the three budget verdicts. Work: the projection's diff rows for each settled epoch must equal the shape's flips.seeding: the ack ofDb::commit_lazywithBudget { units: 1, .. }for a base toggle on the shape (base_seed_ms) and for a SetHead on a record that 10⁵ rules cite through Sem (sem_seed_ms). Work: the drained diff equals the expected flips and an eager copy's diff, and the Sem SetHead changes at least 10⁵ statuses.next_ack:cascade_ack_ms, then a small write's ack right after a cascade (next_ack_ms), and after the idle drain finished (idle_drain_ms,next_ack_after_idle_ms). It also reportsclone_fallbacks,requeuedandreplay_mismatches; a mismatch is an error.structural_unknown: 5 cascades. During each, up to 200 Certified reads of randomshape/krecords.structural_unknown_fractionis the share that answered PENDING(StructuralUnknown), next tocertifiedandnot_certified_other. Any other answer is an error.gc: n revisions, 25 % of them superseded, then a 10,000-epoch keep window.gc_plan_msis phase 1 andgc_apply_msis phase 2. Work: the candidates and the collected payloads must equal the superseded count, with none rechecked out.reopen:reopen_ms, theStore::opentime after the load and 3 cascades. The reopened epoch must equal the epoch before.- Both binaries take an optional
E(andp11_g5aread_settle_ms) after the listed arguments, so a small smoke run can defer a cascade. Measurement runs leave them at their defaults.
Layout ablation (ADR 0019 §6), 2026-11-25¶
How it was measured.
- scripts/p11-ablation.sh on the local baseline machine, at 1M revisions, on multi_support, hub and chain.
- 5 runs per label, with the binaries alternating run by run.
- Each process records the 1-minute load before it starts. The raw lines are in p11-ablation/ and the attempts in p11-ablation/decision.tsv.
- Every line reports errors=0. Lazy and eager agree on units and diffs, and the L0 flips equal the count expected from the shape.
- The noise band is the baseline's max/min spread.
Round 1 (base, A1, A2, A3 interleaved; load before each process: median 4.77, max 23.59):
| Candidate | Gain (median) | Regression | Verdict |
|---|---|---|---|
| A1 radix heap (44fd484) | eager cascade hub 1068.5 → 935.7 ms (−12.4%), multi_support −11.7% | chain drain 658.5 → 696.4 ms (+5.8%), outside the band | rejected: below 15%, and one regression past 5% |
| A2 packed rows (c82d7ec) | live heap hub 189.09 → 186.43 B/incidence (−1.4%) | none outside the band | rejected: far below 15% |
| A3 pending arena (4866184) | eager cascade hub 1068.5 → 794.0 ms (−25.7%), multi_support −26.4% | live heap hub 189.09 → 222.65 (+17.7%), multi_support +19.5%, chain +9.9% | rejected as built; refined |
Round 2: A3′ (16203b3) frees the arenas between passes (load median 3.69, max 7.52). - Gains: live heap equal to base; eager cascade hub 1009.6 → 772.8 ms (−23.5%). - Regression: chain commit p99 1833 → 3083 ns (+68%), against a base band of 15%. Every small commit allocated and zeroed a page directory and its pages. - Rejected; refined again.
Round 3: A3″ (d8109a6) keeps a bounded cache (≤ 8 index pages and ≤ 4,096 nodes per arena, at most about 293 KB per Db) (load median 3.32, max 8.30):
| Metric | base | A3″ | Δ | Base band |
|---|---|---|---|---|
| eager cascade, hub / multi_support / chain | 1021.7 / 1426.9 / 692.8 ms | 757.6 / 1068.3 / 618.2 ms | −25.8% / −25.1% / −10.8% | 3.5% / 1.5% / 0.6% |
| lazy total, hub / multi_support / chain | 1026.6 / 1453.2 / 699.9 ms | 765.2 / 1071.2 / 627.9 ms | −25.5% / −26.3% / −10.3% | 2.5% / 3.5% / 1.2% |
| lazy ack, hub / multi_support / chain | 38.06 / 47.08 / 48.51 ms | 5.91 / 16.06 / 42.44 ms | −84% / −66% / −13% | ≤ 8.4% |
| live heap B/incidence, hub / multi_support / chain | 189.09 / 182.35 / 506.68 | 189.18 / 182.44 / 506.95 | +0.05% | — |
| commit p99, hub / multi_support / chain | 1541 / 1458 / 2125 ns | 2042 / 2209 / 2500 ns | +32% / +51% / +18% | 94% / 58% / 45% |
| WHY depth3 p99 | unchanged within the band |
Adopted: A3″. It is about 25% faster on cascades and settling, outside the band, and no metric is worse beyond its band.
- Caveat. Small-commit p99 rises on all three shapes, by 0.4–0.75 µs, each time inside the band. The same direction every time suggests a real cost, inferred to be the 4 KiB zero write per touched index page. It leaves P1's commit budget (p99 ≤ 1 ms) about 400 times over.
- The ack speed-up on hub and multi_support (inferred, not profiled): the first slice is mostly the hub's fan-out marks. Each mark was a B-tree insert plus a fresh Vec, and is now an append. Chain, which has no wide fan-out, gains only 13%.
- A1 and A2 are not adopted. Their numbers stay here as ADR §6 requires.
The full workspace with A3″ ran on the remote Linux host (--no-fail-fast): 194 test binaries, 982 tests passed, 0 failed.