ReviewOS

zig-utils/zig-js

ABI: implement exact ZigString JSON parsing

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

Parent: #134 Related: #140, #163, #164

Implement the pinned ZigString__toJSONObject private-ABI boundary, including its unusual returned-error-value contract.

Acceptance

  • Decode every supported ZigString representation and parse complete JSON with exact object/array/primitive construction and UTF-16 behavior.
  • Return the parsed value on success; on JSON syntax failure return the thrown SyntaxError value after clearing the transient VM exception, matching the pinned Bun boundary rather than publishing an ordinary pending exception.
  • Reject over-limit strings with an ERR_STRING_TOO_LONG Error value and avoid dereferencing an impossible oversized span.
  • Preserve selected-realm prototypes, sibling-realm operation, invalid-input/OOM safety, and an already-pending first exception.
  • Add focused leak coverage and the pinned consumer fixture, then refresh inventories, README/docs, and parent evidence.
9 days ago

Completed on main in two small commits: implementation and focused/consumer coverage at 7b1ebb26, then generated inventories and README/docs evidence in the following documentation commit.

Evidence:

  • all supported tagged ZigString forms feed the engine JSON parser
  • selected-realm object prototypes and astral Unicode content are preserved
  • malformed JSON returns the SyntaxError value and clears the transient parse exception
  • lengths above 2^32 - 1 return ERR_STRING_TOO_LONG before pointer dereference
  • sibling realms and first-pending preservation are covered
  • focused matrix: 3/3 passed, 0 leaked
  • pinned consumer fixture: 230/230 symbols linked; runtime matrix passed
  • Home audit: 231/431 implemented, 200 pending, 0 unclassified
  • Bun core audit: 225/421 implemented, 196 pending, 0 unclassified
  • public classification: 117 public, 19 extensions, 235 private/support exports

The committed JSC benchmark artifact remains 36a617b3; this ABI-only slice did not regenerate it.

9 days ago

Documentation/evidence commit: 77333231.

Sign in to comment on this issue.