Skip to content

chore: declare the node and npm floors that the tsdown build requires via devEngines - #7093

Merged
trentm merged 7 commits into
open-telemetry:mainfrom
embrace-io:overbalance/update-node-npm
Sep 22, 2026
Merged

trentm merged 7 commits into
open-telemetry:mainfrom
embrace-io:overbalance/update-node-npm

Conversation

@overbalance

@overbalance overbalance commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

This is needed for the repo's conversion to tsdown. Moving the build from tsc to tsdown (#6293) raised the toolchain a contributor needs to build this repo at all, and nothing declares it. Contributors on an older toolchain only find out through a confusing Failed to import module "unrun" failure, and CONTRIBUTING.md still tells them npm 7.x is enough. The npm floor comes from the same work: min-release-age in .npmrc is silently ignored by every npm below 11.10.0.

This PR writes those floors down. It changes no build behavior; it turns an undeclared tsdown requirement into a diagnostic contributors can act on.

Short description of the changes

  • Add devEngines to the root package.json, declaring the development runtime (node ^24.11.1 || >=26.0.0) and package manager (npm >=11.10.0).
  • Both keys use onFail: "warn". An unsupported toolchain prints a diagnostic naming the offending version, and every command still succeeds. See "Impact on CI" for why error is not usable in this repo.
  • Update CONTRIBUTING.md to point at devEngines.runtime as the source of truth, replacing the stale >= 22.18 and npm 7.x guidance.

devEngines is npm's workspace-local counterpart to engines: it applies to people developing in this repo and is not published. The packages' own engines are untouched, so the supported range for consumers does not change and remains >=22.15.0.

Type of change

  • This change requires a documentation update

How Has This Been Tested?

  • Running an npm script on an in-range Node: no diagnostic, exit 0. Out of range: an EBADDEVENGINES warning naming the offending version, still exit 0.
  • Full npm run compile (42 projects, 3245 files) on Node 22.18.0, 22.22.3, 24.11.1 and 26.9.0: all succeed, byte-identical output compared by hashing every file under every dist/. Node 20.19.0 fails.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

How these floors were chosen

The declared range is deliberately narrower than tsdown's own, so the numbers are worth recording.

The floor comes from the tsdown toolchain, not from our code

tsdown@0.22.14 declares engines.node as ^22.18.0 || >=24.11.0, inherited from rolldown-plugin-dts and import-without-cache. The 22.18.0 half is a real gate: tsdown picks its config loader with process.features.typescript, which only becomes truthy in Node 22.18.0, where type stripping is enabled by default. Below that it falls back to the optional unrun peer, which we do not install, and every compile fails with Failed to import module "unrun". Renaming tsdown.config.ts to .mjs does not help; the loader is chosen once at module scope.

Node 20 is not reachable at all: with unrun installed the config loads and the build then dies inside tsdown's core with TypeError: Promise.withResolvers is not a function, which arrived in Node 22.0.0.

Why the floors are higher than tsdown's own range

tsdown's ranges mark where the features it needs arrived, not where the relevant Node bugs were fixed. The binding defect is nodejs/node#59929, which tsdown names in its own error path: "... or upgrading Node.js to v24.11.1 or later." The fix reached each line separately:

line fix released in tsdown declares this PR declares
22.x 22.22.3 (2026-05-13) ^22.18.0 excluded, see below
24.x 24.11.1 (2025-11-11) ^24.11.0 ^24.11.1
25.x 25.1.0 (2025-10-28) dropped in 0.23.0 excluded, line is EOL
26.x branched after the fix >=24.11.0 >=26.0.0

^24.11.0 includes 24.11.0 itself, the exact version tsdown's message tells you to upgrade away from; the hotfix landed two weeks later in 24.11.1.

Worth stating plainly: #59929 does not reproduce here. Node 22.18.0 and 24.11.0 build this repo successfully, because our config graph does not take the loader path that triggers it. The floors rest on the upstream changelog and tsdown's own diagnostic, not on a local repro: being wrong this way asks a contributor for a newer patch release than they strictly need, being wrong the other way is the loader failure this PR exists to prevent.

