Skip to content

fix: keep the CI globalShims override out of the runtime scenarios - #58

Merged
zkochan merged 1 commit into
mainfrom
node-shim-env
Aug 15, 2026
Merged

zkochan merged 1 commit into
mainfrom
node-shim-env

Conversation

@zkochan

@zkochan zkochan commented Aug 15, 2026

Copy link
Copy Markdown
Member

Fixes the failed run: Expected Node.js 22 to be used, got "v24.19.0" in the Node.js version management section.

Since #57, pnpm/setup exports PNPM_CONFIG_GLOBAL_SHIMS={"node":false} into the job environment — deliberately, so the runtime the action installed stays authoritative for the job (a matrix job asking for node@22 must not get switched to the repo's pin). But the benchmark's runtime scenarios measure exactly the thing that override disables, and the env override outranks every other config layer. It breaks the scenario twice over: at link time, pnpm runtime set node --global writes a plain link to the global default instead of the switching shim; at run time, it turns an already-written shim's dispatch off. Either way node in a project pinned to 22 runs the global default 24.

The pnpm12 runner now blanks PNPM_CONFIG_GLOBAL_SHIMS / pnpm_config_global_shims in the environment it builds — empty means unset to pnpm, and assignment is the only way to mask an inherited value through the env prototype chain.

Verified by running the actual benchmarkNodeVersions scenario with the override exported, which reproduced the CI failure before the fix and completes after it (pinned project runs v22.23.2; all three measurements succeed).

🤖 Generated with Claude Code

The Node.js version management scenarios measure pnpm's per-project
runtime switching, and a globalShims override in the inherited
environment reaches into both halves of it: at link time it makes
`pnpm runtime set` write a plain link instead of the switching shim, and
at run time it turns an already-written shim's dispatch off. CI is such
an environment since #57 — pnpm/setup exports
PNPM_CONFIG_GLOBAL_SHIMS={"node":false} to keep the runtime it installed
authoritative for the job — which made the pinned-project scenario run
the global default and fail its version assertion. The runner now blanks
the override (empty means unset to pnpm) in the environment it builds.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zkochan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 689cf21c-7545-486f-9aa5-fe7d1c3ba27a

📥 Commits

Reviewing files that changed from the base of the PR and between c8e3c7b and 2dd18d5.

📒 Files selected for processing (1)
  • benchmarkNodeVersions.js

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix runtime benchmarks by unsetting inherited PNPM globalShims override

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Prevent CI-exported globalShims override from affecting runtime-switching benchmarks.
• Blank PNPM_CONFIG_GLOBAL_SHIMS in the pnpm12 runner environment to restore per-project Node
 selection.
• Add inline rationale documenting why env assignment (not deletion) is required.
Diagram

graph TD
  A["CI job env"] --> B["pnpm12 runner"] --> C["scenario env builder"] --> D["pnpm runtime set"] --> E["node shim/link"] --> F["benchmark assertions"]
  A --> G["PNPM_CONFIG_GLOBAL_SHIMS override"]
  G --> C
  subgraph Legend
    direction LR
    _env["Environment"] ~~~ _code["Runner code"] ~~~ _cmd["pnpm command"]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Construct a null-prototype env object
  • ➕ Avoids prototype-chain inheritance entirely (no need for masking via empty assignment).
  • ➕ Makes the boundary between base env and scenario env explicit.
  • ➖ Risk of missing required default env vars unless carefully copied.
  • ➖ Larger change surface than targeted masking.
2. Explicitly override via command-level config (e.g., PNPM_CONFIG_GLOBAL_SHIMS unset wrapper)
  • ➕ Keeps environment builder simpler by localizing config handling to the command invocation.
  • ➖ Harder to ensure every spawned command is covered.
  • ➖ Still needs to handle inherited env semantics correctly.

Recommendation: Blanks the two env keys in the runner-built environment is the best targeted fix: it reliably masks CI-inherited overrides (including via env prototype chains) without broad refactors or risking loss of other required environment variables.

Files changed (1) +12 / -0

Bug fix (1) +12 / -0
benchmarkNodeVersions.jsMask CI globalShims override in pnpm12 benchmark environment +12/-0

Mask CI globalShims override in pnpm12 benchmark environment

• Updates the pnpm12 runner’s environment construction to explicitly set PNPM_CONFIG_GLOBAL_SHIMS and pnpm_config_global_shims to empty strings. This prevents pnpm/setup’s CI-exported globalShims override from disabling per-project runtime switching during Node version management benchmarks.

benchmarkNodeVersions.js

@zkochan
zkochan merged commit f2ee741 into main Aug 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant