Skip to content

feat(pr-checks): reject unbounded dependency ranges in Node PR checks - #92

Open
pilundain wants to merge 1 commit into
mainfrom
feat/check-dependency-ranges
Open

feat(pr-checks): reject unbounded dependency ranges in Node PR checks#92
pilundain wants to merge 1 commit into
mainfrom
feat/check-dependency-ranges

Conversation

@pilundain

@pilundain pilundain commented Aug 19, 2026

Copy link
Copy Markdown

What

A new check-dependency-ranges composite action fails PR Checks when package.json declares a version range with no upper bound — *, latest, x, or a bare >= / > with no < companion — wired into pr-checks-node-npm and pr-checks-node-pnpm before dependency install (fails fast, needs no node_modules). On by default; a repo can pass check-dependency-ranges: false while it fixes existing ranges.

Verification

  • Red/green against real manifests: a manifest known to carry unbounded ranges fails with exactly the expected findings; the same manifest after remediation passes.
  • Edge cases exercised: workspace:*, catalog:, npm: aliases, bounded >=1 <2, ^3 || >=4 (flagged), nested overrides (flagged), open peer ranges (allowed).

Adds a check-dependency-ranges composite action that fails when package.json
declares a version range with no upper bound (*, latest, x, or a bare >= / >
comparator without a < companion), and wires it into the two Node testing
reusables (npm and pnpm) before dependency install.

Motivation: a security override written as a bare ">=" floated a CommonJS
consumer onto an ESM-only major and crashed a service at init with
ERR_REQUIRE_ESM, while CI stayed green because it tested on a newer Node than
the deployed runtime. Unbounded ranges tend to arrive from hurried security
bumps or copy-pasted examples, not from deliberate versioning decisions.

Scope decisions:
- dependencies, devDependencies, optionalDependencies and overrides (including
  nested override objects) are checked; peerDependencies are NOT — open-ended
  peer ranges are a legitimate library convention, bounded by the consumer.
- Non-registry specifiers (git/file/link/workspace/catalog protocols) are
  skipped, npm: aliases are judged by their aliased range, and each ||
  alternative is judged on its own.
- pr-checks-node-pnpm-build is intentionally untouched: it is a build-only
  workflow, and PR gating belongs to the testing reusables.

The step is on by default; a repo that needs time to fix existing ranges can
pass check-dependency-ranges: false to the reusable workflow.
@null-paorodrigues
null-paorodrigues force-pushed the feat/check-dependency-ranges branch from 6fe8739 to 2e04a7a Compare August 25, 2026 18:58
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.

1 participant