Skip to content

Conversation

@kevinelliott
Copy link
Contributor

@kevinelliott kevinelliott commented Aug 14, 2025

chore(node): support Node >=18; test 18/20/22/24; dev on Node 24 types

Summary

Updates the Node.js support matrix to explicitly support Node >=18 while allowing development with the latest stable Node 24 types. This addresses the dependabot PR that wanted to bump @types/node to v24 by implementing a compatibility strategy that doesn't force Node 24 types onto library consumers.

Key Changes:

  • Added engines.node: ">=18" to explicitly communicate runtime support
  • Moved @types/node from dependenciesdevDependencies and bumped ^22.13.10^24.2.1
  • Set tsup target to "node18" to ensure compiled output stays compatible with Node 18+
  • Updated CI matrix from [18.x, 20.x, latest][18.x, 20.x, 22.x, 24.x] for deterministic testing

This preserves broad runtime compatibility (Node 18+) while allowing the development team to use modern Node 24 typings for better DX.

Review & Testing Checklist for Human

  • Verify CI passes on all Node versions (18.x, 20.x, 22.x, 24.x) - This is the critical validation that our compatibility strategy works
  • Test package import/usage on Node 18 - Create a small test script importing the built package on Node 18 to ensure no runtime compatibility regressions
  • Confirm tsup target "node18" produces compatible output - Inspect dist/ files to ensure no Node 19+ syntax is emitted
  • Validate that moving @types/node to devDependencies doesn't break consumers - Check that library users don't depend on transitive Node types

Diagram

%%{ init : { "theme" : "default" }}%%
graph TB
    PJ["package.json<br/>engines + deps"]:::major-edit
    TC["tsup.config.ts<br/>target: node18"]:::major-edit
    CI[".github/workflows/<br/>yarn-test.yml<br/>matrix: 18/20/22/24"]:::major-edit
    
    LIB["lib/**/*.ts<br/>Source Code"]:::context
    DIST["dist/**<br/>Built Output"]:::context
    
    PJ -->|"declares runtime<br/>support >=18"| LIB
    TC -->|"compiles for<br/>Node 18+"| DIST
    CI -->|"validates on<br/>4 Node versions"| DIST
    LIB -->|"built by tsup"| DIST
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit  
        L3[Context/No Edit]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

Summary by CodeRabbit

  • Tests

    • CI now runs against Node.js 18, 20, 22, and 24 for broader compatibility coverage.
  • Chores

    • Set minimum supported Node.js version to >=18.
    • Aligned build target to Node.js 18.
    • Updated development type dependencies; no runtime behavior changes.
  • Documentation

    • Added a Node.js Support Policy section to the README describing supported runtimes and CI validation.

…mp to ^24.x; tsup target node18; CI test Node 18/20/22/24

Co-Authored-By: Kevin Elliott <kevin@welikeinc.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@jazzberry-ai
Copy link

jazzberry-ai bot commented Aug 14, 2025

Bug Report

Name Severity Example test case Description
Missing Buffer import High Any message that triggers the MIAMCoreUtils or Label_H1_OHMA decoders will likely fail at runtime in Node.js 18+ due to the missing Buffer import. Specifically, this would be any message where message.text triggers the logic in MIAMCoreUtils or Label_H1_OHMA that uses Buffer. The files lib/utils/miam.ts and lib/plugins/Label_H1_OHMA.ts use the Buffer type, but do not import it from the node:buffer module. With @types/node moved to devDependencies, the Buffer type is no longer implicitly available, leading to runtime errors when these functions are called.

Comments? Email us.

@coderabbitai
Copy link

coderabbitai bot commented Aug 14, 2025

Walkthrough

Updates CI Node.js matrix to explicit versions (18, 20, 22, 24). Adds Node engine constraint (>=18), moves and bumps @types/node to devDependencies (^24.2.1), sets tsup build target to node18, and adds explicit Buffer imports in two source files. No functional control-flow changes.

Changes

Cohort / File(s) Summary
CI Node matrix update
.github/workflows/yarn-test.yml
Replaces matrix node-version [18.x, 20.x, latest] with [18.x, 20.x, 22.x, 24.x]; updates comment to reflect explicit stable versions.
Package engines and types
package.json
Adds "engines": { "node": ">=18" }; moves @types/node from dependencies to devDependencies and bumps it to ^24.2.1.
Build target configuration
tsup.config.ts
Adds target: "node18" and removes some inline comments; existing options (format: ["cjs","esm"], dts: true, entry/splitting/sourcemap/clean) unchanged.
Explicit Buffer imports
lib/plugins/Label_H1_OHMA.ts, lib/utils/miam.ts
Adds import { Buffer } from "node:buffer" to enable usage of Buffer.from for base64 decoding; no changes to logic, control flow, or public APIs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

I nibble code beneath moonlight,
Four Node versions hop in sight.
Types moved snug to dev-side bed,
Buffer joins where bytes are read.
Tsup points true — builds leap ahead. 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 895cbff and 6c8bd4f.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • lib/plugins/Label_H1_OHMA.ts (1 hunks)
  • lib/utils/miam.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • README.md
