Skip to content

stdlib Http: typed-wasm target (convergence ABI; shared with Ephapax) #225

@hyperpolymath

Description

@hyperpolymath

Next slice after the Deno-ESM Http primitive (#160). The Deno-ESM target is landed and exercised end-to-end; this issue tracks the typed-wasm target for the same stdlib/Http.affine surface.

Scope

Make Http.fetch/get/post/request work when AffineScript compiles to typed WasmGC (the primary AffineScript target), with identical source-level semantics to the Deno-ESM path.

Why this is convergence-layer work, not AffineScript-internal

The typed-wasm binary conventions are the shared convergence ABI (typed-wasm ADR-004): AffineScript and Ephapax both compile to typed WasmGC and need agreed layout/ABI/host-import conventions. This slice irons the HTTP host-boundary conventions out in the typed-wasm repo, with AffineScript as the first consumer and Ephapax as a co-stakeholder.

  • AffineScript is not coupled to typed-wasm by this work, and this does not constrain Ephapax or any future consumer — it only fixes shared conventions where they already converge.
  • The HTTP host-import contract (memory layout for strings / assoc-list headers / Option body / Response, plus the async story) belongs in the typed-wasm ABI spec; the AffineScript lib/codegen.ml change is the consumer of that contract.

The two real ABI problems (design, not wiring)

  1. i32-only boundary. The WasmGC backend's host-import path is i32-only — String / [(String,String)] / Option<String> / the Response record cannot cross directly. Needs a memory-marshalling convention (ptr/len pairs, or a structured-handle table like the Node-CJS shim's), specified in the typed-wasm ABI.
  2. Async over a synchronous import. fetch is async; wasm imports are synchronous. Needs a suspension design (JS Promise Integration / JSPI, or a host-driven continuation) — shared with Ephapax's async story so both languages agree.

Acceptance

  • typed-wasm ABI spec section for the HTTP host boundary (string/assoc/Option/record marshalling + async)
  • AffineScript lib/codegen.ml lowers http_request to the agreed host import
  • Node-CJS shim provides the import; e2e parity test mirrors tests/codegen-deno/http_fetch.*
  • Ephapax co-stakeholder review of the ABI section

Refs #160. Companion: typed-wasm ADR-004.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmajorMajor issue — significant scope, broader impact than a feature/bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions