ReviewOS

zig-utils/zig-js

ABI: implement exact deep equality and matching

#229
Closed chris opened this 9 days ago ·
9 days ago

Goal

Implement the exact pinned Home/Bun private-JSC structural comparison family:

  • JSC__JSValue__deepEquals
  • JSC__JSValue__strictDeepEquals
  • JSC__JSValue__jestDeepEquals
  • JSC__JSValue__jestStrictDeepEquals
  • JSC__JSValue__jestDeepMatch

This is a child of #134, #140, #163, and #164.

Required semantics

Shared structural engine

  • Preserve primitive SameValue/strict comparison rules, pairwise cycle detection, and failure-atomic traversal.
  • Compare enumerable string and Symbol properties with exact ordinary Get/proxy/getter observability and ordering-independent key matching.
  • Cover dense, sparse, and accessor Arrays; ordinary/null-prototype/class objects; boxed primitives; functions; and cross-realm prototypes.
  • Cover Date, RegExp, Error name/message/cause/enumerables, Map, Set, ArrayBuffer, DataView, every numeric TypedArray, detached/shared backing, and float NaN/signed-zero behavior.
  • Preserve strict-mode distinctions for prototypes, missing versus explicit undefined, sparse holes, Error causes/types, and bitwise typed-float comparison.
  • Reject invalid or foreign-VM inputs deterministically, publish traversal exceptions, and preserve the first pending exception.

Jest modes and subset matching

  • Implement asymmetric matcher dispatch and its exception/callability behavior only for Jest-enabled equality.
  • Implement recursive subset matching for jestDeepMatch, including inherited/existing properties, nested object-containing behavior, cycles, and optional replacement of matched properties.
  • Keep non-Jest equality free of matcher hooks.

Child issues

  • #230 — core structural engine and non-Jest equality
  • #231 — Jest asymmetric equality and subset matching

Completion evidence

  • Add focused matrices for primitives, prototypes, arrays/holes, cycles, maps/sets, buffers/views, dates/regex/errors, getters/proxies, Symbols, asymmetric matchers, subset replacement, sibling realms, foreign VMs, and first-wins exceptions.
  • Add all five symbols to both pinned inventories and the linkable private-value fixture.
  • Keep public/private export classification at zero unclassified symbols.
  • Run focused tests during implementation, then one batched Home/Bun/public ABI audit.
  • Update README and compatibility documentation with exact counts and evidence.
  • Close only after implementation and documentation commits are on origin/main.
9 days ago

All five pinned structural comparison exports are implemented and documented on origin/main.

  • core engine: 0b025285; core docs: 9d511f93
  • Jest layer: 06864e96; Jest docs: 8fc2f925
  • focused core and Jest matrices each pass 3/3 with zero leaks
  • combined fixture passes 219/219
  • Home is 220/431 implemented (211 pending)
  • Bun core is 214/421 implemented (207 pending)
  • public/private audit remains 117 public, 19 extensions, 224 private/support, zero unclassified

#230 and #231 are both complete. Benchmarks remain at committed artifact 36a617b3, correctly unchanged for this ABI-only family.

Sign in to comment on this issue.