Skip to content

chore(node): standardize on Node 24 LTS via .nvmrc single-source - #1144

Merged
robcohen merged 1 commit into
mainfrom
chore/node-24-standardize
May 18, 2026
Merged

robcohen merged 1 commit into
mainfrom
chore/node-24-standardize

Conversation

@robcohen

Copy link
Copy Markdown
Member

Summary

Repo had Node pinned in six different workflows on two different versions (22 and 24), plus stale floors: `engines: ">=18"` (Node 18 EOL'd Apr 2025) and a split between `@types/node ^20` (EOL'd Apr 2026) and `^22`.

Cleaning up: single `.nvmrc` at repo root, all workflows read from it, engines and types lifted to current LTS lines.

Why Node 24

Line Status Until
24 Active LTS Apr 2027
22 Maintenance LTS Apr 2027
20 EOL Apr 2026
18 EOL Apr 2025

24 has been Active LTS for ~7 months — well shaken out.

Changes

File Change
`.nvmrc` (new) `24`
5 workflows `node-version: '22'/'24'` → `node-version-file: '.nvmrc'`
`packages/mcp-server/package.json` `engines.node` `">=18"` → `">=24"`; `@types/node` `^22` → `^24`
`packages/vscode/package.json` `@types/node` `^20` → `^22` (see note below)
Both `package-lock.json` Refreshed

Why `vscode`'s @types/node lifts only to ^22, not ^24

VS Code's extension host still runs Node 20-22 internally (it lags the LTS line by ~1 cycle). Pinning `@types/node ^24` would give us type definitions for APIs that aren't actually available at runtime — exactly the bug class Copilot's earlier audit flagged. Going to ^22 lifts off the EOL'd ^20 line without outpacing the runtime.

`mcp-server` is different: it's a Node binary distributed via npm, runs on whatever the user installs, and is built/tested against `.nvmrc`'s version. Pinning `>=24` and `@types/node ^24` is correct there.

Test plan

  • All 5 workflow YAML files still parse.
  • mcp-server: 83/83 vitest tests pass.
  • vscode: `npm run package` produces `rustledger-vscode.vsix` (105 KB, 9 files) cleanly.

Next bump

Editing `.nvmrc` → all six workflows pick it up. Repeated drift across files is gone.

🤖 Generated with Claude Code

Repo had Node pinned in six different workflows on two different
versions (22 and 24), plus engines: ">=18" (Node 18 EOL'd Apr 2025)
and @types/node split between ^20 (EOL'd Apr 2026) and ^22. Cleaning
up.

Changes:

- New `.nvmrc` at repo root pinning Node 24 (Active LTS).
- All six workflow `node-version:` references replaced with
  `node-version-file: '.nvmrc'`. Next bump is a one-line file edit
  instead of six grep-and-replace.
  Files: release-publish.yml, release-build.yml, wasm.yml,
  bench.yml, docs-validate.yml.
- `packages/mcp-server/package.json`:
  - engines.node `">=18"` -> `">=24"` (mcp-server is a Node binary
    distributed via npm; should require what we build/test against)
  - @types/node `^22.0.0` -> `^24.0.0`
- `packages/vscode/package.json`:
  - @types/node `^20.0.0` -> `^22.0.0` (off the EOL'd 20 line, but
    deliberately *not* to 24 — VS Code's extension host still runs
    Node 20-22 internally; typing against APIs the runtime doesn't
    expose is exactly the bug class Copilot's audit flagged before)
- Refreshed both package-lock.json files.

Verified:
- mcp-server: 83/83 vitest tests pass.
- vscode: `npm run package` produces rustledger-vscode.vsix (105 KB,
  9 files) cleanly.
- All workflow YAML still parses.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 18, 2026 17:12
@robcohen
robcohen requested a review from a team as a code owner May 18, 2026 17:12
@robcohen
robcohen merged commit 33ff32f into main May 18, 2026
24 of 26 checks passed
@robcohen
robcohen deleted the chore/node-24-standardize branch May 18, 2026 17:13
@github-actions

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100%
Full AST Match 100%
Total Files 786
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

@robcohen
robcohen removed the request for review from Copilot May 18, 2026 17:36
robcohen added a commit that referenced this pull request May 18, 2026
…1147)

Two small tsconfig.json tweaks now that we're on TS 6 (PR #1146):

packages/mcp-server/tsconfig.json:
  target/lib ES2022 -> ES2024
  Node 24 is now pinned via .nvmrc (#1144), so we can take advantage
  of ES2024 built-ins (Object.groupBy, Promise.withResolvers, etc.)
  without runtime-availability concerns. Deliberately stopping short
  of ES2025 to avoid tying us to APIs that need the very latest Node
  minor; revisit later if a concrete use surfaces.

packages/vscode/tsconfig.json:
  - Add explicit moduleResolution: node10 + ignoreDeprecations: "6.0"
  - Add explicit types: ["node"]

  TS 6 deprecates the implicit `node10` resolution. We can't migrate
  to nodenext/bundler yet because @vscode/vsce (the extension
  publisher tooling) hasn't sanctioned that path for VS Code
  extensions. Setting the resolution explicitly + suppressing the
  deprecation keeps us building cleanly through the TS 6 line; a
  comment in-line documents when to revisit (TS 7 adoption).

  TS 6 also changes `types` default from [<all>] to []. Locking it
  to ["node"] makes the previously-implicit auto-include explicit
  so a future ignoreDeprecations drop doesn't silently lose types.

Skipped (not enough payoff in our code):
  - Subpath imports (`#/`): only 8 sibling files in mcp-server, no
    deep `../../` patterns.
  - Map.getOrInsert / RegExp.escape / Temporal: no natural insertion
    points found; would be a speculative refactor.
  - --stableTypeOrdering flag: TS 7 prep with ~25% type-check
    overhead; not worth it until we're actively migrating.

Verified:
  - mcp-server: tsc clean; 166/166 vitest tests pass
  - vscode: tsc clean; npm run package produces vsix without errors

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
robcohen added a commit that referenced this pull request May 18, 2026
Major version bump. Both packages compile and test cleanly with TS 6
— no source code changes required.

Bumps:
- packages/mcp-server: typescript ^5.7.0 -> ^6.0.0
- packages/vscode: typescript ^5.5.0 -> ^6.0.0

Not bumped:
- @types/node in mcp-server stays ^24.0.0 (matches the Node 24 LTS
  pinned in .nvmrc by #1144). @types/node 25 would target the
  current-but-non-LTS Node 25 line.
- @types/node in vscode stays ^22.0.0 (matches VS Code's extension-
  host runtime, also set by #1144).

Verified:
- mcp-server: tsc clean; 166/166 vitest tests pass.
- vscode: tsc clean; npm run package produces rustledger-vscode.vsix
  (105 KB) without errors.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
robcohen added a commit that referenced this pull request May 28, 2026
…) (#1212)

Both bindings' DirectiveJson::Document variants dropped tags and
links entirely from the wire output. The fields were added to
rustledger_core::Document in #1144 but never plumbed through to
either binding's DTO. Lockstep-wrong drop -- equivalence alone
would have missed it, but the new field-presence helper from #1204
caught it on first run.

Mirror the established Vec<Tag> -> Vec<String> pattern:
- Add `tags: Vec<String>`, `links: Vec<String>` with
  `skip_serializing_if = "Vec::is_empty"` to both bindings'
  Document variants.
- Populate via `d.tags.iter().map(ToString::to_string).collect()`
  in each binding's converter -- same pattern Transaction already
  uses for its tags/links.

`skip_serializing_if` (rather than always-emit, which is what
Transaction does for these vec fields) chosen here because:
- The fields are absent in today's wire output, so existing JS
  consumers parsing Document directives don't see them at all.
- skip-if-empty is backward-compatible: documents without tags
  continue to emit no tags field.
- always-emit would add `"tags": []` to every Document, which is a
  larger contract change for an audit fix.

TS declarations updated on all three surfaces (`beancount_wasm.d.ts`,
`beancount.d.ts`, the `typescript_custom_section` inline shape) with
`tags?: string[]` / `links?: string[]` matching the skip-if-empty
serialization.

The cross-binding equivalence test
(`document_directive_with_tags_and_links_equivalence`) had been
`#[ignore]`-pinned with this issue as the rationale; remove the
ignore so the test now guards convergence in CI.

Co-authored-by: Claude Opus 4.7 <[email protected]>
robcohen added a commit that referenced this pull request May 28, 2026
 #1214) (#1217)

The plugin layer dropped Document.tags and Document.links on **both
legs** of the round-trip, meaning any Document passing through a
plugin (even a no-op) lost its tags/links, and plugins synthesizing
Document directives couldn't attach them.

Four sites needed plumbing -- all `#1144`'s incomplete cascade:

1. **`DocumentData` DTO** (`crates/rustledger-plugin-types/src/lib.rs:821`)
   -- add `tags: Vec<String>` and `links: Vec<String>` with
   `#[serde(default)]` for backward-compat with serialized plugin
   state that predates this field.

2. **`document_to_data`** (`crates/rustledger-plugin/src/convert/to_wrapper.rs:236`)
   -- propagate `doc.tags`/`doc.links` via the same
   `.iter().map(ToString::to_string).collect()` pattern Transaction
   uses one site above.

3. **`data_to_document`** (`crates/rustledger-plugin/src/convert/from_wrapper.rs:389`)
   -- reconstruct `tags`/`links` from the DTO via
   `.iter().map(|t| t.as_str().into()).collect()`, mirroring
   Transaction's reverse path.

4. **WIT `record document`** (`crates/rustledger-plugin/wit/world.wit:145`)
   -- add `tags: list<string>, links: list<string>` so non-Rust
   plugins (Component Model consumers) see the new fields. No
   codegen to regenerate -- this WIT is a contract definition; the
   actual plugin transport uses MessagePack.

Drive-by: `document_discovery.rs` plugin constructs `DocumentData`
directly; updated to fill `tags: vec![], links: vec![]` so the new
required fields type-check (the plugin discovers documents from disk
and has no tag/link source).

Regression test `test_roundtrip_document_tags_and_links_1214` in
`rustledger-plugin::convert::tests` constructs a Document with
non-empty tags/links, runs it through `directive_to_wrapper` ->
`wrapper_to_directive`, and asserts both fields survived. Pre-fix
this test would have failed at both `document_to_data` (where
fields were unread) and `data_to_document` (where they were
hardcoded to empty).

Co-authored-by: Claude Opus 4.7 <[email protected]>
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