Repository navigation
feat(oidc): consume provider records atomically and report the winner - #538
Merged
Merged
Conversation
Bccorb
marked this pull request as ready for review
November 1, 2026 01:26
Bccorb
force-pushed
the
feat/oidc-atomic-consume
branch
from
November 1, 2026 01:48
2c5d6c3 to
5b4a3fc
Compare
Bccorb
force-pushed
the
feat/oidc-atomic-consume
branch
from
November 1, 2026 02:01
5b4a3fc to
7bba787
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Atomic refresh consume for the OpenID Provider (epic #387).
Stacked on #537. Uses
@seamless-auth/types0.34.0-next.4 (fells-code/seamless-auth-types#139 adds the response schema).What changed
POST /oidc/payloads/:model/:id/consumeanswers200 { consumed }instead of204.consumeOidcPayloadsetsconsumedAtin oneUPDATE ... WHERE "consumedAt" IS NULL AND "expiresAt" > now, andconsumedis true only when that update changed the row. Before, the route ran the same update but never said whether it was first. Two refreshes with the same token both passed the library'sconsumedcheck, both consumed, and both rotated. Now exactly one wins, and the edge treats the other as reuse (fells-code/seamless-auth-oidc-provider,feat/atomic-refresh-consume).Contract
A response shape change on one
/oidc/*route. Only the provider service calls it, and it moves in the same release.Checks (against types 0.34.0-next.4)
npm run typecheck,npm run lint,npm run format:check: cleannpm run test:run: 2731 passedTEST_DB=postgrestests/postgres/oidcProvider.spec.ts: 15 passed, including a new test where 8 concurrent consumes of one refresh token produce exactly onetrueinvalid_grant, the session ended as reuse, and the second app was sent to sign in. The edge logged no server error. Before this change, both rotated.