Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -662,21 +662,45 @@ jobs:
# tracked changes) — without it, a duplicate user-agent line lands on master every
# release and, being last in the file, overrides bit-repo-local for local installs too.
# the flag lives in .git/index, so it survives persist_to_workspace into later jobs.
#
# storeDir moves the store — and with it the global virtual store at <storeDir>/<version>/links,
# which every node_modules entry symlinks into — under the persist_to_workspace root, so the
# later jobs that only attach the workspace get resolvable symlinks. pnpm's default store
# lives in ~/.local/share/pnpm, outside that root. it has to go in pnpm-workspace.yaml:
# .npmrc only carries npm-compatible settings, and store-dir there is silently ignored by
# the config reader bit installs through (see scopes/dependencies/pnpm/read-config.ts).
# the repo has no committed pnpm-workspace.yaml; info/exclude keeps this CI-only one from
# being picked up by anything that stages untracked files.
command: >
cd bit &&
echo "user-agent=bit-repo-circleci" >> .npmrc &&
git update-index --skip-worktree .npmrc &&
echo "storeDir: /home/circleci/bit/.pnpm-store" > pnpm-workspace.yaml &&
echo "pnpm-workspace.yaml" >> .git/info/exclude &&
bbit install
# - run: cd bit && bbit compile
# the following 3 commands should help debugging a random error on Circle: "sh: 1: babel: not found"
# - run: cd bit && ls -l node_modules/@babel
# - run: cd bit && ls -l node_modules/@babel/cli/bin
# - run: cd bit && ls -l node_modules/.bin
- run:
# a persist path that matches nothing is not an error, so without this check a store that
# landed outside the workspace root only shows up much later, as a MODULE_NOT_FOUND on a
# dangling node_modules symlink in whichever job runs first.
name: verify the global virtual store sits inside the persisted workspace
command: |
set -e
ls -d /home/circleci/bit/.pnpm-store/*/links
ls -l bit/node_modules/oxlint
test -e bit/node_modules/oxlint/bin/oxlint
- persist_to_workspace:
root: .
paths:
- bit
- .pnpm-store
# only the global virtual store, not the content-addressable files/ it hardlinks from:
# the consumers of this workspace read node_modules, they never fetch packages, and
# carrying files/ too would duplicate every package in the archive.
- .pnpm-store/*/links
Comment on lines +700 to +703

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Persisted links path mismatch 🐞 Bug ☼ Reliability

The CircleCI workspace persists .pnpm-store/*/links, but Bit resolves the global virtual store at
<storeDir>/links; if the resolved storeDir is /home/circleci/bit/.pnpm-store (as configured),
downstream jobs that only attach the workspace may miss the actual links directory and end up with
broken node_modules symlinks.
Agent Prompt
## Issue description
CircleCI persists `.pnpm-store/*/links`, but Bit/pnpm’s global virtual store directory is computed as `<storeDir>/links`. If pnpm resolves `storeDir` to the configured `/home/circleci/bit/.pnpm-store`, the actual required directory would be `.pnpm-store/links`, which is not matched by `.pnpm-store/*/links`.

This can break downstream jobs that rely on the attached workspace (without reinstalling) because `node_modules` entries may symlink into the missing global virtual store.

## Issue Context
- CI explicitly sets `store-dir=/home/circleci/bit/.pnpm-store`.
- Bit’s pnpm adapter computes the global virtual store as `join(config.storeDir, 'links')`.
- Downstream jobs (e.g. `lint`) attach the workspace and run commands without reinstalling.

## Fix Focus Areas
- .circleci/config.yml[665-710]

## Suggested fix
Update `persist_to_workspace.paths` to persist the exact `links` directory that Bit/pnpm uses.

A pragmatic, layout-tolerant option that still avoids persisting `files/` is to include both possible layouts:
- `.pnpm-store/links`
- `.pnpm-store/*/links`

(If you want to be stricter/cleaner, ensure the persisted path exactly matches the resolved `<storeDir>/links` layout you expect in CI.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

- store_artifacts:
path: ~/Library/Caches/Bit/logs
- store_artifacts:
Expand Down
2 changes: 1 addition & 1 deletion mocha-multi-reporters-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"reporterEnabled": "spec, mocha-junit-reporter",
"reporterEnabled": "spec, ./node_modules/mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "${MOCHA_FILE}",
"outputs": "true"
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
"lint-full": "./scripts/validate-import-named-aspects.sh && ./scripts/validate-no-ramda.sh && node scripts/validate-pkg-exist-in-pkg-json.js && npm run lint",
"format": "prettier \"{e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\" --write",
"prettier:check": "prettier --list-different \"{e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\"",
"mocha-circleci": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' registry-mock prepare && mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit",
"mocha-circleci": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' registry-mock prepare && mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit",
"e2e-test": "registry-mock prepare && cross-env NODE_OPTIONS=--no-warnings mocha --require ./babel-register './e2e/**/*.e2e*.ts'",
"e2e-test:debug": "npm run e2e-test --debug",
"e2e-test-circle": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit './e2e/**/*.e2e*.ts'",
"e2e-test-circle": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit './e2e/**/*.e2e*.ts'",
"performance-test": "mocha --require ./babel-register ./e2e/performance/*.performance*.ts",
"performance-test:debug": "npm run performance-test --debug",
"performance-test-circle": "mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/performance/*.performance*.ts",
"bit-hub-test-circle": "mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/bit-hub/*.ts",
"performance-test-circle": "mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/performance/*.performance*.ts",
"bit-hub-test-circle": "mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/bit-hub/*.ts",
"clean-node-modules": "find . -type d -name node_modules -prune -exec rm -rf '{}' +",
"setup": "bit install && bit compile",
"full-setup": "rm -rf node_modules/.bin/bit && bit install && husky && bit compile",
Expand Down
Loading