fix(renovate): pin npm <12 for lockfile regeneration (unblock dep PRs) - #3003
Open
rpapani wants to merge 3 commits into
Open
fix(renovate): pin npm <12 for lockfile regeneration (unblock dep PRs)#3003rpapani wants to merge 3 commits into
rpapani wants to merge 3 commits into
Conversation
The CI runner defaults to npm 12, but @adobe/spacecat-helix-content-sdk pins engines.npm ">=10.9.0 <12.0.0". With engine-strict=true in .npmrc, Renovate's `npm install` to regenerate package-lock.json hard-fails EBADENGINE, so it can only bump package.json -- leaving the lockfile out of sync and every dep-bump PR failing CI's `npm ci` with EUSAGE (e.g. #2453, #2521, #2483). Renovate reads the root engines.npm (">=10.9.0", no ceiling) and so uses npm 12; this constraint overrides that to <12 for lockfile regeneration only. Keeps engine-strict intact and leaves CI's `npm ci` on npm 12 (which works, since npm ci only enforces the root package's engines, not the transitive content-sdk one). Surgical: no change to .npmrc, engines, or the runner. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…iption Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This PR will trigger a patch release when merged. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…straint Mirrors the actual documented requirement of the offending @adobe packages (both a floor and a ceiling), instead of a bare <12.0.0 that could resolve to an unexpectedly old npm. Validated with renovate-config-validator. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every Renovate dependency-update PR fails CI (
ci/build,ci/it-postgres,type-check) — e.g. #2453, #2521, #2483 — and the failure is not in our code.Root cause chain:
@adobe/*packages pinengines.npm ">=10.9.0 <12.0.0"— e.g.@adobe/spacecat-helix-content-sdk@1.4.33and@adobe/mysticat-shared-seo-client@1.8.0(both direct deps; npm reports whichever it trips on first during resolution, so different PRs surface different package names). This is a shared internal engine convention, not one package's quirk..npmrchasengine-strict=true, so Renovate'snpm install(to regeneratepackage-lock.json) hard-failsEBADENGINEon that<12cap and cannot write the lockfile.package.json, leavingpackage-lock.jsonout of sync → every downstream CI job runsnpm ciand fails withEUSAGE(Invalid: lock file's X does not satisfy Y).mainand human PRs are unaffected because they never regenerate the lockfile — andnpm cidoes not enforceengine-strictagainst the dependency tree the waynpm installdoes (npm/cli#1219), so it stays green on npm 12.Fix
Add a Renovate
constraintspin so Renovate regenerates the lockfile with npm 11:Renovate otherwise reads the root
engines.npm(>=10.9.0, no ceiling) and picks npm 12; this overrides that for lockfile regeneration only. The range mirrors the actual engine requirement of the offending packages (floor and ceiling). Validated withrenovate-config-validator("Config validated successfully").Why this over the alternatives:
engine-strictstays on, rootenginesunchanged, and CI'snpm cistays on npm 12 (which already works — that's whymainis green). Only Renovate's own artifact-update step uses npm 11.engines.npmto<12— that would makenpm cion the npm-12 runner failengine-stricton the root engine and breakmain.packageManagerin package.json would pin the toolchain for CI and every human dev too — far larger blast radius than needed.engine-strict(whatspacecat-audit-workerdoes — see below) also works, but removes the engine safety gate repo-wide.Comparison with spacecat-audit-worker
audit-workerdepends on the same@adobe/spacecat-helix-content-sdk@1.4.33(samenpm <12cap) on the same npm-12 fleet CI, yet its Renovate PRs (#2842/#2816/#2780) merge fine and do updatepackage-lock.json. The only difference: audit-worker has noengine-strictin.npmrc, so the npm-12 regen only warns on the content-sdk engine and proceeds. This PR keeps api-service'sengine-strictgate and makes Renovate regenerate cleanly by feeding it a compatible npm — strictly safer than removing the gate.Known trade-off (tool-version skew)
This intentionally makes Renovate author the lockfile with npm 11 while CI/humans consume it with npm 12. That's fine today because
npm cireplays already-resolved lockfile entries. One narrow caveat for the record: this repo has a git dependency (git+ssh://…/mysticat-data-service) in the lockfile, and npm 12 changedallow-git/allow-remotedefaults to"none"; if Renovate ever re-resolves that git dep under npm 11's more permissive defaults, the resulting entry might not be reproducible by a plainnpm installon a default npm 12. Not a regression this PR introduces — noting it so it's on the record.The real upstream fix is for the
@adobepackages to widenengines.npmto allow ≥12, after which this constraint can be removed.Impact
Once merged, Renovate re-runs and regenerates the lockfile (with npm 11) for the currently-stuck dep PRs (#2453 already merged via a hand-regenerated lock; #2521/#2483 and all future ones) — no more manual
package-lock.jsonfixes.Deployment
Config-only change (Renovate). No runtime/Lambda impact.