GeezerVison is showing github.com — id: protocol v1 phase 4 — retention and compaction for the event store (#2036) · Issue #3797 · developing-today/code
id: protocol v1 phase 4 — retention and compaction for the event store (#2036) #3797DescriptionPhase 4 of the #2036 protocol v1 synthesis, from the #2034 investigation (§7): pkgs/id event_store today keeps every verified event forever (event_store/mod.rs:4-23 — no TTL/compaction/GC). Implement the first per-class retention/compaction path: live-class segments compact to their checkpoint residue (checkpoint events + hashes remain), durable classes untouched, per the class table in doc/2026-10-29T10-45-00Z_investigation_ephemeral_live_data_retention §3/§7. Hard constraints: compaction must preserve fork proofs and waiting-pool after resolution (event_store/mod.rs:12-22). Acceptance: compaction tests per class; a compacted store still verifies chains and resolves fork proofs; durable-class events are never compacted. Activitydeveloping-today commented on Nov 1, 2026 dezren39 commented on Nov 2, 2026 🤖 Agent note · state: picked up
- Agent: OpenChamber scheduled lane (repo-worker-code)
- Session / ID: queue task 5787 (repo-health-code-pilot)
- Found via: atomic queue claim
- Task: Implement per-class event-store retention/compaction for live-class segments, preserving checkpoint residue, fork proofs, and waiting-pool resolution; durable classes remain untouched.
dezren39 commented on Nov 2, 2026 dezren39 commented on Nov 2, 2026 🤖 Agent note · parked (clarification)
- Agent: OpenChamber scheduled lane (repo-worker-code)
- Session / ID: queue task 5787 (repo-health-code-pilot)
- Resume: The task is parked until id: protocol v1 phase 1 — session header + segment checkpoint event kind (#2036) #3794 lands the signed session.checkpoint event contract on main. The preserved branch is queue/5787-3797-event-store-retention and the worktree is /home/user/git/fleet/task-5787. No source changes were made.
dezren39 commented on Nov 2, 2026 agent-note:v1 — holder: repo-worker-code (OpenChamber scheduled lane), at 2026-11-02T13:44:59Z. event: picked-up; task: 5787; queue: repo-health-code-pilot. dezren39 commented on Nov 2, 2026 agent-note:v1 — holder: repo-worker-code (OpenChamber scheduled lane), at 2026-11-02T13:45:04Z. event: parked; task: 5787; queue: repo-health-code-pilot. Blocked on #3794's signed session.checkpoint event contract landing; preserve the defined checkpoint residue rather than inventing one. Revalidate #3797/#3794 and ownership before resuming; no source or worktree changes this run. dezren39 commented on Nov 17, 2026 dezren39 commented on Nov 17, 2026 🤖 Agent note · blocked — packet defect
dezren39 commented on Nov 23, 2026
🤖 Agent note · claimed — Lane JR (archer, sandbox fix lane)
dezren39 commented on Nov 23, 2026
🤖 Agent note · blocked — platform execution-risk flag (Lane JR, archer)
- What happened: the laptop worktree for this item was created (
~/wt-lane-jr-3797, branch lane-jr-3797, off origin/main a189f9ff178), but the exec result carrying the checkout came back flagged by the platform execution-risk check. Per the standing rule from the prior holds (fleet#89, code#10367, code#12977, code#8472 plugin.disabledTools), I did not read files into execution, run git/build/test commands inside the checkout, or edit anything. Drew's standing clone approval does not clear a per-item flag.
- Premise (verified fresh before the flag): id: protocol v1 phase 4 — retention and compaction for the event store (#2036) #3797 OPEN and unimplemented; prerequisite id: protocol v1 phase 1 — session header + segment checkpoint event kind (#2036) #3794 CLOSED 2026-11-03; no live claim (latest prior notes are 2026-11-17 parks). Design:
doc/2026-11-01_design_id2036.md §4.6 + rule 8, class table in doc/2026-10-29T10-45-00Z_investigation_ephemeral_live_data_retention §3/§7.
- Prepared scope, ready to execute verbatim on approval (worked out from the store's current code, not yet written):
- New
event_store/compaction.rs in id-events: a CompactionPolicy (caller-declared live-class kinds + per-author retain_recent frontier) and EventStore::compact, running in one write transaction (atomic or no change).
- Class table per id: investigate: ephemeral live data vs the chained event graph — retention and intermittent signing #2034 §3: durable by construction —
group.*, document.*, tag.*, note.*, attestation.*, idset.*, device.*, media.*, identity, issuer.rotation, chat.anchor.v1, and session.checkpoint (design §4.6: checkpoint events are never deleted) can never be compacted, even if a policy names them live. Only policy-declared non-durable kinds (e.g. chat.message.v1, world.move) are eligible; unknown kinds are retained (fail-closed).
- An eligible event is compacted only when it is applied, below the author's retain frontier, not the author's applied head, not named in
proof_ids/proof_headers, not a dependency in waiting_by_dep, and its author holds no fork proof at all (a later fork below an existing point needs the stored bytes).
- Residue: the event's
events/bodies/groups rows are removed; its hashes row stays (that is what "checkpoint events + hashes remain" means mechanically — after resolution reads hashes), and a new lazily-gained compacted table (position → event ID, TAG_FOLD precedent, no format bump) records the residue.
decide_in learns the residue, mirroring the existing proof-header pattern ("present but never stored"): a rival arriving at a compacted position is parked (no fork proof can be written from dropped bytes, and the position is never overwritten); a backlink naming the compacted predecessor counts as linked.
- Tests per class: durable kind never compacted (even when policy-declared live), live kind compacted below the frontier and retained inside it, checkpoint events retained even when declared live; a forked author's proof still resolves after another author compacts; an event naming a compacted event in
after is still accepted (dependency resolution preserved); the author's next event still verifies and applies after compaction; reopen-the-store re-verification of all of the above.
- Key code evidence for the shape:
decide_in (ingest.rs) decides forks and backlinks from stored_at bytes, so bytes may only be dropped where the residue rules above hold; presence is hashes ∪ proof_ids (present_in, ingest.rs).
- What's needed: Drew's plain-words go-ahead for this specific item — the id: protocol v1 phase 4 — retention and compaction for the event store (#2036) #3797 compaction slice in worktree
~/wt-lane-jr-3797 — after which the slice is ready to execute as scoped above.
dezren39 commented on Nov 23, 2026
🤖 Agent note · takeover claim — Lane YO (archer, sandbox fix lane)
- Adopting: Lane JR's orphaned claim on id: protocol v1 phase 4 — retention and compaction for the event store (#2036) #3797 (JR claimed 2026-11-23T07:03Z, then hit the platform execution-risk flag at checkout and went silent; hold record 7094037925 carries the prepared scope). Drew approved this item in the 2026-11-23 07:35 CST batch approval of the former flag holds.
- Ownership check (fresh): issue OPEN, 43/43 comments read count-confirmed; newest comments are JR's claim + hold record — no other active lane claim.
- Plan: execute JR's prepared scope verbatim in
~/wt-lane-jr-3797: event_store/compaction.rs with CompactionPolicy + EventStore::compact (one write transaction), durable-by-construction class table, compacted residue table, decide_in residue handling, per-class tests. Verify, PR, merge. id: protocol v1 phase 4 — retention and compaction for the event store (#2036) #3797 closes only if its acceptance criteria are fully met.
dezren39 commented on Nov 23, 2026
🤖 Agent note · done — Lane YO (takeover of Lane JR's orphaned claim, under Drew's 2026-11-23 07:35 CST batch approval)
Landed: PR #13400, merge commit 9e5fd127e25c0895523d541a9438867042b87e5f.
What JR left: the worktree and branch were gone and zero code had been written — nothing was lost. JR's prepared scope (hold record c.7104037925) was complete and was executed as designed, with two deviations, both deliberate:
- The residue stores the event's causal edges (backlink +
after), not only its ID. The resolution's membership layer and causal order walk those edges; an ID-only residue would silently change verdicts in graphs where a group operation is reachable only through a compacted event's after list. With the edges kept, the resolution computes over exactly the graph it computed before compaction.
- One extra eligibility guard: an event carrying a membership action or a device operation never compacts (its effect lives in the group fold, not only in its bytes). This is in addition to JR's guards (durable-by-construction kinds, applied-only, below the retain frontier, never the head, no fork proof for the author, not a proof header, no waiting dependents).
Acceptance, per the issue's own criteria:
- Compaction tests per class — 10 new tests in
event_store::compaction: durable kinds never compacted even when declared live; only policy-declared kinds compact; checkpoint events retained in a mixed chain; live events compact below the frontier and stay present + applied (idempotent second pass).
- A compacted store still verifies chains and resolves fork proofs — the forked-author test (proof resolves after another author compacts; the forked author's own events never compact), the reopen test (chains, verdicts, proof, and
check_invariants after drop + reopen), and a group-membership test (roster and new messages read through residue edges).
- Durable-class events are never compacted — by construction in
is_durable_kind plus the tests above.
- Waiting-pool
after resolution preserved — an event naming a compacted event in after is still accepted and applies; events with waiting dependents are ineligible; a rival at a compacted position is parked (no fork proof can be written from reclaimed bytes).
Verification:
cargo test -p id-events on the laptop (nix develop in pkgs/id, sccache disabled): 365 passed, 0 failed (355 pre-existing + the 10 new), plus the crate's integration suites.
- Fleet dispatch re-run at the final commit
dedb93f63c9: session fp_5ffc8c4b6c0af43db58565b16a867022 succeeded (run 45202333579, Linux job ✓ 14m3s) — the full id-events suite in the fleet container.
cargo check --workspace --all-targets in pkgs/id: exit 0, zero errors.
- Clippy (repo
clippy.toml, pedantic): no findings in any touched file. The workspace clippy run still stops on pre-existing errors untouched by this change (9 expect() in id-store's lib; unwrap() in the append_list_state_machine integration test) — both present on main.
- First dispatch (run 45195756688) failed on this lane's own compile errors (four test
Node literals missing the new field; SeqNum is u32 in this workspace) — fixed and re-verified as above; recorded here rather than hidden.
Follow-up filed: #13401 — audit prune_behind_cut and range-sync advertisement against compacted residue (both predate compaction and are residue-blind; graceful today, but composing prune with compaction needs a deliberate ruling).
Closing this issue: its acceptance criteria are fully met by this landing.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|