fix(setup): use --frozen-lockfile in setup hook to stop lockfile churn#9972
Draft
claude[bot] wants to merge 2 commits into
Draft
fix(setup): use --frozen-lockfile in setup hook to stop lockfile churn#9972claude[bot] wants to merge 2 commits into
claude[bot] wants to merge 2 commits into
Conversation
Bare `pnpm install` in dev/setup-environment.sh runs whatever pnpm the environment ships. When newer pnpm (v11) is resolved, it ignores the legacy `pnpm` config in frontend/app/package.json and (a) rewrites the lockfile, (b) scaffolds a new pnpm-workspace.yaml, and (c) exits non-zero with ERR_PNPM_IGNORED_BUILDS, which under `set -e` aborts the SessionStart hook. Pinning `packageManager: pnpm@10.33.0` matches CI and keeps the legacy config working; --frozen-lockfile prevents silent lockfile rewrites and the `|| echo` guard matches the pattern the gh step already uses so a hiccup doesn't kill the hook.
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.
Requested by Damien Garros · Slack thread
Why
Every new Infrahub workspace came up dirty:
frontend/pnpm-lock.yamlhad uncommitted modifications, and theSessionStarthook reportedSessionStart:startup hook error.The pnpm version is not the problem. The workspace-root
frontend/package.jsonalready pins"packageManager": "pnpm@10.33.2", and the ambient pnpm self-switches to that version correctly — even when invoked from thefrontend/appsubdirectory. So there is no version drift to fix.The real cause is the setup hook running a bare
pnpm install. That command normalizes and rewritesfrontend/pnpm-lock.yamlon a fresh workspace, producing the uncommitted lockfile churn. And becausedev/setup-environment.shruns underset -e, any non-zero exit from that install step aborts the script — which is exactly what surfaced as theSessionStart:startup hook error.Before / After
frontend/pnpm-lock.yaml, and the SessionStart hook reportedSessionStart:startup hook errorwhen the install step exited non-zero underset -e.What changed
dev/setup-environment.sh— changed the frontend install step from a barepnpm installtopnpm install --frozen-lockfile || echo "Warning: pnpm install failed (continuing)".--frozen-lockfilestops the setup hook from mutatingfrontend/pnpm-lock.yaml: instead of silently rewriting the lockfile, pnpm installs strictly from the committed one, and a genuinely out-of-sync lockfile now fails loudly instead of churning silently.|| echo "Warning: ..."non-fatal guard matches the pattern the existingghinstall step already uses, so a transient install hiccup can't abort the wholeset -esetup script and turn into a hook error.How
The single-line change in
dev/setup-environment.shmakes the install deterministic (frozen against the committed lockfile) and non-fatal (guarded), so setup can neither mutate the lockfile nor abort the hook.How to test
Verified: running the setup hook now exits 0 and leaves a clean working tree (no lockfile diff). pnpm self-switches to the root-pinned
pnpm@10.33.2and the frozen install completes cleanly.Impact & rollout
Follow-ups (out of scope for this PR)
dev/setup-environment.shguards its env-export block on$ENV_FILEbut detection uses$CLAUDE_ENV_FILE, soINFRAHUB_PROJECT_DIRand the.venvPATH are silently never written under the claude-code-web branch. Small, unrelated.frontend/app/package.jsonhasengines.node: ">=24"while some environments still run node 22, producingUnsupported enginewarnings on every install.