-
Notifications
You must be signed in to change notification settings - Fork 4
🛡️ Sentinel: Fix incorrect EOL status for old Node versions #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
📝 WalkthroughWalkthroughIntroduces a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #787 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 46 41 -5
Branches 16 14 -2
=========================================
- Hits 46 41 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The `checkEOL` function previously returned `false` (not EOL) for versions not present in the `EOL_DATES` map. This meant that very old, unsupported Node versions (e.g., 16, 14, 0.10) were incorrectly identified as supported. This change: 1. Calculates the minimum major version tracked in `EOL_DATES`. 2. Updates `checkEOL` to return `true` for any version older than this minimum. 3. Adds tests to verify that versions like 16.0.0 and 0.10.0 are now correctly marked as EOL. This is a security enhancement to prevent the library from giving a false sense of security on outdated runtimes.
f31aa05 to
d19518c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
|
Acknowledged. |
Greptile SummaryFixed a bug where old Node versions not in the
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant getVersion
participant checkEOL
participant EOL_DATES
User->>getVersion: Request version info
getVersion->>checkEOL: Check if major version is EOL
checkEOL->>checkEOL: Convert major to number
alt majorNum < MIN_TRACKED_MAJOR (14)
checkEOL-->>getVersion: return true (EOL)
else majorNum >= MIN_TRACKED_MAJOR
checkEOL->>EOL_DATES: Lookup EOL date
alt EOL date exists
checkEOL->>checkEOL: Compare current date vs EOL date
checkEOL-->>getVersion: return date comparison result
else No EOL date
checkEOL-->>getVersion: return false (not EOL)
end
end
getVersion-->>User: Return NodeVersion object with isEOL
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/index.test.ts (1)
303-313: Consider enhancing test coverage and determinism.The tests verify the expected EOL behavior, but there are opportunities to improve:
Node 16 test doesn't exercise the new logic: Since Node 16 is present in
EOL_DATESwith EOL date "2023-09-11", this test validates the existing date-based check rather than the newMIN_TRACKED_MAJORboundary logic.Missing explicit time setup: Unlike other EOL tests (lines 284, 291, 316), these tests don't call
vi.setSystemTime(), making them dependent on the current date being after 2023-09-11.Missing coverage for untracked old versions: Consider adding a test for a version between 0 and 14 that's NOT in
EOL_DATES(e.g., Node 12, 10, or 8) to specifically validate the new MIN_TRACKED_MAJOR logic.🔎 Suggested improvements
test("should return true for very old version (Node 16)", () => { + vi.setSystemTime(new Date("2026-01-01")); mockVersion.node = "16.0.0"; const v = getVersion(); expect(v.isEOL).toBe(true); }); +test("should return true for untracked old version (Node 12)", () => { + // Node 12 is not in EOL_DATES but is < MIN_TRACKED_MAJOR + mockVersion.node = "12.0.0"; + const v = getVersion(); + expect(v.isEOL).toBe(true); +}); + test("should return true for very old version (Node 0.10)", () => { + vi.setSystemTime(new Date("2026-01-01")); mockVersion.node = "0.10.0"; const v = getVersion(); expect(v.isEOL).toBe(true); });
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/index.test.tssrc/index.ts
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript with strict type checking for all source files
Files:
src/index.tssrc/index.test.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Configure linting and formatting with Biome: 4 spaces indentation, double quotes, no semicolons
Files:
src/index.tssrc/index.test.ts
src/index.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/index.ts: Export main entry point from src/index.ts including getVersion function, isAtLeast method, isLTS property, and NodeVersion interface
Maintain EOL_DATES constant in src/index.ts mapping Node.js major versions to End of Life dates
Handle version string parsing with strict input validation and support for optional v prefixes
Files:
src/index.ts
src/**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.test.ts: Co-locate test files with source files using the *.test.ts naming convention
Use vitest for all testing; tests should be co-located in src/ directory
Files:
src/index.test.ts
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: srod/node-version PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T20:10:06.257Z
Learning: Applies to src/index.ts : Maintain EOL_DATES constant in src/index.ts mapping Node.js major versions to End of Life dates
📚 Learning: 2026-01-05T20:10:06.257Z
Learnt from: CR
Repo: srod/node-version PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T20:10:06.257Z
Learning: Applies to src/index.ts : Maintain EOL_DATES constant in src/index.ts mapping Node.js major versions to End of Life dates
Applied to files:
src/index.tssrc/index.test.ts
📚 Learning: 2026-01-05T20:10:06.257Z
Learnt from: CR
Repo: srod/node-version PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T20:10:06.257Z
Learning: Applies to src/index.ts : Handle version string parsing with strict input validation and support for optional v prefixes
Applied to files:
src/index.ts
📚 Learning: 2026-01-05T20:10:06.257Z
Learnt from: CR
Repo: srod/node-version PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T20:10:06.257Z
Learning: Applies to src/index.ts : Export main entry point from src/index.ts including getVersion function, isAtLeast method, isLTS property, and NodeVersion interface
Applied to files:
src/index.tssrc/index.test.ts
📚 Learning: 2026-01-05T20:10:06.257Z
Learnt from: CR
Repo: srod/node-version PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T20:10:06.257Z
Learning: Applies to src/types.ts : Define all type interfaces in src/types.ts, including NodeVersion structure with major, minor, and methods
Applied to files:
src/index.tssrc/index.test.ts
📚 Learning: 2026-01-05T20:10:06.257Z
Learnt from: CR
Repo: srod/node-version PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T20:10:06.257Z
Learning: Applies to src/**/*.test.ts : Use vitest for all testing; tests should be co-located in src/ directory
Applied to files:
src/index.test.ts
📚 Learning: 2026-01-05T20:10:06.257Z
Learnt from: CR
Repo: srod/node-version PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T20:10:06.257Z
Learning: Applies to package.json : Ensure package.json specifies type: module for ESM-only distribution and engines: >=20.0.0 for Node.js support
Applied to files:
src/index.test.ts
🧬 Code graph analysis (1)
src/index.test.ts (1)
src/index.ts (1)
getVersion(56-126)
🔇 Additional comments (2)
src/index.ts (2)
24-27: LGTM! Clean solution for tracking the minimum EOL version.The
MIN_TRACKED_MAJORconstant correctly calculates the minimum major version tracked inEOL_DATES, establishing the boundary below which all versions are automatically considered EOL.
32-42: LGTM! Correctly implements fallback EOL logic for untracked versions.The updated
checkEOLfunction properly handles the case where very old versions (< MIN_TRACKED_MAJOR) are not present in theEOL_DATESmap by treating them as EOL. The logic flows well:
- Check if version is numerically valid and below the minimum tracked version → EOL
- Otherwise, use the existing date-based EOL check
This is a command for another bot (@coderabbitai), so I will ignore it. |
The `checkEOL` function previously returned `false` (not EOL) for versions not present in the `EOL_DATES` map. This meant that very old, unsupported Node versions (e.g., 16, 14, 0.10) were incorrectly identified as supported. This change: 1. Calculates the minimum major version tracked in `EOL_DATES`. 2. Updates `checkEOL` to return `true` for any version older than this minimum. 3. Adds tests to verify that versions like 16.0.0 and 0.10.0 are now correctly marked as EOL. This is a security enhancement to prevent the library from giving a false sense of security on outdated runtimes.
Fix: Ensure old Node versions are correctly identified as EOL
The
checkEOLfunction previously returnedfalse(not EOL) for versions not present in theEOL_DATESmap. This meant that very old, unsupported Node versions (e.g., 16, 14, 0.10) were incorrectly identified as supported.This change:
EOL_DATES.checkEOLto returntruefor any version older than this minimum.This is a security enhancement to prevent the library from giving a false sense of security on outdated runtimes.
PR created automatically by Jules for task 4188325528809582166 started by @srod
Summary by cubic
Fix EOL detection for very old Node versions. They are now correctly flagged as EOL to avoid false support.
Written for commit 555d2f4. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.