diff --git a/.github/renovate.json5 b/.github/renovate.json5 index d6646407..4e29a6ad 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -163,7 +163,7 @@ matchPackageNames: ["wrangler", "@cloudflare/vitest-pool-workers"], groupName: "cloudflare worker toolchain", prBodyNotes: [ - "**Regenerate the worker types on this branch BEFORE merging** - this PR cannot go green without it. A wrangler bump moves `workerd`, and `wrangler types --check` compares that version as well as the config hash, so `types:check` fails inside `preview:test` inside the required `verify` check. Run `pnpm --filter @fmw/preview-worker exec wrangler types && pnpm vp check --fix` and commit the result. The formatter pass is not optional - wrangler emits tabs and unwrapped types, so a raw regen buries the real one-line change in a whole-file whitespace diff.", + "**Regenerate the worker types on this branch BEFORE merging** - this PR cannot go green without it. A wrangler bump moves `workerd`, and `wrangler types --check` compares that version as well as the config hash, so `types:check` fails inside `preview:test` inside the required `verify` check. Run `pnpm run types:sync` and commit the result. That script is `wrangler types && vp check --fix` together, and the formatter half is not optional - a raw `wrangler types` buries the real one-line change in a whole-file whitespace diff (25,411 lines vs 1, measured on #169).", ], }, { diff --git a/CLAUDE.md b/CLAUDE.md index 44f2b504..32bbb1c5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -400,11 +400,12 @@ correctly - confirmed on 2026-08-10 when #169 hit exactly this. The regen is a precondition, not a follow-up: `types:check` runs inside `preview:test`, which runs inside the required `verify` check, so a stale `workerd` stamp means the PR cannot merge at all. This is not hypothetical - it is why #97 sat red, and why -#169 arrived red a year later with the fix named in its own PR body. The -command, with the formatter pass that is **not** optional: +#169 arrived red a year later with the fix named in its own PR body. The fix is +one script, which exists precisely so the formatter pass cannot be forgotten +(#177): ```bash -pnpm --filter @fmw/preview-worker exec wrangler types && pnpm vp check --fix +pnpm run types:sync ``` One interaction is worth knowing before touching that file. The workspace's @@ -841,11 +842,14 @@ type error, so both `vp check` and the worker tests pass with a wrong value in it. `wrangler types --check` now gates the worker's `test` and `deploy` scripts, so `pnpm preview:test` fails loudly on drift. -- Regenerate with - `pnpm --filter @fmw/preview-worker exec wrangler types && pnpm vp check --fix`. - The formatter pass is **not optional** - wrangler emits tabs/unwrapped types - and the repo formats to 2-space/wrapped, so a raw regen shows a whole-file - whitespace diff that hides the real change. +- Regenerate with **`pnpm run types:sync`**, which is + `wrangler types && vp check --fix` in one step. Use the script rather than the + bare `wrangler types`: the formatter pass is **not optional** - wrangler emits + tabs/unwrapped types and the repo formats to 2-space/wrapped, so a raw regen + shows a whole-file whitespace diff that hides the real change. Measured on + #169: raw regen = 25,411 lines changed, after the formatter = **1**. Bundling + them is the whole point of #177; do not "simplify" the script back to one + command. - **`--check` compares two things, and the second one surprises people.** It checks the config against the hash in the generated file's header, AND the **`workerd` version** stamped on the line below it. Both halves were observed diff --git a/README.md b/README.md index 0e1afb92..95fea94b 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ and Workers Paid ($5/mo, required for Containers): ``` pnpm --filter @fmw/preview-worker exec wrangler r2 bucket create fmw-preview-cache # fill REPLACE_WITH_APP_ORIGIN in preview-service/worker/wrangler.jsonc, then: -pnpm --filter @fmw/preview-worker exec wrangler types +pnpm run types:sync # wrangler types + the formatter pass; never run the first alone pnpm preview:deploy # set VITE_PREVIEW_SERVICE_URL and fill REPLACE_WITH_WORKER_ORIGIN in public/_headers pnpm vp build diff --git a/package.json b/package.json index e6c2095c..622b7cf0 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "perf": "FMW_PERF=1 vp test test/render-cost.perf.spec.ts && cat perf-result.txt", "check": "vp check --fix", "check:vue": "vue-tsc --noEmit", + "types:sync": "pnpm --filter @fmw/preview-worker exec wrangler types && pnpm vp check --fix", "refs:sync": "bash scripts/sync-factorio-refs.sh", "verify:deploy": "node scripts/verify-deploy.ts", "verify:lint": "vp check && pnpm run check:vue",