Production Refresh Hardening
Environment isolation, in-process bootstrap, and dependency coverage for tagged refreshes in 3.4.1
Overview
v3.4.1 carried three commits that hardened the production refresh and bootstrap pipeline to work reliably on real release servers with tagged deployments.
Changes
1. Production-Safe Bootstrap (532f991)
Made bootstrap-prod.ts environment-aware. Previously, steps used relative paths (--working-dir app) and inherited the ambient shell environment. The fix added a .env file parser that loads .env, .env.local, .env.prod, and .env.prod.local from the repo, then constructs isolated environment objects (appProductionEnv, orderingProductionEnv, workspaceProductionEnv) with APP_ENV=prod and APP_DEBUG=0 forced. Each step now gets an explicit cwd (absolute path via resolve()) and its own env.
2. In-Process Bootstrap (ad3b455)
Wrapped the step list and execution loop into an exported runProductionBootstrap() function (with import.meta.main guard for standalone use). The refresh script (refresh-prod-checkout.ts) now imports and calls runProductionBootstrap() directly instead of spawning a subprocess via bun run bootstrap:prod, ensuring the refresh and bootstrap share the same runtime context and environment resolution.
3. Dossier Frontend Dependencies (4ca0472)
Added the missing bun install step for the dossier/ frontend directory, inserted just before the dossier frontend build step. Without this, tagged production refreshes could fail to build the dossier frontend if its node_modules were stale or missing.
Files Touched
| File | Change |
|---|---|
scripts/bootstrap-prod.ts | Modified across all 3 commits |
scripts/refresh-prod-checkout.ts | Modified - in-process import |