Skip to content

test: #695 — behavioral parity fixtures for runtime core FFI surface#756

Merged
proggeramlug merged 1 commit into
mainfrom
test/issue-695-behavioral-ffi-fixtures
May 14, 2026
Merged

test: #695 — behavioral parity fixtures for runtime core FFI surface#756
proggeramlug merged 1 commit into
mainfrom
test/issue-695-behavioral-ffi-fixtures

Conversation

@TheHypnoo
Copy link
Copy Markdown
Contributor

Summary

Converts ~555 inventory entries from test_ffi_surface_runtime_core.ts into deterministic behavioral TypeScript parity tests, the follow-up tracked by #695 from #694.

Adds six focused fixtures, each with an @covers manifest so test-coverage/regen_ts_surface_inventory.py moves the listed FFI names out of the inventory:

  • test_compat_arrays_iterators.ts — array creation/mutation, higher-order iteration, immutable variants (toSorted/toReversed/toSpliced/with), flat/flatMap, Array.of/from/isArray
  • test_compat_objects_symbols.tsObject.keys/values/entries, descriptors, freeze/seal/preventExtensions, Symbol.for/keyFor, class instanceof and getters, Object.groupBy, spread/rest, Map and Set with insertion-order iteration
  • test_compat_strings_regex_json.ts — char-code helpers, slice/substring, case/trim/pad/repeat/split/replace, btoa/atob, regex exec/test/flags, named groups, matchAll, JSON.parse/stringify with replacer/reviver
  • test_compat_url_date_math.tsURL accessors and mutation, URLSearchParams read paths, fixed-epoch Date getters/setters in UTC, Math constants and trig/log/exp helpers, Number/BigInt parsing and arithmetic
  • test_compat_async_errors.tsPromise.{resolve,reject,all,allSettled,race,any,withResolvers}, async/await with chained then/catch/finally, error subclasses with cause, AggregateError, try/catch/finally, structuredClone, async generators
  • test_compat_buffers_typed.tsBuffer.{alloc,allocUnsafe,from,concat,compare,equals,includes}, numeric read/write helpers across all widths/endians, BigInt reads/writes, Uint*/Int* typed arrays, typeof/truthiness, closure-arity exercises

Inventory + coverage

Known gaps deliberately not exercised

Behaviors that currently diverge from Node and stay in the inventory / gap suite for follow-up:

  • Multi-arg Array.prototype.concat
  • Array.prototype.lastIndexOf
  • Array.prototype.entries().next().value tuple
  • Custom Symbol.iterator in for…of
  • DataView.prototype.setInt32 / setFloat32
  • String.prototype.replace(regex, fn)
  • URLSearchParams ordering after delete
  • BigInt large left-shift (1n << 60n)
  • Object.create(proto) prototype chain lookup (null-proto path is exercised instead)

Test plan

  • ./test-coverage/regen_ts_surface_inventory.py
  • ./test-coverage/audit.sh --markdown — 100% TS FFI surface coverage
  • ./run_parity_tests.sh --filter test_compat_ — 7/7 PASS
  • ./run_parity_tests.sh --filter test_ffi_surface — 5/5 PASS (no regression)

Notes

Per CLAUDE.md and contributor guidance, this PR does not bump the workspace version or edit CHANGELOG.md / CLAUDE.md — the maintainer handles that at merge time.

Checklist

  • I have NOT bumped the workspace version or edited CLAUDE.md / CHANGELOG.md
  • My commit follows the loose conventional prefix style used in the log
  • I've read CONTRIBUTING.md and agree to the Code of Conduct

Add six focused TypeScript parity fixtures that convert ~555 FFI surface
inventory entries into deterministic behavioral parity coverage against
Node --experimental-strip-types:

- test_compat_arrays_iterators.ts: array creation/mutation, higher-order
  iteration, immutable variants (toSorted/toReversed/toSpliced/with),
  flat/flatMap, Array.of/from/isArray
- test_compat_objects_symbols.ts: Object.keys/values/entries, descriptors,
  freeze/seal/preventExtensions, Symbol.for/keyFor, class instanceof and
  getters, Object.groupBy, Object spread/rest, Map and Set with
  insertion-order iteration
- test_compat_strings_regex_json.ts: char-code helpers, slice/substring,
  case/trim/pad/repeat/split/replace, btoa/atob, regex exec/test/flags,
  named groups, matchAll, JSON parse/stringify with replacer/reviver
- test_compat_url_date_math.ts: URL accessors and mutation, URLSearchParams
  read paths, fixed-epoch Date getters/setters in UTC, Math constants and
  trig/log/exp helpers, Number/BigInt parsing and arithmetic
- test_compat_async_errors.ts: Promise.{resolve,reject,all,allSettled,
  race,any,withResolvers}, async/await with chained then/catch/finally,
  Error subclasses with cause, AggregateError, try/catch/finally,
  structuredClone, async generators
- test_compat_buffers_typed.ts: Buffer.{alloc,allocUnsafe,from,concat,
  compare,equals,includes}, numeric read/write helpers across all
  widths/endians, BigInt reads/writes, Uint*/Int* typed arrays,
  typeof/truthiness coverage and closure-arity exercises

Each fixture embeds an @Covers manifest so
test-coverage/regen_ts_surface_inventory.py moves the listed FFI names out
of test_ffi_surface_runtime_core.ts. Inventory shrinks from 915 to 360
unique names; test-coverage/audit.sh --markdown still reports 100%
TypeScript FFI surface coverage.

Behaviors that currently diverge from Node (multi-arg Array.concat,
Array.prototype.lastIndexOf, .entries().next().value tuple, custom
Symbol.iterator in for-of, DataView setInt32/setFloat32, regex replace
with function callback, URLSearchParams ordering after delete,
BigInt large left-shift) are intentionally not exercised here; those gaps
remain in the inventory and the gap suite for follow-up.
@proggeramlug proggeramlug merged commit 9944a4b into main May 14, 2026
9 checks passed
@proggeramlug proggeramlug deleted the test/issue-695-behavioral-ffi-fixtures branch May 14, 2026 04:55
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