Skip to content

feat: add COREPACK_MINIMUM_RELEASE_AGE gate for version resolution - #908

Closed
Aschenbath wants to merge 1 commit into
nodejs:mainfrom
Aschenbath:feat/min-release-age-850
Closed

Aschenbath wants to merge 1 commit into
nodejs:mainfrom
Aschenbath:feat/min-release-age-850

Conversation

@Aschenbath

Copy link
Copy Markdown

Summary

Implements #850: a minimum-release-age gate for registry version resolution, so a just-published (potentially compromised) package-manager release is not silently installed via @latest/range resolution.

  • New env var COREPACK_MINIMUM_RELEASE_AGE (integer minutes). Unset/empty/0 keeps today's behavior (no gate).
  • When resolving tags or ranges from registry metadata, only versions whose registry publish time (time field) is at least the configured age old are considered; the newest qualifying version is selected.
  • If no version qualifies, resolution fails with a clear usage error instead of installing the too-new release.
  • Explicitly pinned exact versions are never gated (deliberate user choice).
  • Tag resolution never advances beyond the tag or switches a stable tag to a prerelease; prerelease tags stay within the same release and channel.
  • Invalid env values fail fast; unknown or malformed timestamps never bypass the gate. Full (non-abbreviated) registry metadata is fetched when the gate is active so timestamps are available.
  • Documented in the README environment-variables table.

Tests

  • New unit tests: tests/releaseAgeUtils.test.ts (parsing, filtering, tag resolution, edge cases) and tests/MinimumReleaseAge.test.ts (CLI regression against the fixture registry).
  • yarn typecheck and yarn lint clean.
  • NOCK_ENV=replay yarn test run: 234 passed, 4 failed — the 4 failures are the pre-existing custom registry with auth PROXY download tests, which fail identically on the clean tree in this sandbox (network environment), plus 1 expected fail.

Closes #850.

When resolving tags or ranges from registry metadata, only consider
versions whose registry publish time (time field) is at least
COREPACK_MINIMUM_RELEASE_AGE minutes old, selecting the newest qualifying
version. Unset/empty/0 keeps today's behavior. Exact versions are never
gated (deliberate user choice). Invalid values fail fast; unknown or
malformed timestamps never bypass the gate. Full (non-abbreviated)
metadata is fetched when the gate is active so timestamps are available.

Closes nodejs#850.
@aduh95

aduh95 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

This account has opened more than 10 PRs in the last 24 hours. This looks like bot activity, and will result in a ban if the behavior continues.

@aduh95 aduh95 closed this Oct 20, 2026
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.

Minimum release age for @latest

2 participants