From aa31d593ab1495a67e2f3d86b790d2223395040c Mon Sep 17 00:00:00 2001 From: Danathar <6772335+Danathar@users.noreply.github.com> Date: Thu, 19 Nov 2026 21:46:39 -0500 Subject: [PATCH] chore(renovate): pin Renovate's npm to CI's and guard the pin Renovate runs npm 12, but CI runs npm 11 (Node 26 bundles it). npm 12 refuses some downloads npm 11 allows, so Renovate can't write the lock file for the Tailwind 4.3.5 update (#1009): npm error code EALLOWREMOTE npm error Fetching packages of type "remote" have been disabled - renovate.json: constraints.npm ^11.20.0, so Renovate's lock-file runs use CI's npm. Stop offering updates to that pin, and put a reminder in every Node major PR to raise it in the same PR. - scripts/tests/npm-constraint.test.ts: fails when the npm running the tests differs from the pin's major, with the exact value to set. - docs/skills/validation/SKILL.md: explain the pin and the test. Same change as projectbluefin/documentation#1729 and projectbluefin/testsuite#1278 (testsuite's pin dates from #1255). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WcWm7qptoi6WwWFaNJymyz Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com> --- docs/skills/validation/SKILL.md | 1 + renovate.json | 25 +++++++++++++++++++++++++ scripts/tests/npm-constraint.test.ts | 21 +++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 scripts/tests/npm-constraint.test.ts diff --git a/docs/skills/validation/SKILL.md b/docs/skills/validation/SKILL.md index 3a7d602e..a8dba134 100644 --- a/docs/skills/validation/SKILL.md +++ b/docs/skills/validation/SKILL.md @@ -37,6 +37,7 @@ Do not run the full application suite for documentation-only changes. 8. For live-data cache updates, keep the cached file path list identical in order and content across `update-content.yml` (restore and save), `deploy.yml` (restore), and `preview.yml` (restore). 9. When modifying a Vue component under `src/components/`, check `src/tests/` for existing component unit tests and keep test assertions aligned with the runtime contract. 10. For CI concurrency changes, keep pull-request runs grouped by PR and non-PR runs unique; `scripts/tests/workflow-concurrency.test.ts` checks cancellation and group isolation. Assert the parsed YAML expressions directly instead of executing them as JavaScript. +11. Renovate's npm pin (`constraints.npm` in `renovate.json`) must match the npm CI runs, which is the one bundled with Node (`node-version: '26'` → npm 11). With npm 12, Renovate's lock-file updates failed (#1009, `EALLOWREMOTE`). Renovate doesn't offer updates to the pin, so a Node major PR that brings a newer npm fails `scripts/tests/npm-constraint.test.ts` with the exact value to set. Fix it by raising `constraints.npm` in that same PR, not by editing or skipping the test. Documentation-only check: diff --git a/renovate.json b/renovate.json index 79ba16aa..b8d3c564 100644 --- a/renovate.json +++ b/renovate.json @@ -10,6 +10,9 @@ "rebaseWhen": "behind-base-branch", "osvVulnerabilityAlerts": true, "minimumReleaseAge": "3 days", + "constraints": { + "npm": "^11.20.0" + }, "packageRules": [ { "description": "Automerge only pin/pinDigest updates: they record the exact ref of an already-referenced version and introduce no new upstream code. Every other update requires a human merge.", @@ -19,6 +22,28 @@ ], "automerge": true, "platformAutomerge": true + }, + { + "description": "Don't offer updates to the npm pin under constraints: it must match the npm version CI runs (Node 26 ships npm 11), not the newest npm. Raise it in the same change that moves CI to a newer npm; scripts/tests/npm-constraint.test.ts fails CI until then.", + "matchManagers": [ + "renovate-config" + ], + "matchDepTypes": [ + "tool-constraint" + ], + "enabled": false + }, + { + "description": "A Node major brings a newer bundled npm. Remind whoever merges it to raise constraints.npm in the same PR, since updates to that pin are switched off above.", + "matchDepNames": [ + "node" + ], + "matchUpdateTypes": [ + "major" + ], + "prBodyNotes": [ + "**Before merging:** this Node version may bundle a newer npm. Check `npm --version` in this PR's CI log and set `constraints.npm` in `renovate.json` to match, in this same PR." + ] } ], "vulnerabilityAlerts": { diff --git a/scripts/tests/npm-constraint.test.ts b/scripts/tests/npm-constraint.test.ts new file mode 100644 index 00000000..07f341f0 --- /dev/null +++ b/scripts/tests/npm-constraint.test.ts @@ -0,0 +1,21 @@ +import { readFileSync } from 'node:fs' +import { resolve } from 'node:path' +import { describe, expect, it } from 'vitest' + +// renovate.json's constraints.npm sets the npm version Renovate writes +// package-lock.json with. It must match the npm CI runs, which is the one +// bundled with Node, so a Node major can move it. Renovate doesn't offer +// updates to the pin, so this fails the Node major PR until someone raises it. +const [running = '', runningMajor = ''] = (process.env.npm_config_user_agent ?? '').match(/\bnpm\/(\d+)\.\d+\.\d+/) ?? [] + +describe('renovate npm pin', () => { + it.skipIf(!running)('matches the npm running the tests', () => { + const config = JSON.parse(readFileSync(resolve(process.cwd(), 'renovate.json'), 'utf8')) as { constraints?: { npm?: string } } + const pin = config.constraints?.npm ?? '' + const version = running.slice(4) + expect( + pin.match(/\d+/)?.[0], + `renovate.json has constraints.npm "${pin}", but the tests run npm ${version}. Set constraints.npm to "^${version}" in this pull request.`, + ).toBe(runningMajor) + }) +})