GeezerVison is showing github.com — id(world): bound every journal entry at write time by splitting the compacted checkpoint (fixes #4630) · Issue #4966 · developing-today/code
id(world): bound every journal entry at write time by splitting the compacted checkpoint (fixes #4630) #4966Labels app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DescriptionFollow-up from the design note in #4962 (doc/2026-11-03T14-55-00Z_design_id4630_oversized_replication_entries.md), which chose bounded checkpoint at write time for #4630. Implementation issue — the fix for #4630 itself; #4630 closes when this merges.
Problem
WorldCore::checkpoint_entries (pkgs/id/src/world/core.rs:1063-1200) emits the whole compacted world as one JournalEntry::Checkpoint. Nothing bounds its size:
- the program snapshot
String (passed in from world/actor.rs:275) has no WorldLimits bound (snapshot_bytes bounds only the client-facing snapshot's event selection, core.rs:2063);
- retained
events (≤ retained_events, default 1024, each ≤ input_bytes 16 KiB, hex-encoded entity inputs double that);
admin_history (≤ min(retained_events, 4096)).
One such entry over MAX_REPLICATION_PAYLOAD_BYTES (256 KiB, pkgs/id/src/world/replication.rs:79) makes split_entry_payload return PayloadTooLarge and send_snapshot (world_replication_net.rs:206-243) fail before the first frame. No other entry kind can grow unboundedly (chat ≤ 2 KiB, input ≤ 16 KiB, participant/ceiling/schedule entries small, open_presence capped at 4096 IDs), so bounding the checkpoint bounds every entry.
Required change
Split the checkpoint into bounded part entries at compaction time, mirroring the existing pre-Checkpoint entry pattern (CapsCeiling, ScheduleSet, Isolation, ExecutionProfile, transfer entries):
- new part entry kinds for the program snapshot, retained events, and admin history, each
{ sequence, part_index, part_count, ... }, split by encoded size (serde_json::to_vec of the assembled part) at UTF-8 boundaries for the string;
MAX_CHECKPOINT_PART_BYTES = 192 * 1024 — deliberately below the 256 KiB payload bound, leaving headroom for the part's scalar fields and JSON framing;
Checkpoint keeps scalars plus open_presence (≈86 KiB worst case at the 4096-ID cap, under the part bound);
- restore assembles parts for the same
sequence, refusing missing / duplicate / out-of-order / mismatched part_count parts, and applies exactly today's state;
- bump
JOURNAL_VERSION to 6 and map the new kinds in journal_version_required_by, per the existing header-bump contract (world/mod.rs:980-1060);
- keep
MAX_REPLICATION_PAYLOAD_BYTES and the envelope at v1 — no wire change, no envelope bump, no ReplicationTracker::accept change.
Constraint: a checkpoint that would exceed the part bound must be split, never skipped or truncated — compaction may not silently keep the untrimmed journal for size reasons, except for the already-documented open-presence limit.
Acceptance criteria
- A compacted journal from a world whose program snapshot is > 256 KiB contains no entry over
MAX_CHECKPOINT_PART_BYTES, and restore reconstructs the identical WorldCore state (snapshot bytes, retained events, admin history, presence, transfers, schedules, profile).
- id(world-replication): a journal whose Checkpoint line exceeds 256 KiB can never be replicated — split_entry_payload refuses the single entry and send_snapshot dies before the first frame #4630 regression test: the same oversized-Checkpoint journal image round-trips the feed path —
journal_entry_line per entry → split_entry_payload (no PayloadTooLarge) → ReplicationEnvelope::snapshot/tail + send_snapshot framing → ReplicationTracker::accept — and the accepted cursor equals the sender's final cursor; the received journal restores to the same state.
- Boundary tests: a part of exactly
MAX_CHECKPOINT_PART_BYTES passes; one byte over is split, not errored; a multi-byte UTF-8 character is never cut mid-character.
- Journal-version tests: a v6 journal is refused by a version-5 reader at the header check; a journal needing only v1-v5 keeps its existing version.
-
cargo test -p id --lib world::replication passes.
- The
world_store replication feed tests pass (they build snapshot bytes through the same path).
- The existing journal-version / restore / compaction suites pass (
cargo test -p id --lib world).
- The module doc of
pkgs/id/src/world/replication.rs states the resulting per-entry guarantee from the design note (every writer-emitted entry ≤ 192 KiB, hence ≤ one v1 payload frame), replacing "such an entry can never be replicated in v1".
Out of scope
- Sub-entry fragmentation / continuation frames (rejected in the note: v1→v2 wire bump plus permanent receiver buffering for a writer-controlled entry kind).
- Raising
MAX_REPLICATION_PAYLOAD_BYTES (deferred; it changes a receiver-side constant, so it is a compatibility decision).
- Legacy journals already holding an oversized
Checkpoint — handled by the companion residual issue.
Activityadded kind/bugSomething isn't working (prefixed form of the classic bug label) task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests app/idPackage/app: id (pkgs/ or apps/ in this repo) on Nov 3, 2026developing-today commented on Nov 3, 2026 agent-note:v1
state: reviewed (coverage loop-back)
Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 8558 (triage, queued, priority 40) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
Found via: coverage loop-back 2026-11-03 dezren39 commented on Nov 3, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 4, 2026
🤖 Agent note · parked — supplemental read-only audit (no tests run)
• Implementation is substantially present in pkgs/id/src/world/core.rs (snapshot/event splitting and restore validation), world/mod.rs (entry kinds and v6 mapping), world/replication.rs, and world/tests.rs. Do not stage the whole worktree: 49 files are modified, with broad formatting churn in unrelated files (including boards.rs and web/markdown.rs).
• Likely failing regression: world/replication.rs:1445 computes the expected cursor with chain_payload(base, &journal_bytes) for the whole oversized journal; that helper rejects payloads over 256 KiB. Advance the expected cursor per bounded entry/frame instead.
• Gaps to check on resume: exact 192 KiB and one-byte-over tests; documentation of the writer-emitted entry size guarantee; explicit v5-reader rejection of a v6 header.
• Safety question (potential, not established by the failed search): separate source inspection found a handoff_transfers() accessor but no visible bound on HandoffTransferState or its payload. The search for nonexistent pkgs/id/src/world_caps.rs failed and is not evidence for this question. Confirm whether transfer count/payload can exceed the 192 KiB scalar checkpoint limit, or provide a safe fallback, before claiming the “split, never skip” acceptance.
• Preserve the worktree and classify unrelated changes before staging. Resume from /home/user/git/fleet/task-9178. dezren39 commented on Nov 4, 2026 agent-note:v1
task: 9178
lane: code-o
state: picked-up
note: Resuming task 9178 for #4966 (direct lane). Existing laptop worktree /home/user/git/fleet/task-9178 on branch queue/9178-4966-bounded-checkpoint-parts has an unclassified dirty diff from a prior lane; this shift will classify it file-by-file, preserve unrelated changes, and finish only the #4966 scope. dezren39 commented on Nov 4, 2026 agent-note:v1
task: 9178
lane: code-o
state: done
note: Fixed and merged via PR #5316 (squash 285b8b9); #4966 closed. Classified the inherited 49-file dirty diff: 45 files were rustfmt-style churn only (full diff preserved on the laptop at ~/git/fleet/task-9178-full-diff-backup-2026-11-04.patch) and were restored; the 4 world files carried the implementation. Made splitting conditional (inline checkpoint when it fits <=192 KiB, parts only when oversized, so fitting journals keep their existing version), fixed the replication round-trip test cursor computation, and fixed both Codex P2 findings (multibyte midpoint search; quadratic event sizing) with a regression test. Tests: world suite 223 passed; full id lib 2107 passed with one load-flaky log_sync timeout that passes solo. Codex re-review: no findings.
MetadataMetadataapp/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DevelopmentNo branches or pull requestsIssue actions
|