Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore(deps): pin @types/node to the supported runtime floor major - #528

Merged
ndycode merged 2 commits into
mainfrom
claude/audit-13-types-node-pin
Jun 10, 2026
Merged

ndycode merged 2 commits into
mainfrom
claude/audit-13-types-node-pin

Conversation

@ndycode

@ndycode ndycode commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves audit finding M9 (docs/audits/AUDIT_2026-06-10.md §3, PR #522): @types/node ^25 resolved typings for APIs that don't exist on the supported floor (engines.node >=18.17 runtime, Node 20 development floor per CONTRIBUTING.md). Any new code calling a Node 22+/25-only API (fs.glob, newer AbortSignal additions, etc.) would typecheck cleanly and fail at runtime for floor consumers.

This pins @types/node to ^20 so the compiler enforces the floor. This is the conservative half of the M9 decision (the alternative — raising engines — is a breaking change); raising the floor later just means bumping this pin alongside engines deliberately.

Changes

  • package.json: @types/node ^25.x^20.19.42 (+ lockfile)

Validation

  • npm run typecheck passes unchanged — confirming no over-floor Node APIs are in use today (this was the risk M9 flagged; it had not yet materialized)
  • Sample suites (fs-retry, config): pass

Related

Risk / Rollback

Dev-dependency-only; no runtime or published-artifact change. Revert the commit to restore ^25 types.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB


Generated by Claude Code

note: greptile review for oc-chatgpt-multi-auth. cite files like lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.

Greptile Summary

pins @types/node from ^25.3.0 to ^20.19.42 so the typescript compiler enforces the node 20 development floor rather than allowing node 22+/25-only apis to typecheck cleanly and silently fail on older runtimes. dev-dependency-only change; no runtime or published-artifact effect.

  • package.json: @types/node range narrowed to ^20.19.42; engines.node remains >=18.0.0 (raising the floor is deferred as a deliberate breaking-change decision per the audit finding).
  • package-lock.json: resolves @types/[email protected] and transitively downgrades undici-types from 7.18.26.21.0 to match; all integrity hashes are structurally valid sha512 values.

Confidence Score: 5/5

dev-dependency-only pin with no runtime or published-artifact change; safe to merge

the change narrows @types/node to ^20.19.42, adds no new code paths, and the pr description confirms typecheck passes against the existing codebase. the only lockfile side-effect (undici-types downgrade, libc field removal) is cosmetic or already tracked in a previous thread.

no files require special attention

Important Files Changed

Filename Overview
package.json pins @types/node from ^25.3.0 to ^20.19.42; no runtime or published artifact change, only tightens compile-time enforcement to match the Node 20 dev floor
package-lock.json lockfile updated to resolve @types/[email protected] and [email protected]; all integrity hashes are valid sha512 values; libc field removal from optional native entries already flagged in a previous thread

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[developer writes code using Node API] --> B{API exists in\ntypes-node-20?}
    B -- yes --> C[typechecks clean\nworks on Node 20+ runtime]
    B -- no --> D[compiler error\ncaught at build time]
    D --> E[dev updates to compatible API]
    E --> A

    subgraph before["before this PR - types-node-25"]
        F[Node 25-only APIs typecheck silently]
        F --> G[fails at runtime for\nengines.node ge 18.0.0 consumers]
    end

    subgraph after["after this PR - types-node-20"]
        H[compile-time guard aligned\nwith CONTRIBUTING.md Node 20 floor]
    end
Loading

Comments Outside Diff (1)

  1. package.json, line 154-156 (link)

    P2 residual gap between engines.node >=18.0.0 and @types/node@^20

    @types/node@20 includes APIs added in Node 20 (e.g. fs.glob, stream.compose additions) that don't exist on Node 18.x. any code calling those APIs will typecheck cleanly and fail at runtime for consumers running Node 18. the PR description acknowledges this as the deliberate conservative split (raising engines is a breaking change), so this is just a tracker note — but engines still reads >=18.0.0, which overpromises compatibility relative to what the types enforce. no vitest coverage exists to smoke-test the package against a Node 18 runtime outside of the CI job referenced in ci: add Node 18.x runtime-smoke job to validate the engines floor #523.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: package.json
    Line: 154-156
    
    Comment:
    **residual gap between `engines.node >=18.0.0` and `@types/node@^20`**
    
    `@types/node@20` includes APIs added in Node 20 (e.g. `fs.glob`, `stream.compose` additions) that don't exist on Node 18.x. any code calling those APIs will typecheck cleanly and fail at runtime for consumers running Node 18. the PR description acknowledges this as the deliberate conservative split (raising `engines` is a breaking change), so this is just a tracker note — but `engines` still reads `>=18.0.0`, which overpromises compatibility relative to what the types enforce. no vitest coverage exists to smoke-test the package against a Node 18 runtime outside of the CI job referenced in #523.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    Fix in Codex

Reviews (2): Last reviewed commit: "chore(deps): restore libc fields the loc..." | Re-trigger Greptile

@types/node ^25 resolved typings for APIs that do not exist on the
engines floor (>=18.17 runtime, Node 20 dev floor), so new code using a
Node 22+/25-only API would typecheck cleanly and fail at runtime.
Pinning to ^20 makes the compiler enforce the floor. Typecheck passes
unchanged, confirming no over-floor APIs are in use today.

Resolves audit finding M9 (docs/audits/AUDIT_2026-06-10.md).

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

package.json's @types/node development dependency is downgraded from ^25.3.0 to ^20.19.42. this is a major version reduction that targets an older node type definitions release.

Changes

@types/node Version Downgrade

Layer / File(s) Summary
@types/node downgrade
package.json
devDependency pinned down from ^25.3.0 to ^20.19.42, a major version reduction affecting node type definitions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues


observations:

  • this downgrade from version 25 to 20 is a significant step backward. flag what broke with the newer types—were there incompatible type exports, node api changes, or triple-slash directives that newer versions dropped?
  • no visible test changes in this diff. if there were type errors on v25, regression tests should verify the downgrade fixes them without introducing new issues.
  • windows edge case: ensure node type stubs for win32-specific modules (fs, path, process) don't diverge between v20 and v25 in ways that would trip cross-platform builds.
  • concurrency concern: if the codebase uses worker threads, timers, or async hooks, double-check that v20's type definitions for those apis match the runtime behavior your code expects.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed title follows conventional commits format with correct type (chore), scope (deps), and lowercase imperative summary under 72 chars.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed pr description is comprehensive and addresses the template structure with justified gaps; key validation checkboxes are marked, risk/rollback is clear, and rationale is well-documented.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/audit-13-types-node-pin
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/audit-13-types-node-pin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread package-lock.json
Review follow-up: npm install rewrote 13 optional rollup native entries
without their libc variant selectors (glibc/musl), which would risk the
wrong binary on Alpine. Entries are restored byte-identical to main; the
lockfile diff is now strictly the @types/node pin.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
@ndycode
ndycode merged commit 20fab4d into main Jun 10, 2026
2 checks passed
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.

2 participants