Skip to content

ABI: implement exact private record construction #227

Description

@chrisbbreuer

Goal

Implement the exact pinned Home/Bun private-JSC record/object construction boundary for:

  • JSC__JSValue__putRecord
  • JSC__JSValue__fromEntries

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

Required semantics

JSC__JSValue__putRecord

  • Decode the target in the selected VM and reject invalid/foreign targets deterministically.
  • Decode the key and every value from all supported ZigString encodings without observable JavaScript coercion.
  • Preserve the pinned cardinality rule: zero values creates an empty array, one value creates a scalar string, and multiple values create an ordered string array.
  • Define a direct own data property with writable, enumerable, and configurable attributes, bypassing inherited setters.
  • Replace an existing own property with the exact constructed value.
  • Publish abrupt completion, allocation failure, and pre-existing pending exceptions through the shared first-wins exception boundary.

JSC__JSValue__fromEntries

  • Construct an ordinary selected-realm object with Object.prototype, including the zero-entry case.
  • Decode keys and values from all supported ZigString encodings without invoking JavaScript.
  • Preserve insertion order, duplicate-key last-value behavior, and ECMAScript integer-index enumeration ordering.
  • Match the pinned clone=false and clone=true ownership/lifetime behavior.
  • Handle null pointers, count/capacity overflow, and allocation failure without partial observable results.
  • Publish failures through the shared first-wins exception boundary.

Completion evidence

  • Add focused behavioral tests for both exports, including Latin-1/UTF-8/UTF-16 strings, duplicates, numeric keys, inherited setters, cardinalities, realm/VM rejection, pending exceptions, and allocation cleanup.
  • Add both symbols to the pinned Home/Bun inventories and the linkable private-value fixture.
  • Keep public/private export classification at zero unclassified symbols.
  • Run the focused test first, then one batched Home/Bun/public ABI audit.
  • Update the README and compatibility documentation with exact counts and evidence.
  • Close this issue only after the implementation and documentation commits are on origin/main.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions