Skip to content

feat(id): durable file operation ledger for admission (#17179 slice 2) - #17207

Open
developing-today-fleet[bot] wants to merge 4 commits into
mainfrom
archer/17179-ledger-adapter
Open

developing-today-fleet[bot] wants to merge 4 commits into
mainfrom
archer/17179-ledger-adapter

Conversation

@developing-today-fleet

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

Copy link
Copy Markdown
Contributor

Slice 2 of #17179 (parent #10192): the ledger adapter — a durable, append-only operation ledger for admission decisions, following slice 1's policy-epoch adapter (PR #17187, same module / test pattern).

What lands

  • FileOperationLedger (pkgs/id/crates/id-store/src/admission.rs) implements the existing OperationLedger trait over one append-only log file. Every record() appends one full entry snapshot as a single line and fsyncs before returning; entry() folds the log last-record-wins per operation. Records are never edited or deleted — a state transition is a new line — so the log doubles as the audit trail of admission decisions (envelope binding, gate receipt fields, prepare cursor, annotations, follow-up envelopes as canonical bytes, lifecycle state).
  • Fail-closed on corruption: a missing file is an empty ledger; a file that exists but cannot be read or parsed in full halts via a documented ledger_fail_closed panic. The trait has no error channel, and returning None for a committed operation would let a replay re-run its commit step — the double-apply the Implement ordered lifecycle hooks and fixed acceptance gate #10192 oracle forbids. A corrupt ledger is an operator incident, never improvised state.
  • AdmissionReceipt::from_recorded (id-core): reconstitutes a receipt from a durable ledger record of a gate-minted receipt. It records a past admission, it does not mint a new one — the pipeline runs the gate first on every run and surfaces a ledger receipt only as the AlreadyCommitted readback in the same call. The struct doc is updated to stay truthful about the two constructors.
  • PayloadId::from_content_id (id-core): the symmetric counterpart of the existing EnvelopeId::from_content_id, so payload IDs read back from the record wrap the same way envelope IDs already did.

Gate ordering and existing trait signatures are unchanged.

Tests

  • New integration suite pkgs/id/tests/admission_ledger.rs (model oracle, id admission: durable policy-epoch / ledger / outbox adapters (slice of #10192) #17179 extension): committed operation replays as AlreadyCommitted after restart with the identical receipt and no second commit; a different envelope under the committed operation ID is replay-rejected after restart; an Admitted operation resumes at its recorded prepare cursor after restart (completed hook does not re-run, its annotation reaches the commit step).
  • New in-module ledger_tests: record round-trip across reopen (receipt, annotations, follow-up envelope), missing file = empty ledger, last-record-wins state transitions over an append-only 2-line log, corrupt record fails closed.

Verification: fleet Actions exec on the exact head (run id + counts posted on #17179 and #10192 after the run).

The outbox adapter remains the follow-on slice of #17179; this PR does not close the issue.

Lane 0707-G (charlie ADVANCE 2026-11-30).


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

@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: f8bc4a29-c2fb-4c3c-90e1-6627d7b40ce3

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

This branch has not been deployed

No deployments
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.

0 participants