Skip to content

Tests: Preserve npm install policy in Vitest consumers - #86537

Merged
ciampo merged 6 commits into
trunkfrom
codex/vitest-consumer-npm-policy
Nov 11, 2026
Merged

ciampo merged 6 commits into
trunkfrom
codex/vitest-consumer-npm-policy

Conversation

@ciampo

@ciampo ciampo commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to aduth's feedback on #82843.

What?

Preserve the repository's npm install protections in the isolated Vitest consumer checks, including min-release-age.

Why?

The consumer runner clears inherited npm configuration and installs outside the repository, so registry dependencies currently bypass its release-age policy.

How?

Copy the repository's .npmrc and allowScripts policy into the consumer. Allow direct fixture tarballs with allow-file=root, while keeping transitive files, Git dependencies, and remote URL dependencies blocked. Preserve the consumer's existing hoisted layout and non-strict peer resolution for its ESLint 10 compatibility checks. Run consumer CI when either policy source changes.

Testing Instructions

  1. Run npm run test:unit:consumers -- --browser and confirm that all consumer checks pass.
  2. In the printed consumer directory, run npm config get min-release-age strict-allow-scripts allow-file allow-git allow-remote. Confirm that the values are 1, true, root, none, and none respectively.
  3. Confirm that the consumer's package.json has the repository's allowScripts entries. Browser-provider and legacy Jest installs must retain the same policy.

Use of AI Tools

OpenAI Codex implemented the change and ran verification.

@ciampo ciampo self-assigned this Nov 9, 2026
@ciampo ciampo added the [Type] Build Tooling Issues or PRs related to build tooling label Nov 9, 2026
@ciampo
ciampo marked this pull request as ready for review November 9, 2026 16:48
@ciampo
ciampo requested review from Mamaduka and aduth and a balanced review from Copilot November 9, 2026 16:48

This comment was marked as resolved.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: 0 B

Total Size: 8.64 MB

0489ccf Run

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks 👍

@ciampo
ciampo force-pushed the codex/vitest-consumer-npm-policy branch from 2380d40 to 72253e9 Compare November 11, 2026 19:38
@ciampo
ciampo merged commit 9af78c4 into trunk Nov 11, 2026
94 of 96 checks passed
@ciampo
ciampo deleted the codex/vitest-consumer-npm-policy branch November 11, 2026 22:14
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 11, 2026
@aduth

aduth commented Nov 18, 2026

Copy link
Copy Markdown
Member

Today's package deployment surfaced some more conflicts here (example failure). I think the tl;dr is that with the new minimum age restrictions, this "Vitest Consumers" check will fail for the first 24 hours after Gutenberg's NPM packages are published. The check is run on pull requests that change packages/scripts, packages/eslint-plugin, package.json, or package-lock.json.

I'm not super familiar with what this test does (and unfortunately can't dive deep into this until tomorrow), but an AI-assisted assessment points to the behavior of pack and how it's changing file: dependencies to the exact local version. After a publish, the exact local version is the brand new published package, and that violates the minimum age restriction that we intentionally added in this pull request.

Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
* Tests: Preserve npm install policy in Vitest consumers

* Tests: Enforce npm version for Vitest consumers

* Tests: Simplify Vitest consumer install policy

* CI: Read npm cache without repository runtime constraints

* CI: Install npm without overwriting the bootstrap client

* Tests: Preserve configured npm for the default consumer runtime

---

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants