fix(home): an agent's npm install can no longer rewrite the software checkout (v0.437.1) - #811
Merged
Merged
Conversation
…checkout (v0.437.1) npm installs into the nearest ancestor with a package.json. With the data home at <checkout>/data, an agent's `npm install` in a scratch folder rewrote the live checkout's package.json + lockfile (instawp infra-ops, playwright-core), and make-live then refused the dirty checkout. Each tenant build now writes a minimal private package.json at the data home root, never overwriting one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DhrGcimwmAypei3a25oq71
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.
Why
npm installs into the nearest ancestor that has a
package.json. On a box whose data home is<checkout>/data, an agent'snpm installin a scratch folder installed into the software checkout: instawp'sinfra-opsrannpm install playwright-core, npm rewrote the live checkout'spackage.json+ lockfile, andmake-liverefused to deploy the dirty checkout.What
src/edge/npm-boundary.ts—ensureNpmBoundary(home)writes a minimal privatepackage.jsonat the data home root (never overwrites an existing one). Called on every tenant build intenant-registry.<home>/node_modules(still resolvable from every agent folder); the checkout is never touched./datais already gitignored at the repo root, so the file can't dirty the checkout itself.Validation
scripts/npm-boundary-test.cjsasserts via npm's ownnpm prefix(checkout before, home after; no overwrite). Fullnpm run test:governancegreen. Verified on the instawp box:npm prefixfrom an agent folder → the data home.🤖 Generated with Claude Code
https://claude.ai/code/session_01DhrGcimwmAypei3a25oq71