🧰 Additional context used
🧬 Code Graph Analysis (1)
lib/plugins/Label_H1_OHMA.ts (1)
lib/plugins/Label_H1_OHMA.test.ts (6)
  • decoder (80-99)
  • decoder (38-57)
  • decoder (17-36)
  • decoder (101-114)
  • decoder (59-78)
  • decoder (4-15)
🔇 Additional comments (1)
lib/utils/miam.ts (1)

3-4: LGTM — explicit Buffer import verified; no public Buffer types found

Confirmed: all runtime Buffer usages have an explicit import (e.g. lib/utils/miam.ts, lib/plugins/Label_H1_OHMA.ts) and no exported declarations reference Buffer types — no further changes needed.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1755138151-node-support-matrix

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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 (3)
package.json (1)

42-42: Action: Verify that published typings don't leak Node types (Buffer / NodeJS)

Quick results from a repo scan — please verify built declarations:

  • Findings:

    • Internal Buffer usage: lib/utils/miam.ts (lines 141, 153, 180, 225, 316, 330, 416, 480, 486).
    • Buffer.from used: lib/plugins/Label_H1_OHMA.ts:25.
    • CLI uses process.argv: lib/bin/acars-decoder.ts (lines 7–8) — CLI/runtime usage only.
    • No exported declarations that mention Buffer/NodeJS on the same line were found.
    • I did not find committed .d.ts files to inspect (can't confirm what your built dist/*.d.ts will contain).
  • Recommended next steps:

    • Inspect the built declaration files (dist/*.d.ts). If any declaration references Buffer/NodeJS or contains /// , consumers will need @types/node installed.
    • If declarations do leak Node types, either keep @types/node in dependencies, add it as a peerDependency, or document the requirement in README/tsconfig guidance.
    • Optionally add a CI check that scans generated .d.ts for Node-type references.

Context snippet:

"@types/node": "^24.2.1",
.github/workflows/yarn-test.yml (2)

19-20: Consider adding fail-fast: false so all Node versions complete even if one fails.
This helps you see breakage patterns across versions in one run.

Apply within the strategy block:

     strategy:
+      fail-fast: false
       matrix:
         # build against all active LTS and current stable node
         node-version: [18.x, 20.x, 22.x, 24.x]

Additionally, add a build + smoke test of the published entrypoints to validate tsup output on each Node version:

# after "Run tests"
- name: Build dist
  run: npm run build

- name: Smoke test CJS import
  run: node -e "require('./dist')"

- name: Smoke test ESM import
  run: node --input-type=module -e "import('./dist/index.mjs').then(()=>{}).catch(err=>{console.error(err); process.exit(1);})"

19-20: Workflow name suggests Yarn, but CI uses npm; package.json specifies packageManager: yarn@4.5.1.
If you intend to standardize on npm (package-lock.json is present), consider updating package.json’s packageManager field and renaming the workflow file. If you intend to standardize on Yarn v4, switch CI steps to Yarn (e.g., enable corepack, use yarn install --immutable, and yarn test). Keeping both can drift.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 121794c and 895cbff.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • .github/workflows/yarn-test.yml (1 hunks)
  • package.json (2 hunks)
  • tsup.config.ts (1 hunks)
🔇 Additional comments (4)
package.json (1)

19-21: Engines field set to Node >=18 is appropriate and aligned with CI and build target.
This cleanly communicates support policy and matches the tsup target and CI matrix. LGTM.

tsup.config.ts (2)

5-6: No functional change to format/dts — dual CJS/ESM and type generation remain.
Good to keep both entry formats and dts enabled.


10-10: Targeting "node18" is the right call to ensure JS feature downleveling.
This matches the engines constraint and CI. Just ensure tests catch accidental usage of Node 24-only runtime APIs (types are 24.x in dev).

.github/workflows/yarn-test.yml (1)

19-20: Explicit LTS + current stable versions in the matrix is a solid improvement.
Replacing “latest” with pinned majors avoids surprises and keeps runs deterministic. LGTM.

…port policy

Co-Authored-By: Kevin Elliott <kevin@welikeinc.com>
@kevinelliott kevinelliott self-assigned this Aug 14, 2025
@jazzberry-ai
Copy link

jazzberry-ai bot commented Aug 14, 2025

Bug Report

No bugs found.

Comments? Email us.

@kevinelliott kevinelliott added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 14, 2025
Copy link

@daviesgeek daviesgeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, didn't pull it down locally but if ci runs, is good.

@kevinelliott
Copy link
Contributor Author

This looks good, didn't pull it down locally but if ci runs, is good.

Thanks for the CR!

@kevinelliott kevinelliott merged commit 4739e86 into master Aug 14, 2025
10 checks passed
@kevinelliott kevinelliott deleted the devin/1755138151-node-support-matrix branch August 14, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants