Skip to content

fix(sandbox): keep pnpm's virtual store in the project, create its home - #2232

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/pnpm-sandbox-home-mkdir
Nov 22, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/pnpm-sandbox-home-mkdir

Conversation

@potiuk

@potiuk potiuk commented Nov 22, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2223, after an end-to-end run in Airflow with the merged settings.

  • The global virtual store broke type-checking. fix(sandbox): give sandboxed pnpm its own home and store #2223 turned on npm_config_enable_global_virtual_store so the .idea/codeStyles files some packages ship stay out of the project, where Claude Code refuses them. But TypeScript resolves a package's types by walking up from the package's real path to the project's node_modules, where the project's own @types/* are linked; from a virtual store outside the project that walk never reaches them. Airflow's UI went from 0 tsc errors on a plain install to 148, and the type-aware lint from 0 to 455, with its autofix stripping correct casts. A per-project virtual store moved into the sandbox home fails the same way (148 / 461). fix(sandbox): give sandboxed pnpm its own home and store #2223's test-plan line that the hook passed came from a stale node_modules.
  • Now: the virtual store stays in the project. sandbox-lint no longer requires the flag (it is not a sandbox matter); the docs and the install skill say not to turn it on; verify reports it as ⚠ and update as drift to remove. The per-project home stays for .tools, the cache and the content store: it fixes the original ~/Library/pnpm EPERM and does not affect type resolution. The dispatcher still drops the flag for host-run hooks if an older setup sets it.
  • .idea/codeStyles is the project's to fix. A dependency that ships it fails a sandboxed install inside the project. The troubleshooting entry gives the project-side override (iconv-lite 0.6.3 ships .idea/; 0.7.0 and later do not, and 0.7.0 is a bug-fix release), how to find the package, and that an old node_modules holding such a package must be deleted once outside the sandbox (the sandbox can neither create nor unlink those files).
  • The home must exist before the session uses it. A sandbox write grant takes effect only on an existing directory, and ~/.local/share is not writable, so a sandboxed command cannot create ~/.local/share/pnpm-sandbox/<project>; the first install failed with EPERM on the home's .tools. The install skill proposes mkdir -p to run outside the sandbox, verify reports a missing home, and the docs and spec say so.

Type of change

  • Skill change (.claude/skills/<name>/) — eval fixtures updated below
  • Python package (tools/*/ with pyproject.toml)
  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Documentation (docs/, README.md, CONTRIBUTING.md)

Test plan

  • prek run (all hooks but the tests) passes
  • sandbox-lint tests: no pnpm error with the flag unset, "true" or "false"; the rest of fix(sandbox): give sandboxed pnpm its own home and store #2223's checks unchanged
  • Dispatcher and setup-preflight tests (fingerprint restamped)
  • Evals: install 28/28, update 17/17, verify 43/44 (case-9-whole-user-hooks-unreadable, unrelated to pnpm, passes re-run alone)
  • Airflow UI on macOS, pnpm 10.28.1, measured from one session:
    • plain in-repo install outside the sandbox: tsc 0 errors, oxlint 0
    • global virtual store (fix(sandbox): give sandboxed pnpm its own home and store #2223 as merged): install passes in the sandbox, tsc 148, oxlint 455
    • per-project virtual store in the sandbox home: tsc 148, oxlint 461
    • in-repo virtual store, content store in the home, iconv-lite overridden to ^0.7.0 (resolved 0.7.3): sandboxed install passes with no bypass, tsc 0, oxlint 0, no .idea anywhere under node_modules/.pnpm
    • home not yet created: EPERM ... mkdir '~/.local/share/pnpm-sandbox/airflow/.tools/...'; created with mkdir -p outside the sandbox, the install passes with no restart

RFC-AI-0004 compliance

Notes for reviewers (optional)

  • The iconv-lite override belongs in the adopting project (Airflow's ui/package.json), not here: it changes a production dependency path (mermaid → d3 → d3-dsv).
  • Projects that applied fix(sandbox): give sandboxed pnpm its own home and store #2223's settings should drop npm_config_enable_global_virtual_store and restart their sessions; setup-isolated-setup-update will report it.

🤖 Generated with Claude Code

apache#2223 turned on pnpm's global virtual store so the .idea/codeStyles
files some packages ship stayed out of the project, where Claude Code
refuses them. In Airflow's UI that broke type-checking: TypeScript
resolves a package's types by walking up from the package's real path
to the project's node_modules, where the project's own @types packages
are linked, and from a virtual store outside the project the walk never
reaches them. tsc went from 0 errors on a plain install to 148, the
type-aware lint from 0 to 455, and the lint's autofix stripped correct
casts. A per-project virtual store moved into the sandbox home fails
the same way; apache#2223's test-plan line that the hook passed came from a
stale node_modules.

The global virtual store is no longer required, and the docs and skills
say not to turn it on; verify reports it as a warning and update as
drift. The per-project home stays for .tools, the cache and the content
store, which fixes the ~/Library/pnpm EPERM and does not affect type
resolution. A dependency that ships .idea/codeStyles (iconv-lite 0.6.3;
0.7.0 and later do not) still fails a sandboxed install in the project:
the troubleshooting entry gives the project-side override.

A sandbox grant also takes effect only on a directory that exists, and
a sandboxed command cannot create ~/.local/share/pnpm-sandbox/<project>,
since ~/.local/share is not writable: the first sandboxed install in
Airflow failed with EPERM on the home's .tools. The install skill now
proposes `mkdir -p` for it, to run outside the sandbox, verify reports
a home that does not exist, and the docs and spec say so.

Generated-by: Claude Opus 5
@potiuk potiuk added family:setup setup-* skills family:tools tools/* capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) substrate:sandbox Tool substrate: agent isolation, egress control, settings audit labels Nov 22, 2026
@potiuk
potiuk enabled auto-merge (squash) November 22, 2026 10:19
@github-actions github-actions Bot added family:docs Docs, MISSION.md, READMEs family:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json labels Nov 22, 2026
@potiuk
potiuk merged commit 0f983ee into apache:main Nov 22, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) family:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json family:docs Docs, MISSION.md, READMEs family:setup setup-* skills family:tools tools/* substrate:sandbox Tool substrate: agent isolation, egress control, settings audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant