Tests: map Node 26.13's new callables, and expect createDecipheriv in the features fixture #23

Merged
sionzee merged 1 commit from fix/node-26-13-inventory into main 2026-11-03 21:44:46 +01:00
Owner

Fixes the two tests that fail on main (0e01fb3) and so in every open PR.

1. features fixture: createDecipheriv()

main.ts:55 unhandled-failure was unexpected. git log -p shows that 496821e added both the createDecipheriv call in the fixture and its throws entry (with its own error text, RangeError (invalid key or IV length)) in node-api.json. The map has been right from the start; the fixture line just never got its annotation. The fix adds // expect: unhandled-failure.

2. Manifest test on Node 26.13

inventory.ts reported 205 unmapped and 41 stale. Those came from three causes:

New in Node 26.13, now mapped. Each one was classified by reading Node's built-in JS source (process.binding("natives")) and by calling it in node 26.13 for the failure cases, following the existing entries:

  • node:ffi (new, node:-only, so added to PREFIXED): loading a library and resolving symbols are throws (ERR_FFI_CALL_FAILED). Pointer get/set/export calls are args. close and getSymbols are never.
  • node:zlib ZIP API (ZipFile, ZipEntry, ZipBuffer, createZipArchive*, zipFiles): opening and reading archives is throws/rejects (ENOENT, ERR_ZIP_INVALID_ARCHIVE, ERR_ZIP_ENTRY_NOT_FOUND, ERR_ZIP_ENTRY_CORRUPT). Writes to a ZipFile are throws/rejects. Builders are args. Streams are event. forEach is propagates.
  • node:perf_hooks histogram statistics: importHistogram is throws (invalid export data). Methods with range checks are args. Type-only checks are never.
  • crypto createMac (key length, MAC or digest: throws, like createCipheriv), parsePKCS12 (bad bundle or passphrase: throws), getMacs (never); fs.openAsBlobSync (throws, ENOENT); BlockList CIDR/remove methods (args, like addSubnet); Buffer.stringLength, isLatin1, Blob#textStream; http isValidHeader* and websocketMask/Unmask; util debounce/throttle/MIMEType.parse (returns null)/markPromiseAsHandled/isPartialDeepStrictEqual; v8.setHeapProfileNearHeapLimit; ReadableStreamTee; Writable.writeKnownBuffer; https Agent#keepSocketAlive.
  • node:sqlite renamed DatabaseSync/StatementSync to Database/Statement. The old names are aliases, so the inventory reports the new ones. The map is renamed, and gains Database#createModule, Statement#stat, Statement#resetStats and Statement#close.

Platform, not version. The map was generated on Windows: the Windows node.exe here is 26.4.0, and on Windows path === path.win32.

  • The inventory skipped whichever of node:path/posix / node:path/win32 is the same object as node:path, so it listed path/posix on Windows and path/win32 elsewhere. It now lists both everywhere.
  • posixOnly claimed fs.lchmod/lchmodSync exist on POSIX. Node defines them only when O_SYMLINK exists, which means macOS. posixOnly is replaced by platformOnly: { posix: {...}, darwin: {...} }.

A slow probe. The ClientHttp2Session probe connected to 127.0.0.1:9. Under WSL mirrored networking nothing answers there, so the test process stayed alive about 134 s waiting for the TCP timeout (on main too). The probe now uses an in-memory createConnection socket, and the manifest test takes 0.3 s.

ZipEntry.read and createZipArchiveSync are sync generators that throw on iteration, not when called. They are mapped as iterates, whose description now reads "an iterator (usually async)". throws would be wrong at the call site, and would also put a broad read method into the zlib pack.

safe-ts.json is regenerated with inventory.ts --write-pack: 183 → 189 functions, 216 → 231 methods. Some fs method keys moved because the old file wasn't in the generator's sort order; the test compares with deepEqual, which ignores key order. The README and docs/guide/libraries.md numbers are updated (2,004 callables in Node 26.13 counting platform-specific ones, plus the category counts).

Testing

  • cargo nextest run: 95 passed, 0 failed
  • npm run test:std: 116 passed, 0 failed (manifest test included)
  • npm run test:docs: passes (typecheck, wasm, VitePress build)
  • node packages/feature-node/test/inventory.ts: 2002 callables; 0 unmapped, 0 stale, 0 mapped twice

Left out / uncertain

  • Verified on Linux only. The Windows Node here is 26.4, so I couldn't check the map on Windows 26.13. The path and lchmod changes should make Windows and Linux agree. Anything Windows lacks in 26.13 beyond posix process.get*/set* would show up as stale there.
  • CI version risk. The manifest test is pinned to the running Node by design, and .forgejo/workflows/pages.yml uses a floating node-version: 26. Today that workflow only builds the docs and doesn't run test:std, so I left it alone. If the test ever runs in CI, pin the exact version (26.13.0), or every Node minor will break it.
  • Not inventoried. crypto's new Mac class (createMac() returns it) isn't exported, so the inventory doesn't see it, the same as before for other unexported classes. I didn't add it as an instance probe: Mac#final only fails on misuse (args), and that would drop final from the crypto pack, losing decipher.final().
  • Name-wide matching. As with the existing entries, pack methods match by name across a module. New zlib method names (open, stream, content, getSync, toBuffer, ...) are reported on any value from node:zlib.

🤖 Generated with Claude Code

Fixes the two tests that fail on `main` (0e01fb3) and so in every open PR. ## 1. features fixture: `createDecipheriv()` `main.ts:55 unhandled-failure` was unexpected. `git log -p` shows that 496821e added both the `createDecipheriv` call in the fixture and its `throws` entry (with its own error text, `RangeError (invalid key or IV length)`) in node-api.json. The map has been right from the start; the fixture line just never got its annotation. The fix adds `// expect: unhandled-failure`. ## 2. Manifest test on Node 26.13 `inventory.ts` reported 205 unmapped and 41 stale. Those came from three causes: **New in Node 26.13, now mapped.** Each one was classified by reading Node's built-in JS source (`process.binding("natives")`) and by calling it in node 26.13 for the failure cases, following the existing entries: - `node:ffi` (new, `node:`-only, so added to `PREFIXED`): loading a library and resolving symbols are `throws` (`ERR_FFI_CALL_FAILED`). Pointer get/set/export calls are `args`. `close` and `getSymbols` are `never`. - `node:zlib` ZIP API (`ZipFile`, `ZipEntry`, `ZipBuffer`, `createZipArchive*`, `zipFiles`): opening and reading archives is `throws`/`rejects` (ENOENT, `ERR_ZIP_INVALID_ARCHIVE`, `ERR_ZIP_ENTRY_NOT_FOUND`, `ERR_ZIP_ENTRY_CORRUPT`). Writes to a `ZipFile` are `throws`/`rejects`. Builders are `args`. Streams are `event`. `forEach` is `propagates`. - `node:perf_hooks` histogram statistics: `importHistogram` is `throws` (invalid export data). Methods with range checks are `args`. Type-only checks are `never`. - crypto `createMac` (key length, MAC or digest: `throws`, like `createCipheriv`), `parsePKCS12` (bad bundle or passphrase: `throws`), `getMacs` (`never`); `fs.openAsBlobSync` (`throws`, ENOENT); BlockList CIDR/remove methods (`args`, like `addSubnet`); `Buffer.stringLength`, `isLatin1`, `Blob#textStream`; http `isValidHeader*` and `websocketMask/Unmask`; util `debounce`/`throttle`/`MIMEType.parse` (`returns` null)/`markPromiseAsHandled`/`isPartialDeepStrictEqual`; `v8.setHeapProfileNearHeapLimit`; `ReadableStreamTee`; `Writable.writeKnownBuffer`; https `Agent#keepSocketAlive`. - `node:sqlite` renamed `DatabaseSync`/`StatementSync` to `Database`/`Statement`. The old names are aliases, so the inventory reports the new ones. The map is renamed, and gains `Database#createModule`, `Statement#stat`, `Statement#resetStats` and `Statement#close`. **Platform, not version.** The map was generated on Windows: the Windows `node.exe` here is 26.4.0, and on Windows `path === path.win32`. - The inventory skipped whichever of `node:path/posix` / `node:path/win32` is the same object as `node:path`, so it listed path/posix on Windows and path/win32 elsewhere. It now lists both everywhere. - `posixOnly` claimed `fs.lchmod`/`lchmodSync` exist on POSIX. Node defines them only when `O_SYMLINK` exists, which means macOS. `posixOnly` is replaced by `platformOnly: { posix: {...}, darwin: {...} }`. **A slow probe.** The `ClientHttp2Session` probe connected to `127.0.0.1:9`. Under WSL mirrored networking nothing answers there, so the test process stayed alive about 134 s waiting for the TCP timeout (on `main` too). The probe now uses an in-memory `createConnection` socket, and the manifest test takes 0.3 s. `ZipEntry.read` and `createZipArchiveSync` are sync generators that throw on iteration, not when called. They are mapped as `iterates`, whose description now reads "an iterator (usually async)". `throws` would be wrong at the call site, and would also put a broad `read` method into the zlib pack. safe-ts.json is regenerated with `inventory.ts --write-pack`: 183 → 189 functions, 216 → 231 methods. Some fs method keys moved because the old file wasn't in the generator's sort order; the test compares with `deepEqual`, which ignores key order. The README and `docs/guide/libraries.md` numbers are updated (2,004 callables in Node 26.13 counting platform-specific ones, plus the category counts). ## Testing - `cargo nextest run`: 95 passed, 0 failed - `npm run test:std`: 116 passed, 0 failed (manifest test included) - `npm run test:docs`: passes (typecheck, wasm, VitePress build) - `node packages/feature-node/test/inventory.ts`: `2002 callables; 0 unmapped, 0 stale, 0 mapped twice` ## Left out / uncertain - **Verified on Linux only.** The Windows Node here is 26.4, so I couldn't check the map on Windows 26.13. The path and lchmod changes should make Windows and Linux agree. Anything Windows lacks in 26.13 beyond `posix` `process.get*/set*` would show up as stale there. - **CI version risk.** The manifest test is pinned to the running Node by design, and `.forgejo/workflows/pages.yml` uses a floating `node-version: 26`. Today that workflow only builds the docs and doesn't run `test:std`, so I left it alone. If the test ever runs in CI, pin the exact version (`26.13.0`), or every Node minor will break it. - **Not inventoried.** crypto's new `Mac` class (`createMac()` returns it) isn't exported, so the inventory doesn't see it, the same as before for other unexported classes. I didn't add it as an instance probe: `Mac#final` only fails on misuse (`args`), and that would drop `final` from the crypto pack, losing `decipher.final()`. - **Name-wide matching.** As with the existing entries, pack methods match by name across a module. New zlib method names (`open`, `stream`, `content`, `getSync`, `toBuffer`, ...) are reported on any value from `node:zlib`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
main had two failing tests.

The features fixture calls createDecipheriv(), which node-api.json has
mapped as throwing since 496821e (the same commit that added the call), but
the line never got its `// expect: unhandled-failure`. The map is right; the
fixture now expects it.

The manifest test failed on Node 26.13 (Linux) with 205 unmapped and 41
stale names. Part of it was Node: new callables (node:ffi, zlib's ZipFile/
ZipEntry/ZipBuffer, histogram statistics, BlockList CIDRs, crypto
createMac/parsePKCS12, util debounce/throttle, ...) and node:sqlite renaming
DatabaseSync/StatementSync to Database/Statement. Each new one is mapped
from Node's own source and by trying it, like the existing entries.

Part of it was the platform: the map was generated on Windows (Node 26.4).
node:path is path/win32 there and path/posix elsewhere, so the inventory
listed only one of the two; it now lists both everywhere. posixOnly said
fs.lchmod/lchmodSync exist on POSIX, but Node defines them only on macOS;
it is now platformOnly, by platform. The http2 probe connected to
127.0.0.1:9, which under WSL mirrored networking waits for a 2-minute TCP
timeout; it uses an in-memory socket now.

ZipEntry.read and createZipArchiveSync are sync generators that throw while
iterated, not when called, so they are `iterates` (whose description now
says "an iterator (usually async)") rather than `throws`.

safe-ts.json is regenerated (189 functions, 231 methods), and the docs and
README numbers follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
sionzee deleted branch fix/node-26-13-inventory 2026-11-03 21:44:46 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Evobug/Safe-Ts!23
No description provided.