ReviewOS

zig-utils/zig-js

Implement versioned UWS and H3 request visitor bridge

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

Parent: #381

Implement WebCore__FetchHeaders__createFromUWS and WebCore__FetchHeaders__createFromH3 through a revisioned C callback boundary. The exported parameters remain the pinned opaque C++ request handles; zig-js must never cast their layouts.

Acceptance:

  • Define a documented v1 byte-span visitor ABI with fixed sizes, calling conventions, versioning, and failure semantics.
  • Resolve the consumer bridge optionally/weakly so missing integrations return an empty native handle safely.
  • Copy each visited row immediately and match pinned HTTPHeaderMap known/uncommon duplicate behavior, raw value preservation, order, and H3 pseudo-header delivery.
  • Provide a pinned Bun 4982b91e C++ adapter using HttpRequest iteration and Http3Request::forEachHeader.
  • Add exact compile-link-runtime fixtures for bridge present/absent, callback abort, copied ownership, Debug/ReleaseSafe, inventories/docs/CI.
9 days ago

Implemented and pushed in a9e909b4 (bridge, pinned Bun adapter, inventories) and 727a1651 (exact fixtures and docs).

The v1 contract uses fixed {const uint8_t*, size_t} spans and synchronous boolean visitors. zig-js supplies weak fail-closed UWS/H3 definitions; the pinned consumer object supplies strong definitions that invoke the real C++ iteration APIs. Imports copy every row, preserve raw HTTP-map behavior including H3 pseudo-header delivery, and discard partial state on callback failure.

Evidence:

  • provider-present Bun FetchHeaders fixture: 24/24 symbols, exact UWS/H3 rows and copy ownership
  • provider-absent Bun executable: links and fails closed
  • Home fixture: 387/387, both absent bridges fail closed
  • Debug and ReleaseSafe passed for both consumer fixtures
  • C and C++ header syntax gates passed
  • inventories: Home 400/471, Bun 392/461, zero unclassified

Sign in to comment on this issue.