Skip to content

ci: swap pnpm/action-setup for pnpm/setup standalone binary - #604

Merged
qnbs merged 5 commits into
mainfrom
ci/pnpm-setup-standalone-binary
Sep 4, 2026
Merged

ci: swap pnpm/action-setup for pnpm/setup standalone binary#604
qnbs merged 5 commits into
mainfrom
ci/pnpm-setup-standalone-binary

Conversation

@qnbs

@qnbs qnbs commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Wave 1 of a bounded CI performance optimization pass. Measured (not assumed) the root cause of the CI setup-time variance observed across recent runs: pnpm/action-setup's self-installer runs an npm-based install of the pnpm CLI itself, which showed 20s-6min of pure variance per job across a sampled range of recent runs, entirely independent of this repo's dependency count. The actual pnpm store cache restore and pnpm install --frozen-lockfile with a warm store only ever took 6-9 seconds — the store cache was never the bottleneck.

pnpm/setup is pnpm's own documented successor action for pnpm v11+ (this repo pins pnpm@11.22.0). It fetches pnpm's standalone executable via the npm registry (confirmed in this PR's own CI log: Downloading pnpm 11.22.0 from the npm registry) and verifies an npm-signed checksum against a pinned key before extracting it — not, as an earlier version of this description incorrectly claimed, a GitHub-published SHA-256 digest; pnpm/setup's own source is explicit that GitHub's digest is not the tamper-proof verification source here.

Scope — isolated to one variable

This PR changes only the pnpm bootstrap mechanism, in both places pnpm is installed:

  • .github/actions/setup/action.yml (shared composite, used by most jobs)
  • .github/workflows/ci.yml's workflow-policy job (inlines its own setup — it validates the trust boundary that composite actions like the one above must clear before being trusted, so it can't use it)

