Skip to content

Review request: typed-wasm carrier-section proposal for L2–L6 / L15 enforcement (typed-wasm#76) #165

@hyperpolymath

Description

@hyperpolymath

typed-wasm has filed PR #76 — proposal 0001 Multi-Producer Carrier Sections for L2–L6 and L15, tracking typed-wasm#34. Ephapax is one of two current producers of typedwasm.ownership, so its review is gating before the proposal moves from [draft][review][accepted].

Disambiguation note (per the canonical doc): this review concerns Ephapax-the-language's src/ephapax-wasm/ codegen path, which targets typed-wasm. AffineScript is a separate language with its own producer. The two producers' reviews are independent — Ephapax's answer should reflect Ephapax's emission needs, not AffineScript's.

Why you specifically

The proposal explicitly names Ephapax's producer touchpoints:

  • src/ephapax-wasm/ — emits typedwasm.ownership on every compile.
  • src/ephapax-cli/ — exposes the verifier via ephapax compile --verify-ownership.

Any wire format we adopt has to be something Ephapax codegen can actually emit cleanly. Ephapax's dyadic structure (ephapax-linear + ephapax-affine sublanguages, one Rust crate, one AST) means both sublanguages must be able to round-trip whatever region/capability data the new sections demand.

What the proposal adds

Two new producer-neutral custom sections alongside the existing typedwasm.ownership:

  • typedwasm.regions — carries L2 (region binding), L3 (type-compatible access), L4 (null safety), L5 (bounds-proof), L6 (result-type).
  • typedwasm.capabilities — carries the L15 capability lattice (excluding L15-C per-call-site grants, deferred).

Both versioned, lenient-readable, same shape as the existing section.rs codec. Field-by-field mapping to typed-wasm's Region.idr / Pointer.idr / ResourceCapabilities.idr is in §Proposal.

L14 (session) and L16 (choreography) are explicitly out of scope.

Specific things to look at

  1. WasmType enum mapping — 11 variants (U8…WBool) encoded as u8 wasm_ty. Does this cover every type Ephapax emits? Any Ephapax-specific wasm types (e.g. WasmGC ref types, if/when Ephapax adopts them) that need a reserved encoding slot now?
  2. PtrKind encoding (Scalar / PtrOwning / PtrBorrow / PtrExclusive) — does this map cleanly to Ephapax's borrow model in both sublanguages? Ephapax-linear and ephapax-affine differ in their substructural rules; both should be expressible at the wire level even if the source semantics differ.
  3. Cardinality field (u32le, 1=single, n>1=fixed array, 0=unbounded). Does Ephapax emit any region field that's variable-length today?
  4. Capability list per function — strictly-increasing u32le[] of capability indices, structurally encoding DistinctCaps. Free for Ephapax codegen, or does this add ordering work?

Ask

Please review the wire format in PR #76 (§Proposal, ~lines 60–140) and flag anything that's missing, wrongly typed, or expensive for Ephapax to emit — from either sublanguage. Once you've signed off, I'll promote the proposal to [review], then [accepted] and start landing the codec in the Rust verifier behind cargo feature = \"unstable-l2\".

No code changes asked of this repo yet — codegen of the new sections is the follow-up after [accepted], not this proposal.

Refs

🤖 Generated with Claude Code


Update 2026-05-30 — Proposal 0002 landed + paired reviews completed

Two material changes since this issue was filed:

  1. Proposal 0002 (access-site carrier) merged. typed-wasm PR feat(stdlib): Argv — extern "env" pattern for wasm-host argv access #86 (2026-05-28) added docs/proposals/0002-access-site-carrier.adoc, which specifies the typedwasm.access-sites section (LEB128-per-field, ~5 B/access). This addresses Open Question §5 of proposal 0001 (option A — per-instruction access-site carrier). The wire format includes (func_idx, instruction_byte_offset, region_id, field_id) per typed access. Both this issue's review scope AND the affinescript paired review (#402) now span BOTH proposals.

  2. Two review comments received 2026-05-30 answering the four questions above + assessing proposal 0002:

    • First reviewer (12:38Z): comment 4582843365 — concise per-question verdict + 2 follow-ups filed (affinescript#444, typed-wasm#93).
    • Second reviewer (12:43Z): comment 4582855717 — extended assessment including proposal 0002.

Both reviews greenlight the wire formats. Both recommend [draft] → [review] promotion conditional on tracking issues being filed for outstanding open questions. As of 2026-05-30 the following gating issues exist:

  • typed-wasm#93 — annotate v0 producer surface (unused codepoints)
  • typed-wasm#94 — pin WBool wire width
  • typed-wasm#95 — proposal 0003 (typedwasm.region-imports) cross-module placeholder
  • typed-wasm#96 — typedwasm.capability-grants (L15-C v1.4.x) tracking
  • ephapax#221 — surface Ty::BorrowSharedBorrow / ExclBorrow at emission
  • affinescript#444 — extract Tw_section.{Encode,Decode} (dedup build_section)

Ephapax sign-off status: the two reviews together satisfy this issue's gating role per proposal 0001 §"Coordination with downstream producers." Owner action: bump proposal 0001 + 0002 status [draft] → [review] when ready.

🤖 Updated 2026-05-30 from paired-review closeout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions