Identity plane split, plan I3e2: canopy-web’s session engine (epic &133)
Status: Done (2026-10-09) — !1588
Epic: &133 (stage I3 of &130)
Issues: #2819 (U1, w2); #2820 (U2, w3); #2821 (U3, w5); #2822 (U4, w3); #2823 (U5, w2). Each relates to #2344 and #2345, which close at the switch.
MR: feat/identity-web-session-engine, "canopy-web’s session engine (#2819 … #2823)".
One MR, one commit per issue, under the maintainer’s one-MR-per-related-group ruling. It merges once the pre-push battery passes. This is a Design + Scope plan: GitLab owns tracking, and the plan freezes when U1 starts. V1–V7 are this plan’s decisions (ADR-049 Amendment 18); R3 and R4 are the maintainer’s rulings.
Context
Amendment 17 W1 cut I3e into canopy-auth library stages. The first, plan I3e1, built canopy-web’s upstream relying party. The second is "canopy-web’s sender and session engine".
The maintainer’s rulings (2026-10-09):
-
R3. Split that stage: I3e2 is the session engine; I3e3, planned once I3e2 lands, is canopy-web’s sender (delegation per backend call, the
session_stalerenew-and-retry, system purposes). -
R4. The engine’s single-flight state sits behind a store trait in canopy-auth. canopy-web’s Postgres store implements it at the switch, replacing
web_session. canopy-auth gains no database dependency.
What exists (all unwired):
-
UpstreamRelyingParty(crates/canopy-auth/src/upstream/relying_party.rs):authorization,redeem,refresh(token, within) → Result<UpstreamGrant, RefreshFailure>,revoke,end_session;UpstreamGrant::refresh_due() → RefreshDue::{At, ShortLived}. -
FederationClient(crates/canopy-auth/src/identity_client/federation.rs):open(id_token, Option<access_token>),renew(&SessionCredential, RenewalEvidence),revoke(&SessionCredential), each bounded byFEDERATION_REQUEST_TIMEOUT(15 s);FederatedSessionwith public fields (credential, sid, sub, auth_time, session_ends_at, fresh_until, roles, programs, username). -
CanopyRefusal(identity_session.rs),NumericDate(upstream/id_token.rs).
canopy-web today (replaced at the switch):
-
A Postgres row claim (#2224,
services/canopy-web/src/auth/single_flight.rs): a claim committed before the refresh token is presented; a 30 s lease; commit recovery (classify_commit); a lapsed claim ends the session asrefresh_lost; a 3 s request budget. -
Its waiter awaits the leader with no bound; it presents Keycloak tokens, and its 360 s lead is sized to the exchanger (#2345).
What the ADR binds:
-
D6: re-federate after each upstream refresh and at least every 900 s, single-flight across replicas.
-
F4: a session is fresh until its last validation + 900 s, never after
session_ends_at. -
F5, F6: renewal evidence, grace on
upstream_outcome=not_processed,grace_exhausted. -
Amendment 2: grace only for a refresh the upstream provably did not process.
-
W6: maintenance is due at the earlier of the grant’s refresh lead and canopy-identity’s freshness lead.
-
idp-integration.adoc› "How canopy-web treats each renewal answer". -
The ADR fixes no freshness-lead number; V3 sets it.
Decisions (ADR-049 Amendment 18, V1–V7; land with U1)
-
V1. Staging (R3, R4). I3e2 is the engine; I3e3 is canopy-web’s sender; then the device-approval and security-admin clients; then the edge forwarder. canopy-web’s store, extractors and handlers stay the switch’s (W1).
-
V2. The record and its store. The module is
canopy_auth::identity_web_session.-
WebSessionRecordhas public fields, so a store restores it from its own columns, and noDebug,CloneorSerialize:-
session: FederatedSession; -
upstream: UpstreamBinding { issuer: String, client_id: String }: the profile’s exactissuerandclient_idat sign-in, from the newUpstreamRelyingParty::binding(); -
upstream_refresh_token: Option<UpstreamRefreshToken>; -
upstream_id_token: Option<Zeroizing<String>>, the latest id_token, for logout’sid_token_hint; -
maintain_at: DateTime<Utc>.
-
-
WebSessionStoreis anasync_traitthat isSend + Sync + 'static, withtype Key: Clone + Send + Sync + 'static. Each method takeswithin: Duration, its bound. The table follows canopy-web’sRefreshStore(services/canopy-web/src/web_session/refresh.rs,sql.rs):Method Contract view(key) → Result<Option<SessionRow>, StoreFault>SessionRow { version: RecordVersion, claim: ClaimState, record: Option<WebSessionRecord> }.record: Nonemeans an undecodable row, which reads as no session. An ended session isNone.claim(key, version, ClaimId, lease) → Result<Claimed, _>Only when the row is at
versionwith no claim: setsLive(claim), with the lease on the store’s clock, and answersClaimed::Record(record).Claimed::Undecodablefor an undecodable row;Claimed::Nothingotherwise.commit(key, ClaimId, &WebSessionRecord) → Result<Option<RecordVersion>, _>Only under that claim, live or lapsed: writes the record, increments the version and clears the claim.
Nonemeans the claim is not in the row.release(key, ClaimId) → Result<bool, _>Clears its own claim only while the claim is live; the version is unchanged.
end_claimed(key, ClaimId, reason),end_lapsed(key, ClaimId)→Result<bool, _>Ends the session only under that claim; for
end_lapsed, only once it has lapsed (RefreshLost).end(key, reason) → Result<Option<WebSessionRecord>, _>Ends the session unconditionally and answers the record it ended, read and ended in one step (sign-out). An undecodable row ends and answers
None.end_reason(key) → Result<Option<WebSessionEndReason>, _>Why an ended session ended.
-
Every write to a record steps its version.
-
An ended key is never live again.
-
A lapsed claim is never cleared, only ended over.
-
ClaimState::{Free, Live(ClaimId), Lapsed(ClaimId)}.ClaimIdis a UUID v7.RecordVersionis au64newtype. -
StoreFault::{Timeout, Unavailable}; an implementation logs its own cause. -
WebSessionEndReason, each variant withas_str(): the engine writesSignedOut(signed_out),Expired(expired),IdentityRefused(identity_refused),UpstreamEnded(upstream_ended),UpstreamChanged(upstream_changed) andRefreshLost(refresh_lost); a store may also reportSuperseded(superseded),Idle(idle) andOperator(operator), which canopy-web’s own paths write. The switch replaces canopy-web’s schema outright, so canopy-web’slogoutspelling is not kept. The name avoids the crate root’s existingEndReason. -
Acknowledged writes must survive a failover; that is the deployment’s concern, as today.
-
-
-
V3. When a session is maintained.
-
maintain_atis the earliest of these, floored atnow + MAINTENANCE_RETRY(30 s):-
RefreshDue::At(t); -
fresh_until − FRESHNESS_LEAD(120 s); -
now + VALIDATION_CADENCE(780 s =FRESHNESS_SECONDS − FRESHNESS_LEAD), which keeps D6’s "at least every 900 s" whatever freshness an answer extends to.
-
-
Grace looks like a 200. A renewal’s 200 may be canopy-identity’s own grace (F6, when its userinfo call or key fetch is unavailable), which F2 does not mark. An answer whose
fresh_untilis pastnow + FRESHNESS_SECONDS + 60 s(D9’s leeway) cannot come from a validation now (F4), so the engine treats it as grace:maintain_at = now + MAINTENANCE_RETRY. A grace that ends sooner is caught byfresh_until − FRESHNESS_LEAD. -
ShortLivedcontributes nothing, and is logged atwarn, with the lifetime, once per grant received. -
An outcome that keeps the session without a validation sets
maintain_at = now + MAINTENANCE_RETRY. So no commit leaves a session due at once. -
Maintainable: it holds an upstream refresh token, and
now + SERVE_MARGIN < session_ends_at.fresh_untilcapped atsession_ends_atdoes not end maintenance, since a grace is capped there too (grace_until). -
Due: maintainable and
now ≥ maintain_at. -
Fresh: while
fresh_until > now + SERVE_MARGIN(15 s), which covers canopy-web’s 12 s page budget plus 3 s. -
Bound: the record’s
upstreamequalsbinding(). -
Constants: these are
pubinidentity_web_session.rs:FRESHNESS_LEAD,VALIDATION_CADENCE,MAINTENANCE_RETRY,SERVE_MARGIN,CLAIM_LEASE,STORE_OP_TIMEOUT(2 s) andCOMMIT_RECOVERY_CAP(6 s). -
Compile-time checks:
-
CLAIM_LEASE(60 s) exceeds the latest a leader’s last store write can land:STORE_OP_TIMEOUT(the claim) +UPSTREAM_TOKEN_TIMEOUT(10 s) +SIGN_DEADLINE(5 s, the renewal’s assertion; madepub(crate)inidentity_client.rs) +FEDERATION_REQUEST_TIMEOUT(15 s) +COMMIT_RECOVERY_CAP+STORE_OP_TIMEOUT(Foreign's end) = 40 s. Revocations run after it, outside the lease. -
FRESHNESS_LEAD > CLAIM_LEASE + SERVE_MARGIN.
-
-
-
V4. Serving:
current(&self, key, budget) → Result<LiveSession, Unserved>.-
One absolute deadline,
now + budget, covers every operation of the request: reads, polls, the wait on its leader, and its ownend_lapsedandend. Each store call is bounded by the lesser ofSTORE_OP_TIMEOUTand what remains. At the deadline, with whatever outcome is pending, the answer isPending. -
The request reads the row, then takes the pure
decide(facts, now, deadline_passed) → Decision, in this precedence:-
no row, or
record: None→NoSession; -
not bound →
end(UpstreamChanged), answeringEnded(UpstreamChanged). Nothing is presented to the configured upstream; -
a lapsed claim, fresh or stale →
end_lapsed(RefreshLost), answeringEnded(RefreshLost); afalsere-reads. This is a decision: canopy-web claims only inside its lead, while the engine’s fresh-path leaders claim earlier, and a lapsed holder may have spent the token either way; -
fresh: if due and unclaimed → serve, and spawn a detached leader at the row’s version without waiting; otherwise serve;
-
stale and not maintainable →
end(Expired), answeringEnded(Expired);NoneanswersNoSession; -
the deadline passed →
Pending; -
stale and not due (a retry is spaced) →
Pending; -
stale with a live claim → wait (canopy-web’s jittered poll, 20 ms doubling to 160 ms) and re-read;
-
stale, due and unclaimed → lead.
-
-
Leading. The request awaits its leader’s
Report::{NotClaimed, Committed, Ended(WebSessionEndReason), NoSession, Unconfirmed}until the deadline.-
Past the deadline it answers
Pending, and the leader runs on. -
NotClaimedreturns to the loop: losing the claim is not leading. -
EndedanswersEnded;NoSessionanswersNoSession. -
After
CommittedorUnconfirmed, it re-reads once and serves only a fresh row; otherwise it answersPending. -
A request leads at most once.
-
-
A stale session ends only by these endings, V5’s, or once
session_ends_atcomes withinSERVE_MARGIN. While the upstream or canopy-identity is down it answersPending: a new sign-in would fail the same way. -
LiveSession { version: RecordVersion, session: FederatedSession }: no upstream token reaches a handler. -
Unserved::{NoSession, Ended(WebSessionEndReason), Pending, Store(StoreFault)}.
-
-
V5. Maintenance (the leader) is a spawned task on its own bounds, never the request’s.
-
It claims at the version with
CLAIM_LEASE:-
Nothing→NotClaimed; -
Undecodable→ release,NoSession; -
a fault → release best-effort and
NotClaimed, never presenting, since the claim may have landed; -
a claimed record that is not bound →
end_claimed(UpstreamChanged), never presenting.
-
-
With the claimed record it runs
refresh(token, UPSTREAM_TOKEN_TIMEOUT). Replace or retain: wherever a row keeps the grant’s tokens, each of the refresh token and the id_token is the grant’s when it has one, else the record’s, since the upstream may answer without rotating either.Upstream refresh Renewal Store Ok(grant)Evidence by
UpstreamRelyingParty::renewal()(newpub const fn):IdToken(grant.id_token())(a missing one is unreachable, since refresh refuses it, and is treated asEnded), orUpstreamAccessToken.Ok(renewed).Commit:
renewed; replace-or-retain; V3’smaintain_at(grace-aware).Ok(grant)Refused(SessionEnded | UpstreamRefused | Projection(_) | SubjectSuspended)end_claimed(IdentityRefused): canopy-identity has revoked it or never had it.Ok(grant)Any other failure (503,
invalid_request, transport, …).Commit: the old identity facts; replace-or-retain; retry
maintain_at.NotProcessed(_)When
fresh_until ≤ now + FRESHNESS_LEAD:RenewalEvidence::NotProcessed→Ok(renewed)(grace).Commit:
renewed; the record’s tokens; retrymaintain_at.NotProcessed(_)When
fresh_untilis further off: none, since repeated grace never extends (F6) and would only add audit rows.Commit: unchanged; retry
maintain_at.NotProcessed(_)The four session-ending refusals.
end_claimed(IdentityRefused).NotProcessed(_)Any other failure,
GraceExhaustedincluded.Commit: unchanged; retry
maintain_at.Ended(_)None.
end_claimed(UpstreamEnded). -
Commit recovery is canopy-web’s: at most 2 commits and 3 re-reads within
COMMIT_RECOVERY_CAP, classified by a pureclassify_commit→Landed/StillOurs/Gone/Foreign/Unreadable. -
A successor with no home:
Gone, or afalsefromend_claimed, after a successful upstream refresh. The leader readsend_reasonand revokes the successor (revoke, 2 s) only forSignedOutorOperator, as canopy-web does (idp-integration.adoc, "an issuer that revokes related tokens could end the session that replaced it"). It reportsEnded(reason), orNoSessionwhen the reason is unreadable. -
Foreignafter the token was presented →end(RefreshLost), since the row may still hold the spent token. -
Identity revocation. Every end the engine writes, whether by a leader or a request, revokes the canopy-identity session with
FederationClient::revoke. The revoke runs in a detached task, bounded byUPSTREAM_LOGOUT_TIMEOUT(2 s, atokiotimeout around signing and sending), so a refusal upstream stops canopy-identity minting at once (G5) rather than atfresh_until. The one exception isIdentityRefused, where canopy-identity has already revoked the session or never had it. -
An unconfirmed commit leaves the claim to lapse.
-
Every store call is bounded by
STORE_OP_TIMEOUT. -
The outcome is one
tracingevent with a closedoutcomefield, never a token.
-
-
V6. Sign-in completion:
complete_sign_in(pending, returned_state, code, redirect_uri) → Result<WebSessionRecord, SignInError>.-
It runs
redeem, thenopen(id_token, access_token only under Userinfo), then recordsbinding()and V3’smaintain_at. -
canopy-web inserts the record under its own key (the switch).
-
A refused or failed open revokes the grant’s refresh token best-effort (2 s).
-
SignInError::{RelyingParty(RelyingPartyError), Federation(FederationError)};AuthTimeTooOldis canopy-web’s cue forprompt=login.
-
-
V7. Sign-out:
sign_out(key, post_logout_redirect_uri) → Result<SignedOut, StoreFault>, in canopy-web’s order (local end first). It answersSignedOut { ended: bool, identity_revoked: bool, upstream: UpstreamSignOut::{EndSession(Url), Revoked, RevocationFailed, PromptLogin} }; every variant butEndSessionleaves canopy-web to sendprompt=loginat the next sign-in, and each failure is reported and never blocks.-
end(key, SignedOut), which answers the ended record, so a leader’s commit can never fall between a read and the end. A fault →Err, with nothing revoked. -
With a record:
FederationClient::revoke, withinUPSTREAM_LOGOUT_TIMEOUT(2 s). -
Upstream, through the configured relying party:
-
A bound record:
end_session(record’s id_token, uri);Ok(Some(url))→EndSession(url);Ok(None)orErr→revokethe record’s upstream refresh token (D6) →RevokedorRevocationFailed, orPromptLoginwith no token. -
No record, or one bound to another upstream:
end_session(None, uri), as canopy-web does today for a sign-out with no live session (services/canopy-web/src/auth/mod.rs).Ok(Some(url))→EndSession(url); otherwisePromptLogin. An old provider’s token is never sent to the configured one.
-
-
Units
Every commit goes through the J1–J8 review. Each subject is at most 72 characters with its ` (#N)`.
Erratum (2026-10-09): the contract suite’s SHORT_LEASE is 500 ms, not 50 ms, so a networked store’s round trips find a fresh claim live. V3’s lease sum is 42 s, not 40 s: a foreign row’s end-reason read precedes its end. The engine tests use their own scripted canopy-identity, which echoes the renewal’s credential with now-relative times; identity_client/federation/tests.rs is unchanged. The memory store also gained fail_next_commit(), for the re-commit path. The devstack proof signs in five cast workers, one per test, so the broker’s per-person spacing does not serialize them. The leader’s foreign-row rule covers an end under the claim as well as a commit (ADR-049 Amendment 18’s as-built record).
-
U1 (#2819, w2)
docs(adr): record canopy-web’s session engine.-
ADR-049 Amendment 18 (R3, R4, V1–V7), plus the Status line.
-
This page (
In progress), with the** Identity Plane Split (epic &130)nav group above the archive line.
-
-
U2 (#2820, w3)
feat(auth): add the web session record and store contract(V2).-
New module:
crates/canopy-auth/src/identity_web_session.rs(types and trait), with re-exports inlib.rs. -
Under
test-helpers:-
identity_web_session/memory.rs:MemoryWebSessionStore, aparking_lot::Mutex<HashMap<u64, Row>>with leases ontokio::time::Instant. It copies a record out throughSessionCredential::parse(expose_for_wire())andUpstreamRefreshToken::restore, since the record has noClone. It offersinsert(record) → u64; the test hooksedit(key, FnOnce(&mut WebSessionRecord))(which steps the version),end_with(key, WebSessionEndReason),drop_next_commit_ack()(the commit lands and answersTimeout),fault_next_claim()(the claim lands and answersTimeout),foreign_clear(key)(clears a claim without stepping the version, the one state no protocol writer leaves),corrupt(key)(the row stops decoding) anddelay_ops(Duration)(every call waits first, still within itswithin); and claim and commit counters. -
identity_web_session/contract.rs:pub async fn check<S: WebSessionStore>(store: &S, seed: impl AsyncFn(WebSessionRecord) → S::Key, corrupt: impl AsyncFn(&S::Key)) → Result<(), ContractViolation>.corruptis the adapter’s own way to make a row undecodable, so the suite coversrecord: None,Claimed::Undecodableandendover an undecodable row. It is lib code, so it uses no panicking macro:ContractViolationnames the failed row, and the calling test assertsOk. It asserts every row of V2’s table and its three invariants, including: the lease lapsing (a 50 ms lease and a sleep); a lapsed claim never re-claimed or released; a foreign claim’s commit answeringNone;endanswering the record once and thenNone; andend_reasonafter each end. canopy-web’s store runs it at the switch.
-
-
Tests:
contract::checkover the memory store;WebSessionEndReason::as_strpinned; the compile-time probes (noDebug/Clone/Serializeon the record). -
Docs:
shared-crates.adoc.
-
-
U3 (#2821, w5)
feat(auth): keep web sessions fresh through one leader(V3–V5; #2345’s engine half).-
Files:
-
identity_web_session/decide.rs: puremaintain_at,decide,classify_commit; -
identity_web_session/engine.rs:WebSessionEngine<S>, a cheapCloneover anArc, withnew(UpstreamRelyingParty, FederationClient, S)andcurrent; -
UpstreamRelyingParty::renewal() → RefreshRenewal(pub const fn). The profile loader refuses mixed sources (F9), so it also says whether claims come from userinfo; -
UpstreamRelyingParty::binding() → UpstreamBinding: the profile’sissuer().as_str()andclient_id().as_str(), kept bynew; -
SIGN_DEADLINEmadepub(crate).
-
-
The scripted IdP (
upstream/relying_party/tests.rs) and the scripted issuer (identity_client/federation/tests.rs) becomepub(crate). The issuer gains a now-relative answer, since its stockanswer()dates are fixed in 1970. -
Every stale-path test sets both
fresh_untilandmaintain_atin the past throughedit: a stale session inside its retry spacing answersPending(V4’s step 7). -
Tests:
-
Functional:
-
decide's precedence, row by row; -
fresh and not due posts nothing;
-
fresh and due serves at once, and the detached leader commits (version + 1,
fresh_untiladvanced, token rotated); -
stale leads and serves within the budget;
-
each row of V5’s table, asserting the store’s record and what was posted;
-
no refresh token: never due; stale →
Expired; -
a stale session inside its retry spacing answers
Pendingand posts nothing; -
a grace already granted is not asked for again (no second
not_processedrenewal); -
a request that loses the claim waits and serves the winner’s version;
-
a record bound to another issuer or client ends
UpstreamChanged, and nothing reaches the scripted IdP; -
a refresh answering without a new refresh token or id_token keeps the record’s, both after a renewal and after a failed one;
-
a grace capped at
session_ends_atstays maintainable, and recovers at the next attempt; -
a 200 whose
fresh_untilis pastnow + FRESHNESS_SECONDS + 60 sschedules a retry, and a validation schedules at mostVALIDATION_CADENCEahead; -
every engine-written end except
IdentityRefusedposts one revocation to the scripted issuer.
-
-
Property:
maintain_at≥now + MAINTENANCE_RETRY, and, above that floor, ≤fresh_until − FRESHNESS_LEAD, ≤now + VALIDATION_CADENCEand ≤ anyAt(t);decidenever serves a stale row, never leads with the budget spent or inside the retry spacing, and never claims over a live or lapsed claim. -
Concurrency: 16 concurrent
currentcalls on a stale session together post exactly one refresh and one renewal, and so do 16 on a fresh, due one. -
Fault-injection:
-
a lost commit acknowledgement is recovered as
Landed, with no second refresh; -
a lapsed claim ends the session
RefreshLost; -
a budget shorter than a slow IdP answers
Pending, and the leader still commits; -
a slow store (
delay_ops) answersPendingby the deadline, never after it, on the read, the poll and the cleanup paths; -
a session ended mid-maintenance revokes the successor token for
SignedOutandOperator, and not forSuperseded; likewise when the renewal is refused after sign-out (end_claimedanswersfalse); -
a faulted claim presents nothing;
-
Foreignafter a presented token ends the sessionRefreshLost.
-
-
-
Docs:
shared-crates.adoc;idp-integration.adoc's renewal bullet names the engine.
-
-
U4 (#2822, w3)
feat(auth): complete sign-ins and sign out through the engine(V6, V7).-
File:
identity_web_session/engine/sign.rs:complete_sign_inandsign_outonWebSessionEngine. -
Tests:
-
the record a sign-in yields;
-
Userinfo sends the access token at open, and the id_token profile does not;
-
a refused open revokes the grant’s refresh token and surfaces the refusal;
-
sign-out ends first, then posts the federation revoke, then gives the end-session URL with the hint when advertised, or the upstream revoke when not;
-
with no record, sign-out still gives
end_session(None)'s URL when advertised, elsePromptLogin, and posts no revocation; -
with a record bound to another upstream, sign-out sends the configured upstream nothing of the record’s;
-
each leg’s failure is reported, not fatal;
-
a store fault revokes nothing.
-
-
Docs:
shared-crates.adoc.
-
-
U5 (#2823, w2)
test(auth): prove the session engine against the devstack.-
The test file:
crates/canopy-test-lib/tests/web_session_engine_test.rs.-
It reuses
upstream_relying_party_test.rs's construction: the profile,UpstreamHttpClient::resolving, theFederationClientkeyed as canopy-web,TokenBroker::upstream_sign_inandDriver::authorise_query. -
The store is
MemoryWebSessionStore(canopy-test-lib’s canopy-auth dependency enablestest-helpers).
-
-
The tests, with jane.doe:
-
complete_sign_inyields a record thatcurrentserves; -
each maintenance test first waits 1.1 s past the open’s second, as
upstream_relying_party_test.rsdoes, so the reissued id_token’siatis newer; -
editsetsmaintain_atin the past:currentserves, and the detached maintenance commits (version + 1,fresh_untiladvanced) against real Kanidm and canopy-identity; -
editsets bothfresh_untilandmaintain_atin the past: 8 concurrentcurrentcalls all serve one new version, and Kanidm’s rotating refresh never refuses, so single-flight holds; -
sign_out→ a delegation mint from the captured credential is refusedsession_ended, and the captured upstream refresh token isEnded; -
the upstream refresh token, revoked at Kanidm directly, ends the next maintenance
UpstreamEnded, and a delegation mint from the captured credential is then refusedsession_ended: the engine’s identity revocation.
-
-
Close:
-
CHANGELOG.adocAdded; -
Amendment 18’s as-built record;
-
the plan Done and archived;
-
plan-lint --donewith--allow-openfor U1–U5, #2344, #2345, #2521 and #2647; -
after merge, update the epic.
-
-
Scope
In: the record, the store trait, its contract suite and memory store; maintenance (V3–V5); sign-in completion; sign-out; the devstack proof.
Out:
-
The switch: canopy-web’s Postgres store and migration, its extractors, handlers, cookies, CSRF, flow store, metrics, and its mapping of
Unserved. -
I3e3: canopy-web’s sender, the
session_staleretry and the engine’s maintain-now entry it needs. -
Native-session revalidation: the device-approval plan.
-
#2521: encryption at rest.
Risks
-
A lapsed claim ends a fresh session (V4’s step 3): the token may be spent, and Kanidm’s rotation punishes a replay. With a 60 s lease, only a leader that died or lost its store loses its session.
-
A fresh, due session draws one claim attempt per concurrent request; only one wins. That is bounded by the request rate within one claim’s latency.
-
The memory store can diverge from Postgres semantics; the contract suite is the shared gate.
-
The last two minutes of a session: a validation there is capped at
session_ends_at, so maintenance retries every 30 s untilSERVE_MARGIN, about three renewals per session. That is accepted, so a grace capped there still recovers. -
Grace detection assumes canopy-web’s clock is within D9’s 60 s of canopy-identity’s. Past that skew, a grace reads as a validation, and
VALIDATION_CADENCEstill bounds the interval. -
Repeated grace requests: a deployment whose grace is under
FRESHNESS_LEAD, or a session stale through a long upstream outage, asks for grace on each 30 s retry a request triggers. Each adds an audit row, which is accepted.
Verification
-
Per unit: fmt; clippy with validate’s flags; quality-budgets, plan-lint, check-docs and private rustdoc.
-
nextest:
-
canopy-auth with and without
test-helpers(U2–U4); -
cargo xtask test --integration --host -p canopy-test-lib --no-refresh --skip-static(U5).
-
-
Per MR: the pre-push battery.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic |
Claude Opus 5.5 (fresh subagent) |
no-ship. Two blockers, fixed in-plan:
|
2 |
not stated (the maintainer’s other vendor) |
not stated |
8 findings (1 P1, 6 P2, 1 P3), fixed in-plan:
|
The maintainer shipped after round 2 (2026-10-09).