ReviewOS

zig-utils/zig-js

Implement FetchHeaders private ABI and native adapters

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

Parent: #134

Child of #140, #163, and #164. Implement all 25 pinned WebCore__FetchHeaders__* entries against one exact Headers representation, including standalone native handles and consumer adapters.

Scope

  • Complete the shared create, createFromJS, cast, clone, cloneThis, toJS, ref-lifetime, count, copy, append, put, get, has, remove, isEmpty, and fast-header operations.
  • Implement the pinned UWS, H3, PicoHeaders, and UWS response adapter boundaries from their exact revisioned layouts; do not guess or dereference unvalidated foreign records.
  • Implement createValue/createValueNotJS from the pinned StringPointer/ZigString span contract.

Acceptance

  • JavaScript-created and native-created Headers values share one canonical ordered representation with an unspoofable engine brand.
  • Header names and values follow Fetch validation and normalization, duplicate combination, Set-Cookie separation, insertion ordering, and WebIDL exception behavior.
  • Handles have explicit VM/realm ownership and native lifetime semantics; null, stale, foreign-VM, and exception paths are deterministic.
  • Fast HTTPHeaderName indexes map exactly to the pinned enum and have parity with general get/has/remove operations.
  • copyTo and callback/output strings have documented ownership and remain valid for the consumer-required lifetime.
  • External request/response adapters are covered by exact-layout fixtures and reject unsupported layouts rather than exposing partial behavior.
  • Add focused engine tests plus compiled Home and Bun declaration/runtime fixtures in Debug and ReleaseSafe.
  • Refresh both inventories, concise ABI/API docs, CI, and parent progress. Root benchmark numbers change only after a new accepted benchmark run.

Children

  • #376 — core lifecycle and buffer ABI
  • #377 — UWS, H3, and Pico native adapters
9 days ago

The initial audit is complete. The 25-symbol family is decomposed into #376 for 21 core lifecycle/buffer exports and #377 for four foreign UWS/H3/Pico adapters. The current JS Headers implementation is list-backed and unbranded; #376 therefore needs an explicit native lifetime/ownership layer before exports are added. The adapter child remains separate because the pinned C++ request/response layouts cannot be safely guessed from opaque pointers.

9 days ago

Core child #376 is complete in 975386e2 + b4a9f717: 21/21 scoped FetchHeaders exports now have exact runtime coverage. Current inventories are Home 397/471 and Bun 389/461. The remaining work in this umbrella is only #377, covering the four foreign Pico/UWS/H3 adapter boundaries.

9 days ago

FetchHeaders is complete: 25/25 pinned symbols are implemented across core #376 and adapters #377. Final counts are Home 401/471 and Bun 393/461, with Home 388/388 and Bun FetchHeaders 25/25 runtime fixtures passing in Debug and ReleaseSafe.

Sign in to comment on this issue.