Skip to content

feat(id-store): ordered lifecycle hooks around the fixed admission gate (#10192, slice 9110-06) - #13156

Merged
dezren39 merged 1 commit into
mainfrom
lane-kq-10192
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-kq-10192

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What this is

The first implementation slice of #10192 (slice 9110-06): the ordered lifecycle the versioned design mandates around the fixed admission gate, landed as an engine in id-store (the crate id-events and id-sync already depend on), plus the model-oracle suite the issue names as its evidence.

The fixed gate itself already exists in id_core::admission_gate (#10275) — signature, validation, signer binding, tenant authorization, policy — but it was not exported from the crate root; its own doc assigns that export to slice 9110-02. This PR adds the export, the facade re-exports, and everything the design wraps around the gate:

  • Replay / idempotency — an OperationLedger binds each operation ID to exactly one envelope. A committed operation re-presented resolves as AlreadyCommitted (caller resolves by readback); rebinding the ID to a different envelope is a replay rejection.
  • Prepare hooks — deterministic order (priority, then stable registration ID), immutable validated input only (receipt + envelope + context + earlier annotations, all shared references), veto or namespaced annotations bounded by a per-hook budget. Contract violations fail closed.
  • Commit-time reauthorization — judged against current policy immediately before the commit step; revocation during prepare blocks the commit, and the retry while revocation stands.
  • Commit semantics — a failed commit leaves the operation Admitted (unknown outcome, resumable at its prepare cursor), never reported as rolled back.
  • Outbox hooks — at-least-once post-commit delivery keyed by a stable event ID (envelope digest + hook ID), failures journaled as pending and retried by ID; delivery failure never un-commits.
  • Reentrancy — same-operation reentry is rejected; hooks request follow-ups (fresh operation ID) that are returned to the caller as new runs.

Files

  • pkgs/id/crates/id-store/src/admission.rs (new) — the pipeline, ledger/journal seams with in-memory implementations, typed LifecycleRejection (stage + stable class), and unit tests for the lifecycle mechanics.
  • pkgs/id/tests/admission_hooks.rs (new) — the issue's named test file: the model oracle over the gate-refusal classes, replay, revocation, and the exact design trace.
  • pkgs/id/crates/id-core/src/lib.rs — pub mod admission_gate;
  • pkgs/id/crates/id-store/src/lib.rs — pub mod admission;
  • pkgs/id/src/lib.rs — facade re-exports.

Verification

Run on the laptop in nix develop (pkgs/id), 2026-11-23:

  • cargo test -p id-store admission — 11 passed, 0 failed (lifecycle mechanics: ordering, veto, revocation, replay binding, reentrancy, annotation contract, resumable commit, outbox retry, follow-ups).
  • cargo test --test admission_hooks — 6 passed, 0 failed (the model oracle above).
  • cargo test -p id-core --test admission_gate — 6 passed, 0 failed (the existing gate suite, unchanged, against the new crate-root export).
  • rustfmt --edition 2024 --check on both new files — clean; cargo clippy on the touched targets — no warnings in the new files.

What remains on #10192 (named, not hidden)

  • Wiring the id-events ingress paths through the pipeline (crates/id-events/src/admission.rs), against the path inventory in tests/admission_path_coverage.rs.
  • The same wiring for id-sync (crates/id-sync/src/admission.rs), composing with the federation slices' replay guard and key revocation.
  • The production policy-epoch source for the Reauthorizer seam, and durable ledger/journal implementations for the hosted adapters.

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

…te (#10192, slice 9110-06)

Add id_store::admission: the lifecycle pipeline the versioned design
mandates around the fixed signed/validated gate — a replay/idempotency
ledger binding each operation ID to exactly one envelope,
deterministically ordered prepare hooks (priority, then stable
registration ID) over immutable validated input with namespaced,
budgeted annotations, commit-time reauthorization against current
policy, resumable commit outcomes (an unknown outcome stays Admitted,
never reported rolled back), and at-least-once outbox delivery
journaled by stable event ID. Same-operation reentrancy is rejected;
hooks request follow-ups as new queued operations instead of recursing.

Export id_core::admission_gate at the crate root — the export the gate
module's own doc assigns to slice 9110-02 — and re-export both modules
at the id facade.

Model oracle in pkgs/id/tests/admission_hooks.rs: gate refusals
(forged signature, tampered payload, unknown signer, oversized
payload, wrong tenant) never reach hooks or commit; replays never
double-commit; revoked policy blocks commit and retry; the happy-path
trace matches the design order gate, prepare, reauthorize, commit,
outbox.
@coderabbitai

coderabbitai Bot commented Nov 23, 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 47 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: 9428d84d-93c4-47ee-a79f-873565b34aa4
Commits

Reviewing files that changed from the base of the PR and between 14fd1da and cf524a4.

Files selected for processing: 5

  • pkgs/id/crates/id-core/src/lib.rs
  • pkgs/id/crates/id-store/src/admission.rs
  • pkgs/id/crates/id-store/src/lib.rs
  • pkgs/id/src/lib.rs
  • pkgs/id/tests/admission_hooks.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

@dezren39
dezren39 merged commit 9322209 into main Nov 23, 2026
1 check passed
@dezren39
dezren39 deleted the lane-kq-10192 branch November 23, 2026 09:24
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T09:26:12.106111Z cf524a4 PR opened
ℹ️ 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.

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