`pnpm run verify` — the command this repo's definition of done names — exits
non-zero on a clean checkout of main, for two independent reasons that have
nothing to do with any change. CI cannot see either one.
**1. Generated output from tooling that was removed.**
#254 replaced contentlayer with bip-kit and deleted the `.contentlayer` line
from frontend/.prettierignore. Correct — the tool is gone. But the directory it
generated survives in every checkout that had built the blog before then, and
losing the ignore entry moved it from "invisible" to "in prettier's scope".
Prettier cannot parse its import assertions, so `format:check`, the FIRST gate,
died with a SyntaxError naming a generated file nobody wrote. A fresh clone has
no such directory, which is exactly why CI is green.
Two checkouts here had it, including the worktree of a session running right
now, whose verify is red for this reason as I write it. So preflight grows a
fourth check — same shape as the stale-node_modules one, and covering every
worktree rather than just the current one:
! generated output from removed tooling: frontend/.contentlayer
.claude/worktrees/complete-fetch/frontend/.contentlayer
`--fix` deletes them. Proved by recreating the exact stale state, watching the
read-only run flag both paths, then watching --fix clear them.
**2. A required artifact that no step in the gate produced.**
`typecheck` ran `tsc` against a Prisma client that only ever got generated by
`@prisma/client`'s own postinstall hook, or by `build` — which runs *after*
typecheck. The hook fires in CI; it did not fire here, because pnpm gates
dependency build scripts and caches their side effects. So a clean
`pnpm install --frozen-lockfile` left the client ungenerated and verify died:
src/lib/db.ts(1,10): error TS2305: Module '"@prisma/client"'
has no exported member 'PrismaClient'.
Reproduced from an empty node_modules twice before changing anything. The fix
is not to re-approve a hook: a gate should not depend on an install side
effect it does not control. `typecheck` now runs `prisma generate` itself
(~300ms) and the artifact exists because the step that needs it made it.
Both fixes are the same principle — `verify` must depend on the repo, not on
what a previous install or a previous version of the tooling happened to leave
behind. The CLAUDE.md build section is corrected alongside: it still described
contentlayer as the blog pipeline and told the reader to run
`pnpm exec contentlayer build`, which would have recreated failure #1.
verify, from a wiped frontend/node_modules: prettier ok, lint 0 errors / 152
warnings, tsc clean, 96/96 tests (76 frontend + 20 backend), build ok.
Claude-Session: https://claude.ai/code/session_01LKTTAr8jsTvoZN6HneFtK9
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
#243 migrated frontend/backend from package-lock.json to pnpm-lock.yaml, but
preflight.sh's staleness check still watched package-lock.json. Once that file
was deleted, `[[ -f "$lock" ]] || continue` silently no-op'd the check for both
packages, so a checkout still holding pre-migration npm-flat node_modules
reported "Preflight clean." This checkout hit exactly that: five commits and
the pnpm migration stale, undetected until `pnpm run verify` would have run
against the wrong toolchain layout.
Point the check at pnpm-lock.yaml/.modules.yaml and reinstall via
`pnpm install --frozen-lockfile` (wiping the old npm-flat node_modules first,
since pnpm's symlinked layout doesn't cleanly overwrite it).
Co-authored-by: Mao Nakamoto <maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Three separate sessions have now opened this repo, found the working copy
silently wrong, and spent part of the run repairing it before any real work
could start:
2026-08-29 local main held a commit origin never got, so `git pull --ff-only`
failed for every run entering the repo.
2026-08-31 local main was 2 commits behind origin (#232, #233).
2026-09-02 local main was 3 commits behind (#234-#236), two squash-merged
worktrees were still checked out, and frontend/node_modules
predated the prettier devDependency from #233 — so the first gate
of `npm run verify` died on "prettier: not found".
A bare `git status` reports "clean" in all three cases, which is why each run
rediscovers it the hard way instead of inheriting the last one's fix. Per the
never-twice rule, the third instance gets the automation, not a fourth repair.
`npm run preflight` checks the three invisible ones — divergence from origin
(after an explicit fetch), merged worktree branches still checked out (compared
by patch id via `git cherry`, since `git branch --merged` cannot see a squash),
and node_modules older than its lockfile. Read-only by default, exit 1 on drift;
`npm run preflight -- --fix` repairs what it finds and refuses to touch a
worktree with uncommitted changes.
Both paths exercised on this branch: the read-only run caught backend/
node_modules as stale against the #229/#230 security bumps, and --fix
reinstalled it to clean.
Claude-Session: https://claude.ai/code/session_01PtVWdxno5WtK9zYLkrBz3P
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>