test: #695 — behavioral parity fixtures for runtime core FFI surface#756
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converts ~555 inventory entries from
test_ffi_surface_runtime_core.tsinto deterministic behavioral TypeScript parity tests, the follow-up tracked by #695 from #694.Adds six focused fixtures, each with an
@coversmanifest sotest-coverage/regen_ts_surface_inventory.pymoves 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/isArraytest_compat_objects_symbols.ts—Object.keys/values/entries, descriptors,freeze/seal/preventExtensions,Symbol.for/keyFor, classinstanceofand getters,Object.groupBy, spread/rest,MapandSetwith insertion-order iterationtest_compat_strings_regex_json.ts— char-code helpers,slice/substring, case/trim/pad/repeat/split/replace,btoa/atob, regexexec/test/flags, named groups,matchAll,JSON.parse/stringifywith replacer/revivertest_compat_url_date_math.ts—URLaccessors and mutation,URLSearchParamsread paths, fixed-epochDategetters/setters in UTC,Mathconstants and trig/log/exp helpers,Number/BigIntparsing and arithmetictest_compat_async_errors.ts—Promise.{resolve,reject,all,allSettled,race,any,withResolvers}, async/await with chainedthen/catch/finally, error subclasses withcause,AggregateError,try/catch/finally,structuredClone, async generatorstest_compat_buffers_typed.ts—Buffer.{alloc,allocUnsafe,from,concat,compare,equals,includes}, numeric read/write helpers across all widths/endians,BigIntreads/writes,Uint*/Int*typed arrays,typeof/truthiness, closure-arity exercisesInventory + coverage
test_ffi_surface_runtime_core.ts: 915 → 360 unique FFI names.test-coverage/COVERAGE.md: TypeScript FFI surface coverage stays at 100% (1790/1790).Known gaps deliberately not exercised
Behaviors that currently diverge from Node and stay in the inventory / gap suite for follow-up:
Array.prototype.concatArray.prototype.lastIndexOfArray.prototype.entries().next().valuetupleSymbol.iteratorinfor…ofDataView.prototype.setInt32/setFloat32String.prototype.replace(regex, fn)URLSearchParamsordering afterdeleteBigIntlarge 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