Skip to content

refactor(api): park provider grants in their own table, out of auth_codes - #381

Merged
kYem merged 4 commits into
mainfrom
kes/eng-136-move-parked-notion-grants-out-of-auth_codes-into-their-own
Oct 4, 2026
Merged

kYem merged 4 commits into
mainfrom
kes/eng-136-move-parked-notion-grants-out-of-auth_codes-into-their-own

Conversation

@kYem

@kYem kYem commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Fixes ENG-136

Parked Notion grants move from auth_codes into a new parked_provider_grants table (migration 0012, which carries any in-flight rows across). Sign-in sweeps lose their json_extract provider filters, and /v1/auth/token no longer imports routes/notion.ts.

Behaviour change: a Notion code sent to /v1/auth/token is now just unknown (401). It is no longer burned and revoked, so it stays claimable at /claim behind PKCE, or the cron revokes it on expiry. A sign-in code sent to /claim is likewise refused without being burned.

Deploy: apply 0012 remotely before deploying the Worker. Between the two, the old Worker could still park a grant in auth_codes, which the new one would then sweep without revoking. That can't happen today, since prod has no NOTION_CLIENT_ID and cannot start a Notion connect.

Migration checked against a seeded local D1: the parked row moves with every field, and the sign-in code stays.

kYem added 4 commits October 3, 2026 21:17
…odes

Sign-in codes and parked Notion grants no longer share a table, so the sweeps
lose their JSON provider filters and /v1/auth/token no longer imports the
Notion routes. Migration 0012 moves any in-flight parked grants across.
…ploy note

Documents that 0012 and its Worker must both be live before Notion is enabled.
@kYem
kYem merged commit 1d8c671 into main Oct 4, 2026
10 checks passed
@kYem
kYem deleted the kes/eng-136-move-parked-notion-grants-out-of-auth_codes-into-their-own branch October 4, 2026 02:13
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