Fix: root prepare must not fail npm install in a build context - #194
Merged
Merged
Conversation
The prepare runs `node scripts/git-worktree-safe.mjs`. In a Docker / Nixpacks build, npm install runs after COPY package.json but before the repo is fully copied, so scripts/ is not in the image yet: node exits 1 (module not found) and the build fails. This broke all four deployed services (#189 introduced the unguarded prepare; the prior one ended in `|| true`). Restore the guard: `node scripts/git-worktree-safe.mjs 2>/dev/null || true`, so a missing script (or any git error) is a no-op and never fails the install. The dev-machine self-heal still runs when the script is present. Regression test runs the actual prepare command in a scriptless temp dir and asserts exit 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hotfix for a production outage: all four Railway services (example-blog, website, docs, ui-website) fail to deploy. They build from the monorepo root, and the build dies at
npm install:Root cause: #189 changed the root
prepareto a barenode scripts/git-worktree-safe.mjs. In a Docker / Nixpacks build,npm installruns afterCOPY package.jsonbut before the repo is fully copied, soscripts/is not in the image yet.nodeexits 1 (module not found) and the build fails. The previousprepareended in|| true, so it never failed the install.Fix
Restore the guard:
A missing script (build context) or any git error is now a no-op that exits 0, so
npm installnever fails. The dev-machine self-heal still runs when the script is present.Test plan
test/repo-health/prepare-build-safe.test.mjs).Definition of done
Expedited review given the live outage (one-line restoration of a known-good pattern with a proven counterfactual).