Deliberately not changed in this PR:

  • Existing pnpm store caching via actions/setup-node's cache: pnpm remains unchanged in both call sites (zero lines touched), and pnpm/setup's own cache input is left at its false default. Independently of that setting, pnpm/setup always manages its own exact-lockfile-hash-bound verification-result cache (pnpm-lockfile-verified-*, visible in this PR's own log as "Lockfile verification cache is not found" → "... saved") — this is upstream pnpm v11 supply-chain-policy behavior, not something this PR turns on, and it fails safe (no prefix fallback; a miss just re-verifies).
  • No runtime: input — actions/setup-node still owns Node version resolution (matrix + .nvmrc fallback), unchanged.
  • version: 11.22.0 is set explicitly in both places (not read implicitly from package.json's packageManager field) — the workflow-policy job in particular must not resolve its own tooling version from PR-controlled content before the trust boundary it exists to validate.
  • install: false on pnpm/setup in both places — the existing separate pnpm install --frozen-lockfile step (and, in workflow-policy, its --ignore-scripts --ignore-pnpmfile hardening) is unchanged, preserving current failure attribution.

Also refreshed docs/CI.md's composite-setup pipeline reference, which still named the retired pnpm/action-setup step — a doc-truth fix with no runtime-semantic effect on this PR's benchmark.

Evidence

Baseline — sampled Quality Gate job logs from 5 recent runs showed the pnpm/action-setup self-installer step (Running self-installer...added 1 package[, and audited 2 packages] in Ns) taking: 20s, 41s, 2m, 3m, 6m — while pnpm install --frozen-lockfile immediately after (with a cache hit already restored) consistently took under 10s.

First real data point (this PR, Workflow Policy Gate job)pnpm/setup completed in ~3.1s; the actions/setup-node pnpm-store cache was cold on this run and pnpm install --frozen-lockfile --ignore-scripts --ignore-pnpmfile still only took ~17.4s. Strongly consistent with the bootstrap step being the actual hotspot, but this is one job on one run — not yet generalized to the full PR/multiple runs.

Validation

  • node scripts/workflow-policy-check.mjs — passed (permissions, needs graph, action pins, aggregator sync all structurally sound)
  • pnpm run lint — passed
  • pnpm run docs:check — passed
  • PR-size governance — 3 files, 11 meaningful lines, 2 commits (well within target)
  • Full CI on this PR is the first complete before/after comparison point

Non-goals for this PR

No job consolidation (VRT+Lighthouse, standard+Deep E2E), no static-work deduplication, no caching-architecture change beyond the doc-truth note above, no self-hosted runners or custom images. Those remain candidates for later waves, contingent on what this isolated measurement shows across the full run.

Summary by Sourcery

Speed up and stabilize CI setup by switching both pnpm bootstrap locations to the verified standalone pnpm/setup action.

Enhancements:

  • Replace the pnpm action bootstrap with pnpm/setup’s standalone pnpm binary in the shared CI setup and workflow-policy job, while preserving explicit versioning and install ownership.
  • Update CI documentation and workflow-policy tests to reflect and enforce the new pnpm bootstrap.

CI:

  • Reduce CI setup-time variance by removing the npm-based pnpm self-installation path while leaving existing pnpm dependency-store caching unchanged.

Documentation:

  • Refresh CI pipeline documentation to reference pnpm/setup and its explicit installation settings.

Tests:

  • Extend workflow-policy coverage to validate the standalone pnpm bootstrap in both setup locations and preserve workflow-policy install hardening.

Chores:

  • Synchronize README test-count metrics with the current test suite.

pnpm/action-setup's self-installer runs an npm-based install of the
pnpm CLI itself, measured at 20s-6min of pure variance per job across
sampled CI runs, unrelated to this repo's dependency count (the actual
pnpm store cache restore and `pnpm install --frozen-lockfile` with a
warm store only ever took 6-9s). pnpm/setup is pnpm's own documented
successor for v11+, downloading a SHA-256-verified standalone binary
instead. Isolated to only the bootstrap mechanism for this measurement:
caching (actions/setup-node's cache:pnpm) is left unchanged in both
call sites so cache architecture and bootstrap aren't varied together.
@codeant-ai

codeant-ai Bot commented Sep 4, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR de3b7ee Sep 04, 2026 · 08:38 08:40

@codeant-ai

codeant-ai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
worldscript-studio Ready Ready Preview Sep 4, 2026 9:03am UTC

@sourcery-ai

sourcery-ai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

CI now uses pnpm’s SHA-256-verified standalone release binary instead of pnpm/action-setup’s npm-based self-installer in both installation paths, with pnpm 11.22.0 pinned explicitly and install deferred to the existing steps. Caching, Node resolution, and dependency-install behavior remain unchanged to isolate the expected setup-time improvement.

File-Level Changes

Change Details Files
Replace the npm-based pnpm bootstrap with pnpm’s verified standalone binary while preserving explicit versioning and deferred dependency installation.
  • Pin pnpm/setup to v2.1.0 and pnpm 11.22.0 in the shared composite action.
  • Set install: false so the existing separately attributed pnpm install flow remains unchanged.
  • Apply the same bootstrap and version configuration directly in the trust-boundary validation job.
.github/actions/setup/action.yml
.github/workflows/ci.yml
Keep CI caching, Node resolution, and workflow structure unchanged so performance impact can be attributed solely to the bootstrap swap.
  • Leave actions/setup-node pnpm caching and Node version inputs untouched.
  • Preserve the workflow-policy job’s independent setup path and existing install hardening.
.github/actions/setup/action.yml
.github/workflows/ci.yml

Possibly linked issues

  • #unknown: The PR is a bounded, measured CI latency optimization that preserves required checks, caching, trust boundaries, and quality gates.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@what-the-diff

what-the-diff Bot commented Sep 4, 2026

Copy link
Copy Markdown

PR Summary

  • Updated the setup action for 'pnpm'
    The setup action for the tool 'pnpm' has been upgraded to a newer version in both the action.yml and ci.yml workflow files. This means that we are using the latest features and improvements from the 'pnpm' tool.

  • Added benefits of using 'pnpm/setup' in setup action
    A comment has been added to the action.yml file, explaining why we choose to use 'pnpm/setup'. It mentions features of 'pnpm/setup' such as secure credential verification (SHA-256) and helping us better understand performance.

  • Prevented automatic installation during setup
    An install: false directive has been added to the 'pnpm' setup step in both files. This prevents an automatic installation from happening when setting up, giving us more control over the process.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Sep 4, 2026
@codeant-ai

codeant-ai Bot commented Sep 4, 2026

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: e4cf0ab9
Scan Time: 2026-09-04 09:03:14 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED Rating S: No issues

View Full Results

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

This PR correctly implements the swap from pnpm/action-setup to pnpm/setup to address measured CI performance variance (20s-6min) in the pnpm bootstrap mechanism.

Key Changes Verified:

  • ✅ Both locations (.github/actions/setup/action.yml and .github/workflows/ci.yml) consistently updated
  • ✅ Action SHA pinned (703c52620218391530e48b9e8870d5c0082e1b9b) maintaining security practices
  • ✅ Version explicitly set to 11.22.0 (unchanged from previous configuration)
  • install: false properly added to preserve existing separate pnpm install --frozen-lockfile step
  • ✅ No breaking changes to workflow logic or caching architecture

The implementation is sound and ready for merge. The isolated scope (changing only the bootstrap mechanism while leaving caching and install steps unchanged) allows for clean attribution of any performance improvements.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

codescene-access[bot]

This comment was marked as outdated.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 75 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Essentials

Run ID: b5dd86d9-518e-426b-9b56-b1549246d8f2

📥 Commits

Reviewing files that changed from the base of the PR and between de3b7ee and e4cf0ab.

📒 Files selected for processing (4)
  • .github/actions/setup/action.yml
  • README.md
  • docs/CI.md
  • tests/unit/workflowPolicy.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Essentials

Run ID: ddec9b4c-b2d3-4e9b-be30-d112a7df5b56

📥 Commits

Reviewing files that changed from the base of the PR and between 08498b2 and de3b7ee.

📒 Files selected for processing (2)
  • .github/actions/setup/action.yml
  • .github/workflows/ci.yml

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

The shared setup action and workflow-policy job replace pnpm/action-setup with pinned pnpm/setup. Both retain pnpm 11.22.0 and disable dependency installation.

Changes

pnpm setup migration

Layer / File(s) Summary
Update CI pnpm setup paths
.github/actions/setup/action.yml, .github/workflows/ci.yml
The composite action uses pnpm/setup v2.1.0. The workflow-policy job uses the SHA-pinned action. Both set installation to false and retain pnpm 11.22.0.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to de3b7

CI now bootstraps the same pinned pnpm version through the standalone setup action while keeping dependency installation separate. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: replacing pnpm/action-setup with pnpm/setup for the standalone pnpm binary.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/pnpm-setup-standalone-binary

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

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 4, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/actions/setup/action.yml" line_range="20" />
<code_context>
-    # QNBS-v3: install the patched exact pnpm before setup-node reads the repository lockfile for caching.
-    - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
+    # QNBS-v3: pnpm/setup verifies a SHA-256-checked standalone binary, replacing pnpm/action-setup's npm-based installer (measured 20s-6min variance); caching left unchanged below to isolate this one variable.
+    - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
       with:
         version: 11.22.0
</code_context>
<issue_to_address>
**nitpick:** `docs/CI.md` still documents the composite pipeline as using `pnpm/action-setup`, so the repository's CI reference is inaccurate after this change and directs maintainers toward the retired bootstrap mechanism.

**Suggested fix:** Update the composite setup documentation to describe `pnpm/setup` and its `install: false` configuration.
</issue_to_address>

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/actions/setup/action.yml
@deepsource-io

deepsource-io Bot commented Sep 4, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 08498b2...e4cf0ab on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Docker Sep 4, 2026 9:02a.m. Review ↗
Python Sep 4, 2026 9:02a.m. Review ↗
Rust Sep 4, 2026 9:02a.m. Review ↗
Shell Sep 4, 2026 9:02a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread .github/actions/setup/action.yml
The initial commit's comment claimed pnpm/setup verifies its download
against a GitHub-published SHA-256 digest. The live CI log and
pnpm/setup's own source show it fetches the standalone binary via the
npm registry and verifies an npm-signed checksum against a pinned key
instead; the upstream source explicitly notes GitHub's digest is not
the tamper-proof verification source. Also notes pnpm/setup's own
exact-lockfile-hash verification-result cache runs independently of
the (unchanged) pnpm store caching. docs/CI.md's pipeline reference
still named the retired pnpm/action-setup step.
codescene-access[bot]

This comment was marked as outdated.

tests/unit/workflowPolicy.test.ts hardcoded pnpm/action-setup's exact
pin and ordering, which the pnpm/setup migration (this branch) doesn't
satisfy — this test runs inside the Quality Gate job, separately from
the standalone workflow-policy-check.mjs structural checker already
validated locally, so it wasn't caught until a bot review flagged it.
Updated the assertions to the new action/pin and added a check for
install:false, which the bootstrap-contract test already exists to
protect.
codescene-access[bot]

This comment was marked as outdated.

qnbs added 2 commits September 4, 2026 10:58
…e workflow-policy bootstrap

Adds an explicit not.toContain('pnpm/action-setup@') check to the
composite-action assertion so the retired bootstrap can't silently
reappear. Also adds a dedicated test for the inline workflow-policy
job's own pnpm/setup bootstrap (exact pin, explicit version,
install:false, ordering before actions/setup-node, old pin absent) —
this job duplicates the swap because it validates the trust boundary
the composite action itself must clear, so it wasn't covered by the
existing composite-action test. Reuses the existing extractJobBlock
helper; no parser or test-framework changes.
…y bootstrap test; sync README test count

Adds the missing assertion that the workflow-policy job's no-lifecycle
-scripts install command stays exactly `pnpm install --frozen-lockfile
--ignore-scripts --ignore-pnpmfile` after the pnpm/setup swap. Also
syncs README's test-count badges (7427->7428) for the new test added
in the prior commit, per docs:check.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@qnbs
qnbs merged commit e183321 into main Sep 4, 2026
41 checks passed
@qnbs
qnbs deleted the ci/pnpm-setup-standalone-binary branch September 4, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant