From 90276285ccaed83453d1084c4856d20f81ac5a83 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 10:22:01 +0000 Subject: [PATCH] fix(fleet-stubs): a placeholder it cannot create is not the fleet's failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main went red on the merge of #118. policy-worker's pre-deploy exited 1 on fleet-stubs: creating lumen-billing-worker-stage: HTTP 403 code 10037, "You have exceeded the limit of 500 Workers on your account." and because every binding holder waits on policy-worker with `mode: enforced`, ten lanes went red on a step belonging to a component that was itself fine. The placeholder was never needed by most of them. A create that fails is now reported and skipped, not fatal. Each real deploy then speaks for itself: a target genuinely still missing fails ITS OWN lane with Cloudflare 10143, naming the worker that needs it, and an account with no room fails the deploy that needs the room, with 10037. Both land on the component an operator must act on, which is never policy-worker. The existence check stays fatal when it answers neither 200 nor 404 — that one is a safety property: a placeholder must never overwrite a real Worker the check failed to see. This does not make the convergence green. The account is at its 500-Worker limit, so the deploys that need a new script cannot succeed either; that needs Workers deleted on the account, which no change here can do. What it fixes is one unmakeable placeholder taking the whole fleet down with it, and the error landing on the wrong component. Also, two failure modes made legible: - 05-edge and 06-console said "the failing step says why" when the failing step was the URL probe and the convergence was green. They now distinguish the two, and name the usual cause: a `subdomain` that is not the Cloudflare account's workers.dev subdomain. A deploy lane smokes the URL wrangler actually returned, so a wrong `subdomain` passes every lane and first surfaces in a phase's verify, ~35 minutes in. Seen on a build carrying `test-lum`, which is not a claimed subdomain. - BOOTSTRAP.md gains a troubleshooting row for each. testing/fleet-stubs.test.sh drives the new path against a fake API that answers every create as an account at its limit: the step exits 0, names each placeholder it could not create, says a still-missing target will fail its own deploy by error code, and records nothing as created. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01BfmHkwWeA1oPJGBNF3QSQH --- BOOTSTRAP.md | 2 ++ repo-blueprint.yaml | 4 +-- testing/fleet-stubs.test.sh | 34 +++++++++++++++++++++++++ tooling/deploy/fleet-stubs.mjs | 45 +++++++++++++++++++++++++++++++--- 4 files changed, 79 insertions(+), 6 deletions(-) diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index d83c8d1..cef4e9a 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -388,6 +388,8 @@ purpose, written down so they read as instructions rather than breakage. | `/health` probes fail against a green deploy | Check `subdomain` first: it must be the Cloudflare account's workers.dev subdomain, and the default is a placeholder. A console build reads it from the Cloudflare connection; a hand-run build passes it with `--set`. | | CLI login dies with 429 `rate_limited` | Fixed ≥ v2.48.1 (redeem honours Retry-After). Upgrade the CLI. | | `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, or an action `has no parameter "githubOwner"` / `"sha"` / `"checks"` / `"secrets"` / `"background"` | The CLI is below the v2.88.0 floor. This blueprint is not readable by an older one. | +| A phase's `verify` reports `no such host` for every URL, with a GREEN convergence | The deploy worked; the addresses are wrong. `subdomain` must be the Cloudflare account's own workers.dev subdomain — a deploy lane smokes the URL wrangler actually returned, so a wrong `subdomain` passes every lane and first surfaces here. Check it with `curl -s -o /dev/null -w '%{http_code}\n' https://-api-edge-stage..workers.dev/health`: `000` means the name does not resolve. Fix `subdomain` in `.rebrand/values.json`, re-run `rebrand.mjs`, and re-run the phase. Seen on a build that carried `test-lum`, which is not a claimed subdomain. | +| `fleet-stubs: could not create placeholder …` with Cloudflare `10037` | The account is at its 500-Worker limit. The pre-deploy continues (a placeholder it cannot make is not policy-worker's failure), but no new script can be created, so the deploys that need one fail next with the same code. Delete unused Workers on the account; nothing in the repo can work around an account limit. | | `! [rejected] orun/BASE-n- (non-fast-forward)` on a retry | A build that stopped between the pen's push and the merge left that branch on the remote, and the retry commits a sibling of it. Each landing's `pen-reset` hook clears it (`tooling/bootstrap/pen-reset.mjs`); if you are on a baseline without that hook, delete the branch — `git push origin --delete orun/BASE-n-`, which also closes its pull request — and re-run the phase. Do NOT `git pull`: the branches have diverged, and merging the abandoned commit back in lands a doubled diff. | | The build stops with nothing failed, no merge and no convergence | Its `ORUN_TOKEN` very likely expired: `orun auth token` mints a short-lived one (~30m) and a full bootstrap is longer. Use the workspace's admin-role API key, or point `ORUN_TOKEN_FILE` at a file something keeps fresh — the CLI re-reads it on every call. Seen on pullely/multi-tenant-saas (2026-10-25): 46/46 PR checks green at 30m46s, then no merge and no further platform event. | | A fresh build stops before 01-scaffold: `✕ phase "04-workers" precondition "wiring" is not met: … project "" not found` | The CLI is below v2.58.10, which asks the preflight about the product's project before phase 01 has created it and calls the answer a failure. Upgrade; the probe is then deferred to phase 04. | diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index a7684c2..4ef7fba 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -1681,7 +1681,7 @@ phases: narrate: start: 'Deploying the API edge in front of the twelve services.' done: 'The edge is live on stage and prod, answering /health, in {{ .meta.elapsed }}.' - failed: 'The edge did not come up; the failing step says why.' + failed: 'The edge did not come up. The failing step says which: a red convergence is the deploy; a verify whose addresses do not resolve means the addresses are wrong — check that `subdomain` is this Cloudflare account''s workers.dev subdomain.' modules: [api-edge, api-edge-tests, platform-limits-tests] requires: # A GATE MAY ONLY NAME A PHASE THAT PLACES FILES. This used to require @@ -1798,7 +1798,7 @@ phases: narrate: start: 'Building and deploying the web console.' done: 'The console is live on stage and prod, in {{ .meta.elapsed }}.' - failed: 'The console did not come up; the failing step says why.' + failed: 'The console did not come up. The failing step says which: a red convergence is the deploy; a verify whose addresses do not resolve means the addresses are wrong — check that `subdomain` is this Cloudflare account''s workers.dev subdomain.' modules: [cloudflare-domain, web-console-next, web-console-next-tests] requires: phases: [05-edge] diff --git a/testing/fleet-stubs.test.sh b/testing/fleet-stubs.test.sh index 1ad22a8..127dbdf 100755 --- a/testing/fleet-stubs.test.sh +++ b/testing/fleet-stubs.test.sh @@ -45,6 +45,15 @@ const server = http.createServer((req, res) => { res.writeHead(exists ? 200 : 404); return res.end("{}"); } if (req.method === "PUT" && !m[2]) { + // `$dir/full` makes every create answer as an account at its Workers + // limit does — the condition that took lumen's own fleet down. + if (fs.existsSync(`${dir}/full`)) { + res.writeHead(403); + return res.end(JSON.stringify({ + success: false, + errors: [{ code: 10037, message: "You have exceeded the limit of 500 Workers on your account." }], + })); + } fs.appendFileSync(`${dir}/puts`, `${name}\n`); fs.writeFileSync(`${dir}/upload-${name}`, body); res.writeHead(200); return res.end("{}"); @@ -80,6 +89,31 @@ echo "── refusals" CLOUDFLARE_API_TOKEN=wrong ORUN_ENVIRONMENT=stage node "$tool" --root "$root" >/dev/null 2>&1 && bad "an unexpected check answer (403) fails" || ok "an unexpected check answer (403) fails" env -u ORUN_ENVIRONMENT node "$tool" --root "$root" >/dev/null 2>&1 && bad "no environment fails" || ok "no environment fails" +echo "── a placeholder it cannot create is not this component's failure" +# THE REGRESSION THIS GUARDS. This step runs in policy-worker's pre-deploy and +# every binding holder waits on policy-worker with `mode: enforced`, so exiting +# non-zero here failed the WHOLE fleet on both environments. It did exactly +# that on lumen's own main convergence (2026-10-25): the account was at its +# 500-Worker limit, `lumen-billing-worker-stage` could not be created, and ten +# lanes went red on a step belonging to a component that was itself fine. +: > "$tmp/exists"; : > "$tmp/puts"; : > "$tmp/full" +if out="$(node "$tool" --root "$root" --env stage 2>&1)"; then + ok "a create it cannot do exits 0 — the real deploys decide" +else + bad "a create it cannot do still fails the step (exit $?) — the fleet-wide regression is back" +fi +grep -q "could not create placeholder" <<<"$out" \ + && ok "it names each placeholder it could not create" \ + || bad "it is silent about the placeholders it could not create" +grep -q "10143" <<<"$out" \ + && ok "it says a still-missing target will fail its own deploy, by error code" \ + || bad "it does not say what happens next" +grep -q "Workers limit" <<<"$out" \ + && ok "it recognises an account at its Workers limit" \ + || bad "it does not recognise the 10037 limit answer" +[ ! -s "$tmp/puts" ] && ok "nothing was recorded as created" || bad "something was recorded as created" +rm -f "$tmp/full" + echo "── the plan's side: every binding holder waits on policy-worker on main" holders=0; missing="" for t in "$root"/apps/*/wrangler.template.jsonc "$root"/apps/*/wrangler.jsonc; do diff --git a/tooling/deploy/fleet-stubs.mjs b/tooling/deploy/fleet-stubs.mjs index 176c78d..68a3133 100755 --- a/tooling/deploy/fleet-stubs.mjs +++ b/tooling/deploy/fleet-stubs.mjs @@ -124,12 +124,14 @@ async function main() { const script = (name) => `${base}/accounts/${account}/workers/scripts/${encodeURIComponent(name)}`; const created = []; + const refused = []; for (const name of targets) { const res = await fetch(`${script(name)}/settings`, { headers: auth }); if (res.ok) continue; if (res.status !== 404) { // Not "missing" and not "there": refuse to guess, or a placeholder - // could replace a real Worker the check failed to see. + // could replace a real Worker the check failed to see. This one IS + // fatal — it is a safety property, not a convenience. console.error(`fleet-stubs: checking ${name}: HTTP ${res.status} ${await res.text()}`); process.exit(1); } @@ -138,15 +140,50 @@ async function main() { form.append("stub.mjs", new Blob([STUB], { type: "application/javascript+module" }), "stub.mjs"); const put = await fetch(script(name), { method: "PUT", headers: auth, body: form }); if (!put.ok) { - console.error(`fleet-stubs: creating ${name}: HTTP ${put.status} ${await put.text()}`); - process.exit(1); + // A PLACEHOLDER THAT CANNOT BE MADE IS NOT THIS COMPONENT'S FAILURE. + // + // This step runs in policy-worker's pre-deploy, and every binding + // holder waits on policy-worker with `mode: enforced` — so exiting + // non-zero here failed the ENTIRE fleet, on both environments, for a + // placeholder that most of those Workers never needed. It did exactly + // that on lumen's own main convergence (2026-10-25): the account was at + // its 500-Worker limit, `lumen-billing-worker-stage` could not be + // created, and ten lanes went red on a step belonging to a component + // that was itself fine. + // + // So: say what happened, and let each real deploy speak for itself. A + // target that is genuinely still missing when its dependent deploys + // fails THAT lane with Cloudflare's own 10143, naming the worker that + // needs it; an account with no room fails the deploy that needs the + // room, with 10037. Both land on the component the operator must act + // on, which is never this one. + refused.push({ name, status: put.status, body: (await put.text()).slice(0, 400) }); + continue; } created.push(name); } + + for (const r of refused) { + console.error(`fleet-stubs: could not create placeholder ${r.name}: HTTP ${r.status} ${r.body}`); + } + if (refused.length) { + const atLimit = refused.some((r) => r.body.includes("10037") || /limit of \d+ Workers/.test(r.body)); + console.error( + `fleet-stubs: ${refused.length} of ${targets.length} placeholder(s) in ${env} could not be created; ` + + `continuing. A Worker whose binding target is still missing will fail its OWN deploy with ` + + `Cloudflare 10143, naming it.` + + (atLimit + ? ` The account is at its Workers limit (10037) — no new script can be created, placeholder or real, ` + + `until some are deleted; the deploys that need a new script will fail next, for the same reason.` + : ""), + ); + } console.log( created.length ? `fleet-stubs: ${created.length} placeholder(s) in ${env}, replaced by each Worker's first deploy: ${created.join(", ")}` - : `fleet-stubs: all ${targets.length} binding targets in ${env} exist; nothing to do`, + : refused.length + ? `fleet-stubs: no placeholder was created in ${env}` + : `fleet-stubs: all ${targets.length} binding targets in ${env} exist; nothing to do`, ); }