Project creatortrack deploy script atomic swap debt
forge_creatortrack_deploy.sh builds the new Next.js production build directly into the same .next folder the live server reads from, then restarts. This means: (1) any deploy has a broken-site window while the build overwrites live route manifests, (2) if the parent script is killed mid-run, the child build process can orphan and keep overwriting .next while the old server is still serving, causing Internal Server Error until the orphaned build finishes or is killed, (3) there is no rollback available since the old build is overwritten in place, not staged.
Why: Discovered 2026-07-09 when a background deploy was killed mid-run, orphaning the build child, which then took an anomalously long time (~8+ min) and left prod returning Internal Server Error. Recovery required killing the orphan and running one clean foreground deploy (~4 min).
How to apply: Before touching this script again, harden it to build to a temp directory and atomically swap .next on success, so the live server never serves a half-written build, and multiple concurrent invocations can't corrupt each other. Until fixed, always deploy in the foreground (not backgrounded/killable) and never kill a deploy mid-build; if one is orphaned, kill all stragglers before redeploying. This is logged as known debt, not yet fixed.
[auto-memory session c3c17eba-1e8d-4d84-8236-2b724694d9a9, confidence 0.85, mode direct]