ReviewOS

zig-utils/zig-js

ABI: implement exact private JSON stringification

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

Goal

Implement the shared pinned Home/Bun JSON serialization pair:

  • JSC__JSValue__jsonStringify
  • JSC__JSValue__jsonStringifyFast

Parent: #134 Profile umbrella: #140 Home profile: #163 Bun profile: #164

Acceptance criteria

  • The normal export passes the unsigned indentation request through JSON.stringify semantics, including the ten-space clamp and exact pretty-print layout.
  • The fast export uses an undefined space value, producing the exact compact result without changing language semantics.
  • Both paths preserve toJSON, property enumeration order, getters, proxies, omission/null rules, BigInt/cycle errors, Unicode/lone-surrogate escaping, and selected-realm behavior.
  • A top-level non-serializable value returns an empty BunString without inventing an exception.
  • Successful results own exact Latin-1 or UTF-16 BunString storage with correct ref/deref lifetime.
  • Same-VM siblings, foreign values, invalid encodings, abrupt completion, output initialization, and first-pending-exception behavior are deterministic.
  • The combined private ABI fixture links and exercises both exports.
  • Home/Bun inventories, README/docs, and parent trackers publish the regenerated counts and green evidence.
  • Focused tests and the relevant batched ABI audits pass before closure.

Pinned reference

Bun revision 4982b91e, src/jsc/bindings/bindings.cpp, functions JSC__JSValue__jsonStringify and JSC__JSValue__jsonStringifyFast.

Completion evidence

  • Code: d345fc7b — normal indent-aware and undefined-space fast serialization with exact owned BunString output and boundary exception handling.
  • Documentation: 454782f0 — README, ABI, API, and Home integration evidence/counts.
  • Focused test: 3/3 passed, 0 skipped, 0 failed, 0 leaked.
  • Batched ABI gate: Home 212/431 implemented (219 pending), Bun 206/421 implemented (215 pending), public C 117/117 plus 216 private/support exports.
  • Consumer fixture: 211/211 symbols linked and the runtime matrix passed.
  • Benchmark report remains the isolated 1,540-sample artifact at 36a617b3; this ABI-only slice did not regenerate performance scores.
9 days ago

Completed on main in d345fc7 with documentation/evidence in 454782f. Focused tests passed 3/3 with zero leaks; Home/Bun/public audits and the 211/211 consumer fixture are green.

Sign in to comment on this issue.