Reduce duplicate dependency storage across worktrees#3325
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the project's package manager from npm to pnpm, updating various Dockerfiles, scripts, documentation, and configuration files, while adding workspace and lock files. It also refactors install-spx.sh to implement a file-locking mechanism, caching, and version pruning, and adds explicit return types to several TypeScript utility functions. Feedback highlights that pnpm-workspace.yaml must be copied into the Docker builds to prevent installation failures, and recommends adding a timeout to the lock acquisition in install-spx.sh to avoid infinite hangs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| WORKDIR /app/spx-gui | ||
|
|
||
| COPY spx-gui/package.json spx-gui/package-lock.json . | ||
| COPY spx-gui/package.json spx-gui/pnpm-lock.yaml . |
There was a problem hiding this comment.
The pnpm-workspace.yaml file contains critical configurations such as dependency overrides and allowBuilds. Since it is not copied into the Docker image before running pnpm install --frozen-lockfile, the installation will fail because the lockfile resolution (which depends on these overrides) will be out of sync. Copying pnpm-workspace.yaml along with package.json and pnpm-lock.yaml resolves this issue while maintaining Docker layer caching.
COPY spx-gui/package.json spx-gui/pnpm-lock.yaml spx-gui/pnpm-workspace.yaml .
There was a problem hiding this comment.
Handled in df13c89: Docker build now copies pnpm-workspace.yaml before frozen install.
| WORKDIR /app/spx-gui | ||
|
|
||
| COPY spx-gui/package.json spx-gui/package-lock.json . | ||
| COPY spx-gui/package.json spx-gui/pnpm-lock.yaml . |
There was a problem hiding this comment.
The pnpm-workspace.yaml file contains critical configurations such as dependency overrides and allowBuilds. Since it is not copied into the Docker image before running pnpm install --frozen-lockfile, the installation will fail because the lockfile resolution (which depends on these overrides) will be out of sync. Copying pnpm-workspace.yaml along with package.json and pnpm-lock.yaml resolves this issue while maintaining Docker layer caching.
COPY spx-gui/package.json spx-gui/pnpm-lock.yaml spx-gui/pnpm-workspace.yaml .
There was a problem hiding this comment.
Handled in df13c89: Account Docker build now copies pnpm-workspace.yaml before frozen install.
| acquire_lock() { | ||
| while ! mkdir "${SPX_LOCK_DIR}" 2>/dev/null; do | ||
| sleep 0.1 | ||
| done | ||
| LOCK_ACQUIRED=true | ||
| } |
There was a problem hiding this comment.
The current lock implementation will loop indefinitely if a stale lock directory is left behind (e.g., if a previous run was interrupted or killed with SIGKILL). This can cause local development or CI/CD pipelines to hang forever without any output. Adding a timeout (e.g., 60 seconds) with a clear error message prevents infinite hangs and helps with troubleshooting.
| acquire_lock() { | |
| while ! mkdir "${SPX_LOCK_DIR}" 2>/dev/null; do | |
| sleep 0.1 | |
| done | |
| LOCK_ACQUIRED=true | |
| } | |
| acquire_lock() { | |
| local count=0 | |
| local max_attempts=600 # 60 seconds total | |
| while ! mkdir "${SPX_LOCK_DIR}" 2>/dev/null; do | |
| if (( count >= max_attempts )); then | |
| echo "Failed to acquire lock at ${SPX_LOCK_DIR} after 60 seconds. If no other instance is running, please remove the lock directory manually." >&2 | |
| exit 1 | |
| fi | |
| sleep 0.1 | |
| (( count++ )) | |
| done | |
| LOCK_ACQUIRED=true | |
| } |
There was a problem hiding this comment.
Handled in df13c89: lock acquisition now times out after 60 seconds with a cleanup hint.
Closes #3234
Summary
git worktree listValidation
corepack pnpm@11.9.0 install --frozen-lockfileinspx-guicorepack pnpm@11.9.0 install --frozen-lockfileintutorialcorepack pnpm@11.9.0 install --frozen-lockfileinui/prototypebash -n spx-gui/install-spx.sh && bash -n tutorial/build.sh && bash -n spx-gui/vercel-install.shbash spx-gui/install-spx.shcorepack pnpm@11.9.0 run type-checkinspx-guicorepack pnpm@11.9.0 run lintinspx-guicorepack pnpm@11.9.0 run format-checkinspx-guicorepack pnpm@11.9.0 run test -- --runinspx-guibash build-wasm.shinspx-guicorepack pnpm@11.9.0 run buildinspx-guicorepack pnpm@11.9.0 run build:accountinspx-guigit diff --check