Skip to content

feat(id-worlds): journal append stamps — writer/epoch/op-id on every mutation path (#13938 item 1) - #17155

Merged
dezren39 merged 1 commit into
mainfrom
archer/0352e-13938-append-stamp
Nov 30, 2026
Merged

dezren39 merged 1 commit into
mainfrom
archer/0352e-13938-append-stamp

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Acceptance item 1 of #13938: authenticated writer / epoch / op-id metadata on every mutation path of the pkgs/id world journal.

New JournalEntry::AppendStamp (journal version 19; MAX_JOURNAL_VERSION raised to it), emitted by the world actor's persist funnel — persist, persist_batch, persist_transaction — from the write lease in force, so every mutation path carries the metadata without growing per-variant fields across the enum, the checkpoint serializers, or replication.

Design decision (the one the refined spec on #13938 left to the implementing lane)

Funnel-level stamp entry, per 0107-G's steps (2)–(3) wording, over per-variant optional stamp fields:

  • The stamp names the write-lease holder in force for the covered appends — the DO authority when no holder stands (e.g. the stamp covering a lease grant itself) — at the current epoch.
  • The operation ID is sourced at the lease boundary as {writer}:{epoch}:{seq}, seq counting the journal's stamps in append order. Client operation IDs reach the journal only through the lease rejection audit until the native-transport item of [audit7] #3805 Phase 3 remainder: lease-handoff acceptance items not in PR #10641 #13938 lands; the funnel's own sequence is the operation identity available at this boundary. The sequence is derived state (WorldCore::append_stamp_seq): rebuilt by replay, advanced live only once the stamp is durable, and restarted by compaction, whose checkpoint stands in for the stamps it compacted — operation IDs are unique within a journal, scoped by (writer, epoch).
  • One stamp per append operation: a batch and a transaction each carry a single stamp inside the same sync / atomic rewrite, so group commit keeps its one-sync shape.

Replay validation (WorldCore::restore)

  • A stamp must name the holder at its epoch and carry the next sequence operation ID — a forged, stale-writer, or replayed stamp fails the restore whole, exactly as a forged lease transition does.
  • In a stamped journal, every mutation entry must be covered by the latest stamp; lease transitions and checkpoints end coverage, so a stale writer appending after a handoff boundary is refused. Forked is a boundary (it is appended by fork_world, outside the funnel).
  • Entries before a journal's first stamp are the legacy prefix: unstamped journals restore exactly as before, and existing journals are never migrated.

Tests

  • Version: stamp requires 19 and 19 is the newest (pins updated); wire shape round-trips; a stamp under a v18 header is refused.
  • Replay: stamps cover mutations and the sequence is rebuilt; coverage ends at a handoff (stale-writer case) and a fresh stamp naming the new holder covers again; foreign writer / stale epoch / replayed operation ID all refused; unstamped journals restore without coverage.
  • Funnel: persist / persist_batch emit the exact stamp sequence, and the funnel's own output replays clean through restore validation.

Verification: full id-worlds suite on this branch via fleet queue dispatch (run developing-today-forks/fleet#46400648256); result recorded on #13938.

Lane 0352-E (bravo SUSTAIN 2026-11-30), dedicated AUTHOR lane for #13938 item 1, implementing 0307-AJ's refined v19 spec (issue comment 7274702777). Claim: issue comment 7274930222.

Refs #13938 (item 1 of its acceptance list; the issue stays open for items 2–4).

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-30T10:31:00Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

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

…mutation path (#13938 item 1)

New JournalEntry::AppendStamp (journal version 19, MAX raised to it),
emitted by the actor persist funnel (persist / persist_batch /
persist_transaction) from the write lease in force, so authenticated
writer / epoch / operation-id metadata exists on every mutation path
without growing per-variant fields across the enum.

Design (funnel, per the refined spec on #13938): the stamp names the
lease holder in force (the DO authority when no holder stands) at the
current epoch; the operation ID is sourced at the lease boundary as
{writer}:{epoch}:{seq}, seq counting the journal's stamps in append
order — client op-ids reach the journal only through the lease
rejection audit until native transport lands.

Replay validation in WorldCore::restore: a stamp must name the holder
at its epoch and carry the next sequence operation ID; in a stamped
journal every mutation entry must be covered by the latest stamp, and
lease transitions / checkpoints end coverage — a stale writer
appending after a handoff boundary fails the restore whole. Entries
before a journal's first stamp are the legacy prefix and restore
exactly as before; unstamped journals are untouched.

Tests: version pin + wire shape, stamp coverage across a handoff,
foreign/stale/replayed stamp refusal, legacy unstamped restore, and a
funnel test asserting persist/persist_batch stamp sequences and that
the funnel's own output replays clean.

Lane 0352-E (bravo SUSTAIN 2026-11-30), dedicated AUTHOR lane for
#13938 item 1 per 0307-AJ's v19 spec (comment 7274702777).
@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: 54e16547-1f5b-4e00-a4d0-eec58ebb1c8c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

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