Repository navigation
Description
PR #872 removes a source-scanning audit ledger that recorded known gaps but did not prove events fired. This issue preserves its 13 debt entries, as requested in review. These are existing gaps, not new regressions from the test cleanup.
Source ledger: pending-authorization-audit-ledger.test.ts at c19d0653. Most transitions are in server/src/plugins/route-groups/connections.ts; store writes are in server/src/plugins/plugin-store.
Dusty confirmed all 13 gaps are still current. The three items marked Priority below should be addressed first: consent can remain live at the vendor with only a console line as the record.
Missing lifecycle audit coverage
- Claim (
claimAuthorizationAttempt, B5e): record who started which consent attempt. - Expiry overwrite/re-claim (same call, B5e): record the previous attempt's ending before ON CONFLICT replaces it.
- Discard after vendor mint refusal (
arcade-refused-attempt-not-cleared, B5e): record the refusal/ending, not only cleanup-failure logging. - Priority — Discard after successful mint cannot be recorded (
arcade-mint-not-recorded, B5e): record that a consent flow may remain live at the vendor. - Mint recorded (
recordAuthorizationMint,authId: minted.authorizationId, B5e): audit the attempt being bound to a vendor authorization without exposing its secret identifiers. - Vendor reports failed consent (
failAuthorizationAttempt,settled.status === "failed", B5e): record the terminal verdict. - Completed consent has the wrong identity (
failAuthorizationAttempt,settled.userId !== attempt.vendorUserId, B5e): record the attribution refusal. - Context changed and vendor withdrew retired grant (
markAuthorizationWithdrawn, B5e): audit the attempt's verdict; account-disconnection rows alone do not describe it. - Priority — Person no longer permitted to act; grant not withdrawn (
markAuthorizationUnreconciled,arcade-completion-not-permitted, B5e): record the closed attempt and potentially live vendor consent. - Priority — Context changed and withdrawal unconfirmed (
markAuthorizationUnreconciled, B5e): record the unresolved grant rather than only a console line. - App/server removal cascade (
pending_authorizations_server_id_mcp_servers_id_fk, B5e): identify affected in-flight attempts; configuration-change rows currently describe released grants only. - Actor removal cascade (
pending_authorizations_actor_id_users_id_fk, B5e): identify attempts that die with the actor, including potentially live vendor consent. - Cancel loses race to completion (
That authorization finished before it could be cancelled, B2c): audit the refused cancellation (409) even though no pending row is deleted.
Acceptance
Exercise each transition through behavior tests and assert the persisted audit event, actor, attempt correlation, and safe payload. Do not log bearer consent URLs or live authorization IDs. Keep the existing successful completion and cancellation events; avoid duplicate attempt-ending events when a cancelled attempt is encountered by a late mint/completion. The original ledger waived those two late-return branches because cancellation had already been audited.
Re-check each gap against current code when implementing; the list preserves the historical findings rather than claiming a new runtime reproduction of all 13.
Activity
dustywusty commentedon Oct 28, 2026
I checked this against the ledger at
c19d0653. All 13 debt entries are here: 10 lifecycle transitions, 2 FK cascades and the B2c cancel race. The two waived late-return branches are left out, and the acceptance criteria explain why. Every ledger anchor still exists inconnections.tson current main, and no attempt-lifecycle audit events have been added since, so all 13 gaps are still current.One suggestion: mark three items as priority. In each, consent can stay live at the vendor with only a console line as the record:
Hotragn commentedon Nov 7, 2026
A status update, since the checklist above predates #895.
Two of the three Priority items are now recorded. #895 (merged Oct 31, three days after the confirmation above) made
closeAuthorizationAttemptinplugin-store/context.tswritemcp.authorization_unreconciledin the same transaction as the verdict. Both of these go through it viamarkAuthorizationUnreconciled:connections.ts:2481)connections.ts:2631)The third Priority item is still a console line only: "Discard after successful mint" (
arcade-mint-not-recorded,connections.ts:1780). It callsdiscardAuthorizationAttempt, not the unreconciled path. It is also the hard one: it fires because the database just refused a write, so an audit row, which is another database write, may well fail the same way. That probably needs its own design rather than arecordAuditEventbeside the log line.Three more items share the function #895 changed.
closeAuthorizationAttemptis the one transition behindfailAuthorizationAttempt,markAuthorizationUnreconciledandmarkAuthorizationWithdrawn, but it writes a row only whenoutcome === "unreconciled". So these are still unrecorded, and all fixable in that one place:failed)failed)withdrawn)I am picking those three up in one PR so the work is not duplicated. One thing worth flagging now: the two
faileditems arrive at the same outcome, so a row written fromcloseAuthorizationAttemptalone cannot tell the person declined from the consent completed on the wrong identity. The second is an attribution refusal and the first is routine, so the PR will need to carry the reason through.