om-prepare-test-env
Repo-local extension of om-prepare-test-env - how this app boots for QA (local D1, throwaway .dev.vars, the seed, the 3011-3020 port pool) and what the committed entrypoints encode.
SKILL.md.ai/skills/om-prepare-test-env/SKILL.md
GitHubom-prepare-test-env (money-tracker.online)
This file extends the shared om-prepare-test-env skill installed at
.claude/skills/om-prepare-test-env/SKILL.md. The generated entrypoints are committed:
.ai/scripts/test-env-up.sh and .ai/scripts/test-env-down.sh. Run them. Regenerate only with
--regenerate, and keep every fact below when you do.
How this app runs
- Mode
dev:pnpm exec vite dev --port <port> --strictPort --host 127.0.0.1. The Worker runs in workerd through@cloudflare/vite-pluginagainst local D1, KV and R2 under.wrangler/state/. No Docker, no external service. - Preparation chain, in order:
HUSKY=0 pnpm install --frozen-lockfile --prefer-offline,pnpm generate-routes,pnpm db:migrate:local. Migrations are idempotent and run on every boot.HUSKY=0keepspnpm installfrom rewritingcore.hooksPathin the git config the worktrees share. - Port: the first free port in 3011-3020. 3010 belongs to the developer's own
pnpm dev(vite.config.tsbinds it withstrictPort), andplaywright.config.tsrefuses a base URL outside 3010-3020. - Host
127.0.0.1, neverlocalhost: the server binds v4 only, and Node's fetch in the seed resolveslocalhostdifferently from curl. .dev.vars: the script writes a throwaway file (BETTER_AUTH_SECRET,APP_URL, and the fixedUNSUBSCRIBE_TOKEN_SECRETthate2e/unsubscribe.spec.tssigns with) whose first line is a marker. A.dev.varswithout the marker was written by a person and is never overwritten: the script keeps it and warns when itsAPP_URLdoes not match the chosen port. Billing QA needs Polar sandbox credentials in that human-written file, all seven or none (POLAR_ACCESS_TOKEN,POLAR_WEBHOOK_SECRET,POLAR_SERVERin.dev.vars; the fourVITE_POLAR_PRODUCT_*in.env.local). The script never handles them.- Seed:
node scripts/seed/seed.mjs --url <baseUrl>creates the demo owner through the real sign-up endpoint and writes the fixture;node scripts/seed/verify.mjsaudits it. Demo identitydemo@money-tracker.online; the password is theTEST_OWNER_PASSWORDreference in.ai/qa/test-env.env. - Readiness:
GET /answers within 120 s on a cold boot. The deep probe isPOST /api/auth/sign-in/emailwith the demo credentials; the rate limiter allows ten attempts a minute, so probe once. - Freshness:
vite devhot-reloadssrc/**, so onlydrizzle/,package.jsonandpnpm-lock.yamlnewer than the descriptor make a running environment stale.
Rules
- Never boot on 3010, and never stop a server the descriptor did not start.
- The agent never reads
.dev.vars,.env.localor.ai/qa/test-env.env.