Skip to content

Authorize org membership from the local mirror - #2007

Closed
RhysSullivan wants to merge 2 commits into
member-directory/reconcilerfrom
member-directory/auth-cutover
Closed

RhysSullivan wants to merge 2 commits into
member-directory/reconcilerfrom
member-directory/auth-cutover

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Layer 5 of 5. Cloud only. Takes WorkOS off the per-request path.

  • authorizeOrganization reads MemberDirectory.membership instead of calling WorkOS. Active status required; role mapping unchanged. Admin gates on the account, admin, and org planes use the role the authorize step resolved. The membership ownership check on remove and role change is one point read. The org switcher and free-org limit read membershipsOf.
  • The mirror is trusted only while it is ready: the backfill has completed and the reconciler has drained within the last ten minutes. Until then the check falls back to WorkOS exactly as before, so nobody is locked out and nobody revoked during an outage is let in. An org the mirror has never seen is resolved from WorkOS on demand for a caller WorkOS confirms as a member.
  • Org deletion order is now mark deleted locally, cancel billing, delete in WorkOS, purge. A retry after a partial deletion is admitted from the mirror.
  • Deploy gate: deploy.yml runs scripts/ensure-workos-mirror-ready.ts after migrations. It runs the backfill if needed, drains the events stream itself, and fails the deploy if the mirror is still not ready.
  • Unused WorkOS wrapper methods removed.

Ops step (cloud): add WORKOS_API_KEY to the production GitHub environment so the deploy gate can run the backfill. Removal in the WorkOS dashboard now takes effect when the event lands, normally seconds and at most about a minute. Removal through Executor stays immediate.

@RhysSullivan
RhysSullivan added this pull request to stack #2008 September 15, 2026 11:05
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 15, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud bb51c96 Sep 16 2026, 04:29 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 15, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing bb51c96 Commit Preview URL

Branch Preview URL
Sep 16 2026, 04:26 PM

@RhysSullivan
RhysSullivan force-pushed the member-directory/auth-cutover branch from a0910e4 to bb51c96 Compare September 16, 2026 16:24
@RhysSullivan
RhysSullivan force-pushed the member-directory/reconciler branch from d2d7740 to 6ca0929 Compare September 16, 2026 16:24
@RhysSullivan
RhysSullivan removed this pull request from stack #2008 September 16, 2026 16:26
@RhysSullivan

Copy link
Copy Markdown
Collaborator Author

Recreated with the correct base after the stack was reordered (reconciler now sits below readers).

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare preview

Console https://executor-preview-pr-2007.executor-e2e.workers.dev
MCP https://executor-preview-pr-2007.executor-e2e.workers.dev/mcp
Deployed commit bb51c96

Sign-in is Cloudflare Access (one-time PIN to an allowed email). The preview has its own database and encryption key; it is destroyed when this PR closes.

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