ReviewOS

zig-utils/zig-js

ABI: implement exact private property access and mutation

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

Parent

Scope

Implement the pinned Home/Bun private property-boundary imports with JavaScriptCore-compatible observable behavior:

  • JSC__JSValue__createObject2
  • JSC__JSValue__put
  • JSC__JSValue__putToPropertyKey
  • JSC__JSValue__deleteProperty
  • JSC__JSValue__getIfPropertyExistsImpl
  • JSC__JSValue__getPropertyValue
  • JSC__JSValue__getOwn
  • JSC__JSValue__getOwnByValue

Acceptance criteria

  • createObject2 creates a selected-realm ordinary object and defines key 2 before key 1 with writable/enumerable/configurable data descriptors; duplicate keys retain key 2's insertion position but key 1's value.
  • ZigString put performs a direct named own write, bypassing inherited setters, while property-key putToPropertyKey performs ToPropertyKey once, preserves symbols, handles indexes, and publishes coercion/write exceptions.
  • deleteProperty uses ordinary [[Delete]], including proxy traps and configurability rules, and returns false for non-objects and exceptions.
  • getPropertyValue performs ordinary prototype-aware [[Get]], including indexes, accessors, and proxies; absence returns the deleted sentinel and exceptions return empty.
  • getIfPropertyExistsImpl implements Bun's non-index prototype-pollution-mitigated lookup: walk own properties/proxies but stop before the selected realm's %Object.prototype%; absence returns deleted and exceptions return empty.
  • getOwn and getOwnByValue use GetOwnProperty, invoke own accessors/proxy traps, support BunString/Empty and exact property-key coercion/index paths, and return empty for absence or exception.
  • Focused ABI coverage exercises duplicate-key order, direct-write bypass, numeric and symbol keys, inherited and own accessors, proxy traps, non-configurable delete, prototype cutoff, non-object sentinels, throwing coercion/accessors/traps, cross-realm values, and pending-exception preservation.
  • Home/Bun implementation inventories, ABI documentation, README progress, and parent trackers are updated from checked-in evidence.
9 days ago

Implemented and published directly on main.

Implementation: 28eb0306 (feat(abi): implement private property boundary (#203)) Documentation: 38629616 (docs(abi): publish property boundary evidence (#203))

Delivered:

  • all eight pinned exports: createObject2, direct ZigString put, single-coercion putToPropertyKey, ordinary deleteProperty, normal and Object.prototype-cutoff reads, plus BunString/value-key own reads;
  • a found-aware ordinary [[Get]] path that distinguishes absent from present-undefined without adding a Proxy has trap;
  • exact key-2-first duplicate insertion semantics, selected-realm prototypes, numeric/Symbol/property coercion, Latin-1 names, accessor/proxy behavior, empty/deleted exception sentinels, sibling identity, foreign rejection, and first-exception preservation;
  • refreshed Home/Bun inventories and README/API/Home integration evidence.

Validation:

  • zig build test-home-private-abi -Doptimize=Debug — green, 111/111 symbols linked and runtime matrix passed.
  • zig build home-private-abi-audit bun-private-abi-audit — green.
  • Home: 113/431 implemented, 318 pending.
  • Bun core: 106/421 implemented, 315 pending.
  • Public/extension accounting remains 117/19.

README benchmark scores were preserved because this was an ABI/correctness slice and no benchmark inputs changed.

Sign in to comment on this issue.