Skip to content

Commit 04875ee

Browse files
Merge pull request #318 from GenerationSoftware/docs/oauth-startup-recovery-2026-10-30
Document recovery when Worker startup failures block deployment
2 parents 24cf99c + 0aa21d2 commit 04875ee

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎docs/package-migration.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ window may need a deliberate reload. Small root HTML is never restored from an o
182182

183183
## Rollback
184184

185+
If a current Worker startup failure blocks the live API prerequisite for a fix,
186+
follow [production startup recovery](production-startup-recovery.md) to restore
187+
a compatible working version before rerunning the normal deployment workflow.
188+
185189
Use **`ff4b51b`**, which retains all new APIs while restoring legacy page ownership.
186190
Never revert database state or rename/recreate a Worker to roll back the frontend.
187191
In an isolated anchor checkout, build legacy CSS; restore the last current/retained
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Recovering a Worker startup failure
2+
3+
The production workflow requires a healthy `/api/v1/session` response before
4+
deployment. A Worker startup exception can therefore block deployment of its own
5+
fix. Restore a compatible working Worker version first, then rerun the normal
6+
workflow with every release gate enabled.
7+
8+
## Recovery procedure
9+
10+
1. Read the attached Reflection integration metadata and use the documented
11+
Cloudflare API proxy. Start a temporary Worker tail and reproduce the failure
12+
with read-only health and session requests. Record the exception and deployed
13+
version ID; avoid saving request headers, bodies, or credentials.
14+
2. Inspect the Worker's deployment history and version metadata. Select the most
15+
recent compatible working version. Check its code, runtime, bindings, assets,
16+
and Durable Object migration tag. A version created by a secret update before
17+
a broken code deployment may retain the working code with the current secrets.
18+
Do not force a rollback across changed secrets or incompatible state.
19+
3. Use Cloudflare's [Create Worker Deployment API](https://developers.cloudflare.com/api/resources/workers/subresources/scripts/subresources/deployments/methods/create/)
20+
to route 100% of requests to the selected version. This activates an existing
21+
version; it does not revert database migrations or recreate state resources.
22+
4. Verify `/healthz` returns `200` with `{"ok":true}` and an anonymous
23+
`/api/v1/session` request returns `200` with `{"authenticated":false}` and
24+
`X-Factorize-Contract: gen-2157-static-v1`. Run:
25+
26+
```sh
27+
node scripts/verify-public-routing.mjs https://app.factorize.sh
28+
```
29+
30+
5. Rerun the failed production workflow for the merged fix. Monitor the API
31+
prerequisite, asset retention, migrations, Worker deployment, and final public
32+
verification. Verify the live version and anonymous browser loading again
33+
after completion. Do not leave a temporary rollback as the final release.
34+
6. Delete the temporary Worker tail and preserve the recovery evidence in a PR.
35+
36+
## 2026-10-30 OAuth scope incident
37+
38+
Cloudflare tails captured `TypeError: scopesSupported must not contain duplicate
39+
values` on health, session, and internal trace-upload requests. `runs:write` had
40+
become a canonical access scope but was also appended to the provider's legacy
41+
scope list. OAuth provider construction threw before backend dispatch.
42+
43+
[PR #317](https://github.com/GenerationSoftware/factorize/pull/317) deduplicated the
44+
provider scope list, but its first deployment failed at the live session gate.
45+
The failing production version was `ee5e4bf5-9b57-4182-b5ce-2c641d351d3e`.
46+
47+
Recovery activated `aae2319a-c571-4be8-91e1-a3e7d1c4ef37`, whose script and runtime
48+
matched the preceding working deployment and whose secrets were from the latest
49+
pre-deploy secret update. Recovery deployment
50+
`93089924-e637-4093-a9fa-c179fea8adc5` restored health and session responses at
51+
01:14 UTC. Public routing/security/cache verification and an anonymous Chromium
52+
page load passed, with no JavaScript page errors. The normal
53+
[deployment workflow](https://github.com/GenerationSoftware/factorize/actions/runs/40984395531)
54+
was then rerun for merged commit `24cf99c`.

0 commit comments

Comments
 (0)