Skip to content

feat(id): region-seam handoff journal foundation (#3900) - #3922

Merged
dezren39 merged 2 commits into
mainfrom
queue/5863-3900-journal-foundation
Nov 1, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/5863-3900-journal-foundation

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Phase 1 of #3870 (design #2818, doc/2026-11-01_design_id2818.md §8 packet 1): the journal/schema/checkpoint foundation for journaled region-seam export/import. Format only — no routing behavior changes; existing worlds are unaffected until a handoff entry is written.

  • Typed entries (pkgs/id/src/world/mod.rs): JournalEntry::EntityExported / EntityImported with the design §3 fields (handoff ID, entity ref, regions, owner epochs, module hash, payload schema/digest, embedded host system event; the export carries the complete payload as the durable recovery copy), plus the CoordinatorJournalEntry format (Started / ExportObserved / ImportObserved / Completed / Cancelled — no entity payloads) for the phase-4 coordinator to build on.
  • Entity-addressed input: WorldEventKind::EntityInput { entity_ref, input }; replay treats it like Input, and the sandbox / native / fixture program hosts deliver its bytes exactly like unscoped input (entity scoping is host-side fencing metadata, wired in phase 2).
  • Journal version 3: JOURNAL_VERSION_REGION_HANDOFF = 3, MAX_JOURNAL_VERSION = 3; journal_version_required_by pins v3 for handoff entries, EntityInput events, and checkpoints carrying transfers — the existing bump-on-first-write / refuse-at-open contract (Define rollback compatibility for world profile journal entries #227) does the rest. v1/v2 journals still open.
  • Checkpoint preservation: WorldCore.handoff_transfers is rebuilt by replay (a duplicate export/import for one handoff ID is refused; an import whose epoch does not advance is refused) and rides the Checkpoint entry's new transfers field through compaction, so an exported entity cannot be resurrected and an import receipt cannot be forgotten. Compacted headers carrying transfers are marked v3.

Tests

New laptop-run tests (CI will re-run): handoff_entries_require_journal_version_3, handoff_transfers_survive_restore_and_checkpoint_compaction, duplicate_handoff_export_in_journal_is_refused — all pass; the v1/v2 header test still passes.

Queue: task 5863. Parent: #3870. Design: #2818. Phases 2–5 are #3901–#3904, gated in order.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Phase 1 of #3870 (design #2818): typed EntityExported/EntityImported
world journal entries plus the CoordinatorJournalEntry format,
WorldEventKind::EntityInput, journal version 3 with bump-on-first-write
via journal_version_required_by, WorldCore handoff transfer state
rebuilt by replay (duplicate handoff sides refused, import epoch must
advance), and checkpoint/compaction preservation of active handoffs,
fences, receipts and owner epochs. EntityInput delivers to programs
exactly like Input in the sandbox/native/fixture hosts. No routing
behavior changes; phases 2-5 of #3870 build on this format.

Tests: 3 new world tests (version pinning + coordinator wire shape,
restore + checkpoint compaction round-trip, duplicate export refusal)
pass on the laptop; full id lib suite run locally.
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 18:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T18:41:15.517754Z d8a40bc New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fed44a62-5fbe-4e4a-be8a-5454c000693f
Commits

Reviewing files that changed from the base of the PR and between 33aefa7 and d8a40bc.

Files selected for processing: 7
  • pkgs/id/src/sandbox.rs
  • pkgs/id/src/world/core.rs
  • pkgs/id/src/world/mod.rs
  • pkgs/id/src/world/tests.rs
  • pkgs/id/src/world_fixture.rs
  • pkgs/id/src/world_native.rs
  • pkgs/id/src/world_store.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 344ce0520e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/id/src/world/mod.rs Outdated
Comment on lines +911 to +913
JournalEntry::Checkpoint { transfers, .. } => match transfers {
Some(_) => JOURNAL_VERSION_REGION_HANDOFF,
None => JOURNAL_VERSION,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include retained entity inputs in checkpoint version detection

When a world has committed EntityInput events but has no handoff transfers, this branch reports version 1 even though the checkpoint's retained events still contain the new event kind. WorldCore::checkpoint_entries derives the compacted header from this helper, so compaction downgrades that journal's header to version 1 (or version 2 with a nondefault execution profile). Older binaries then accept the header but cannot deserialize the checkpoint, violating the bump-on-first-write compatibility contract. Inspect the checkpoint's retained events as well as transfers when determining whether version 3 is required.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d8a40bc: journal_version_required_by now scans a checkpoint's retained events — a checkpoint retaining an EntityInput event requires journal version 3 even with no active handoff transfers, so compaction can no longer downgrade the header. Covered by an added case in handoff_entries_require_journal_version_3 (laptop: 3 handoff tests pass).

Codex P2 on PR #3922: a checkpoint retaining EntityInput events but
carrying no handoff transfers reported version 1, so compaction could
downgrade the header and an older binary would accept it then fail
mid-read. journal_version_required_by now scans the checkpoint
retained events (and drops const to do so; all callers are runtime).
@dezren39
dezren39 merged commit 876b402 into main Nov 1, 2026
1 check passed
@dezren39
dezren39 deleted the queue/5863-3900-journal-foundation branch November 1, 2026 18:40
@dezren39

dezren39 commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

Verification note (lane D, post-merge): the full id lib suite in the fleet worktree showed one failure in store_traits::test_the_lock_has_no_sqlite_with_logsync_wired. Verified NOT a regression from this PR: the merge changes zero Cargo files, and the same test passes in a clean worktree at both pre-merge main (33aefa7) and post-merge main (876b402). The failure only reproduces in the fleet/5863 worktree, whose target dir accumulated libsqlite3-sys artifacts from concurrent cargo invocations during the shift — a worktree-local build-state artifact. All other 1467+ tests passed, including the 3 new handoff tests.

@dezren39

dezren39 commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

CORRECTION to my verification note above (lane D): the claim that the lock test passes in clean worktrees was wrong — it rested on garbled tool deliveries. Re-read directly from the saved result files: test_the_lock_has_no_sqlite_with_logsync_wired FAILS in clean worktrees at BOTH pre-merge main (33aefa7) and post-merge main (876b402), panicking at store_traits.rs:701 on the committed Cargo.lock's sqlx-sqlite → libsqlite3-sys edge. So the accurate statement is: the failure is PRE-EXISTING on main and unrelated to this PR (which changed zero Cargo files), not a worktree artifact. Filed as #3930 with evidence and fix directions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant