Skip to content

E9-1 route 2 S2b-3b tests (lane MB): take, settle, and the sign-in standing, stubs and pending tests - #2166

Closed
kunwarshivam wants to merge 51 commits into
mainfrom
claude/mb-reduction-open-present
Closed

kunwarshivam wants to merge 51 commits into
mainfrom
claude/mb-reduction-open-present

Conversation

@kunwarshivam

@kunwarshivam kunwarshivam commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Story

E9-1, route 2, slice S2b-3b: the tests half of DEC-77 for the store side of a presentation. Spec: workspace API spec §4.10 route 2 items 1 and 3. Decisions: DEC-653, DEC-2119, DEC-2319 item 2.

Stacked. S2b-3a's impl (#2162) is on main. Main is merged in (merge commits only). #2167 (the implementation) and #2174 to #2188 sit above this.

Stubs, each todo!() under DEC-137's #[expect(clippy::todo)]:

  • Reduction::take(challenge_id, now) -> Option<Issued>: single use. A challenge is taken out on its first presentation, atomically under one lock, and it is None once expired.
  • Reduction::settle(client, taken, opened, now) -> bool: consumes the gate's copy and counts a failure when nothing opened. It returns true only for the failure that first brings a client to its limit. That is when reduction_failures_over_limit is raised, once.
  • Sessions::standing(member): a read-through of the sign-in standing.

DEC-2319 item 2's consequence (accepted by the founder, 2026-10-25)

The standing is in memory, so any process restart refuses route 2 to every member until each signs in again normally. A provider outage together with a restart therefore leaves only route 3, the host CLI, for pause and the kill switch. Route 1 needs the provider, and route 2 needs a sign-in seen since the restart. This holds until the journaled deprovision signal, DEC-2319 item 3 option (b), lands as backlog E9-13. The founder accepted it on choosing (b) (#2356).

Spec clause → test

Spec clause or invariant Test name
§4.10 item 1: a challenge is taken once, and never at or after its expiry reduction_presentations::a_challenge_is_taken_once_and_never_after_it_expires
§4.10 item 1: single use under concurrency. 16 threads taking one challenge id, 32 rounds, exactly one gets Some (a check-then-remove across two lock acquisitions fails it) reduction_presentations::a_challenge_taken_by_many_threads_at_once_is_taken_by_exactly_one
§4.10 item 3: a taken challenge holds its slot until settled; an opening or a refusal frees it reduction_presentations::a_settled_challenge_frees_its_slot_whatever_the_outcome
§4.10 item 3: only presentations that opened nothing count; a device's 10th failure raises the alert once; lapsed failures re-arm it reduction_presentations::failures_count_only_when_nothing_opened_and_the_limit_raises_the_alert_once
§4.10 item 3: a refused presentation of a taken challenge is a failure reduction_presentations::refused_presentations_of_taken_challenges_count_and_the_tenth_raises_the_alert
§4.10 item 3: an address reaches its limit at its 100th failure across devices reduction_presentations::an_address_reaches_its_limit_at_its_hundredth_failure_across_devices
§4.10 item 3: a failure counts for exactly 300 s. It reaches the limit at 338 s only if a failure at 39 s still counts (a 299 s window fails it), and afresh at 339 s only if that failure lapsed exactly then (a 301 s window fails it) reduction_presentations::a_failure_counts_for_exactly_300_seconds
Rule 3: a panic that poisons the store's lock leaves take and settle working (PoisonError::into_inner, as the existing code does) reduction_presentations::a_poisoned_lock_still_takes_and_settles
DEC-2319 item 2: the latest full sign-in is the standing; a passkey session, a refused open, or a full store records nothing session::a_full_sign_in_is_kept_as_the_route_two_standing_and_nothing_else_is

The gate's own tests also pin the window to the nanosecond: mandate-authn tests/reduction.rs the_failure_limit_counts_per_address_and_per_device_for_300_seconds, at LIFETIME + 6 and + 7 ns. The store-level test above pins it through settle, the path the route uses.

Dependencies

None.

Journal events added

None.

Not done

Decisions needed

None.

Safety checklist (safety-critical changes)

  • No floats in money or quantity paths
  • No clock reads or randomness in the core
  • No unwrap, expect, or panics on trading paths (only the DEC-77 stubs)
  • Ordering: inputs processed in journal order
  • Replay: same inputs give identical outputs
  • No secrets or trading content in logs or notifications
  • No x-planned or (planned: ...) marker added to a value the code already serves, or a reviewer signed it off (DEC-683)

Checks

  • cargo xtask ci fast parts are green locally (lint, nextest, doctests, rh-sim, pytest, pending, spec guard, portable). The pending tests fail at their stubs with the stubs' own report.
  • Against E9-1 route 2 S2b-3b (lane MB): take, settle, and the sign-in standing, implemented #2167's implementation, every planted bug is caught by its test: a 299 s and a 301 s window, check-then-remove, and giving up on a poisoned lock.
  • Review agent report attached (review round 1 passed with three minors, all fixed here)

🤖 Generated with Claude Code

https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh

claude added 30 commits October 22, 2026 02:21
… reserve and max_failure_keys; pending tests (E9-1 S2a, DEC-2119 items 4 and 11)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…failure_keys with the oldest key dropped first (E9-1 S2a, DEC-2119 items 4 and 11)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
Stop dropping failure keys when a removal removes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…9-1 S2b-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
… and DEC-2319 (Proposed) (E9-1 S2b-2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…-2, DEC-2319 item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…e, and bound a failure's cost (review of #2128, B1 and B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…cost no scan of the keys (review of #2131, B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…2324 (E9-1 S2b-2b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…wrong secret (review of #2135, B1 and B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…5, DEC-2319 item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…s and pending tests (E9-1 S2b-3b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…: stubs, pending tests, DEC-2324 item 4 (review of #2153)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…it: one ES256 and one Ed25519 check on every call (DEC-2324 item 4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
claude added 18 commits October 22, 2026 03:47
…constant work (DEC-2324 item 4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…ys fill the bound exactly (review of #2131)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…ds at or after the sign-in (review of #2161)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…, so a hit and a miss cost the same parse (review of #2162)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…dress limit through settle (review of #2166)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
Base automatically changed from claude/mb-reduction-open-judge2-impl to main October 22, 2026 05:17
…poisoned lock (review of #2166)

The review found the T0+339 assertion vacuous: settle answers false there
whether or not the failure lapsed. Two devices now pin the window to the
second, one reaching its limit at 338 s only if a failure at 39 s still
counts, the other reaching it afresh at 339 s only if it lapsed then.
Sixteen threads taking one challenge must find exactly one Some, and a
panic inside issue that poisons the store's locks must leave take and
settle working. Sessions::standing's doc names Standings as the standing's
one owner, which the session store alone writes.

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh
kunwarshivam added a commit that referenced this pull request Oct 25, 2026
…, implemented (#2167)

* Route 2's gate bounded in all: ReductionLimits gains max_outstanding, reserve and max_failure_keys; pending tests (E9-1 S2a, DEC-2119 items 4 and 11)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's gate bounded in all: max_outstanding, the reserve, and max_failure_keys with the oldest key dropped first (E9-1 S2a, DEC-2119 items 4 and 11)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Pin which failure key the gate drops first, address before device at a tie

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Bound the reduction gate's challenges in all and its failure keys

Stop dropping failure keys when a removal removes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's session in the store: stubs and pending tests (E9-1 S2b-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's session in the store: open it, mark it, never refresh it (E9-1 S2b-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's passkey records and interim standing: stubs, pending tests, and DEC-2319 (Proposed) (E9-1 S2b-2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's passkey records and interim standing, implemented (E9-1 S2b-2, DEC-2319 item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Pin eviction by latest failure against earliest, with a lapsed failure, and bound a failure's cost (review of #2128, B1 and B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Index failure keys by their latest failure, so lapsing and the bound cost no scan of the keys (review of #2131, B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's verifier in mandate-passkey: stubs, pending tests, and DEC-2324 (E9-1 S2b-2b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Size the 64-byte DER cases to 64 bytes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's verifier in mandate-passkey, implemented (E9-1 S2b-2b, DEC-2324)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Pin subject() on a live passkey session and a tagged cookie with the wrong secret (review of #2135, B1 and B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's judge: stubs and pending tests (E9-1 S2b-3a, DEC-2324 item 5, DEC-2319 item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's judge, implemented (E9-1 S2b-3a, DEC-2324 item 5, DEC-2319 item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's presentations: take, settle, and the sign-in standing, stubs and pending tests (E9-1 S2b-3b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's presentations: take, settle, and the sign-in standing, implemented (E9-1 S2b-3b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Route 2's verifier does one ES256 and one Ed25519 check on every call: stubs, pending tests, DEC-2324 item 4 (review of #2153)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* The judge's doc names the constant-work verifier (DEC-2324 item 4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* The judge verifies with the held key or None, the verifier doing the constant work (DEC-2324 item 4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Pin that a lapsed key leaves its map with its index entry, so live keys fill the bound exactly (review of #2131)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Merge the desync test into the implementation (review of #2131)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Pin an Ed25519 key recorded as es256 refused, and DEC-2319 item 2 reads at or after the sign-in (review of #2161)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Merge the reverse-algorithm test; a key-store miss parses a decoy key, so a hit and a miss cost the same parse (review of #2162)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Pin refused presentations of taken challenges as failures, and the address limit through settle (review of #2166)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Merge the refused-presentation tests into the implementation (review of #2166)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K

* Name E9-13 as the end of the interim standing, now DEC-2319 is accepted

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh

* Pin route 2's 300 s failure window, single use across threads, and a poisoned lock (review of #2166)

The review found the T0+339 assertion vacuous: settle answers false there
whether or not the failure lapsed. Two devices now pin the window to the
second, one reaching its limit at 338 s only if a failure at 39 s still
counts, the other reaching it afresh at 339 s only if it lapsed then.
Sixteen threads taking one challenge must find exactly one Some, and a
panic inside issue that poisons the store's locks must leave take and
settle working. Sessions::standing's doc names Standings as the standing's
one owner, which the session store alone writes.

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh

---------

Co-authored-by: Claude <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Included in #2167 (squash 3338e0c), the implementation half of this DEC-77 pair. Closing as included.


Generated by Claude Code

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.

2 participants