Why Node 22 is excluded for development

An earlier revision declared ^22.22.3, where the loader fix landed. That is dropped because the 22 line cannot satisfy the npm floor at all: no Node 22 release bundles npm >=11.10.0, the whole line ships 10.9.x, so a contributor there would warn on every install unless they separately ran npm i -g npm@latest.

This narrows what maintainers develop on, not what the project supports: the unit-test and e2e matrices still include an exact 22.15.0 job.

The npm floor

>=11.10.0 is set by min-release-age=3 in .npmrc, the install cooldown that keeps us from pulling a version published minutes ago. Bisecting standalone installs puts the boundary between npm 11.9.0, which reports Unknown project config "min-release-age", and 11.10.0, which honors it. This is also why CI pins Node ^26.3.0, bundling npm 11.16.0.

This key uses onFail: "warn" because in-range Node 24 releases below 24.14.1 bundle npm 11.6.x, under the floor. Contributors there keep a working build and get one actionable message, fixed by npm i -g npm@latest rather than a Node upgrade:

npm warn EBADDEVENGINES Invalid semver version ">=11.10.0" does not match "11.6.2" for "packageManager"

Per the Node.js release index, 24.14.1 (npm 11.11.0) is the first Node 24 release where the warning disappears on its own, which is the version CONTRIBUTING.md names.

Impact on CI

None as written, but only because both keys use onFail: "warn". .github/workflows/unit-test.yml installs and builds on ^26.3.0, then switches Node to run the test matrix (22.15.0, 22, 24, 26). devEngines.runtime constrains building; the package engines (>=22.15.0) constrain running.

onFail: "error" was tried on runtime and had to be reverted, which is worth recording because the reasoning above makes it look safe. devEngines gates npm itself, not just build commands, so once Node is switched down to a matrix version below the build floor, every npm invocation exits 1. It fails node-tests (22.15.0) and e2e-tests (22.15.0) inside setup-node, before any test runs:

[command]/opt/hostedtoolcache/node/22.15.0/x64/bin/npm config get cache
npm error code EBADDEVENGINES
npm error EBADDEVENGINES Invalid semver version "^24.11.1 || >=26.0.0" does not match "v22.15.0" for "runtime"

The workflow cannot work around this, since the failing call is internal to setup-node's cache restore. A repo that deliberately tests below its build floor cannot use onFail: "error" without dropping matrix entries or lowering the floor to >=22.15.0, defeating the purpose of this PR.

@overbalance
overbalance requested a review from a team as a code owner September 16, 2026 23:18
@codecov

codecov Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.79%. Comparing base (c8e585f) to head (23e7724).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7093   +/-   ##
=======================================
  Coverage   94.79%   94.79%           
=======================================
  Files         394      394           
  Lines       13832    13832           
  Branches     3196     3196           
=======================================
  Hits        13112    13112           
  Misses        720      720           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread package.json Resolved

@pichlermarc pichlermarc 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!

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-22 00:06 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@overbalance
overbalance force-pushed the overbalance/update-node-npm branch from 2f561e2 to 0870997 Compare September 18, 2026 18:56
@overbalance
overbalance force-pushed the overbalance/update-node-npm branch from 0870997 to 1aa217c Compare September 18, 2026 19:06
@overbalance
overbalance force-pushed the overbalance/update-node-npm branch from 5313cee to 73307db Compare September 18, 2026 19:36
@overbalance overbalance changed the title chore: declare node and npm version floors via devEngines chore: declare the node and npm floors that the tsdown build requires via devEngines Sep 18, 2026
@trentm
trentm enabled auto-merge September 21, 2026 23:53
@trentm
trentm added this pull request to the merge queue Sep 21, 2026
Merged via the queue into open-telemetry:main with commit 88d51a3 Sep 22, 2026
25 checks passed
@overbalance
overbalance deleted the overbalance/update-node-npm branch September 22, 2026 01:01
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.

3 participants