Skip to content

fix: header maps and per-hook header writes match the FastEdge edge - #61

Merged
godronus merged 2 commits into
mainfrom
fix/unsupported-header-maps
Nov 5, 2026
Merged

godronus merged 2 commits into
mainfrom
fix/unsupported-header-maps

Conversation

@godronus

@godronus godronus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

What

The proxy-wasm runner's header host functions now return the same statuses as the
FastEdge CDN edge, and leave the headers alone when the edge would reject the call.

Measured on preprod with a probe filter that records the raw status of every header
host call for map types 0–8, in all four CDN hooks (repeated runs, two edge nodes,
consistent with the engine source).

Map types

Map Reads Writes
Request headers (0), response headers (2) Ok see below
http_call response headers (6) Ok Unimplemented (12)
Trailers (1, 3, 7), gRPC metadata (4, 5) Unimplemented (12) Unimplemented (12)
Unknown (e.g. 8) BadArgument (2) BadArgument (2)

Before this change, trailer maps aliased the header maps (set-all on "request
trailers" wiped the request headers), and gRPC and unknown map types fell through to
the request headers. The Rust SDK panics on status 12, so a filter that uses
trailers now fails locally the way it does on the edge.

Header writes by hook

Hook Request-header writes Response-header writes
onRequestHeaders accepted accepted
onResponseHeaders replace → NotFound (1); add, remove, set-all → BadArgument (2) accepted
onRequestBody, onResponseBody all → NotFound (1) all → NotFound (1)

A rejected write leaves the headers unchanged. Reads are unchanged.

Not copied

Two edge behaviours look like engine bugs and have been reported upstream, so the
runner does not copy them:

  • after a rejected write, reads on the edge return the value that was written;
  • in the body hooks, reading a missing response header returns BadArgument instead of
    NotFound, so Rust SDK getters panic.

Breaking

Tests that relied on trailer aliasing, on writing http_call response headers, or on
header writes the edge rejects will see different results. None of these work on the
edge.

Changes

  • server/runner/HostFunctions.ts: unsupportedMapStatus() guards every header host
    call (map type and current hook); trailer aliasing removed.
  • server/runner/types.ts: ProxyStatus.Unimplemented = 12.
  • server/__tests__/unit/runner/HostFunctions.test.ts: table tests per map type and
    per hook; the http-call write test now checks the headers are read-only.
  • context/: CHANGELOG entry, trailer notes in HTTP_CALL_IMPLEMENTATION.md,
    PROJECT_OVERVIEW.md, IMPLEMENTATION_GUIDE.md.

Testing

  • pnpm test passes (unit 497, integration 342 / 38 / 137 / 81).
  • The same probe binary run through the runner gives the edge's write status for
    every call above; read-backs differ only where the two behaviours above are not
    copied.

Copilot AI balanced review requested due to automatic review settings November 4, 2026 09:56

This comment was marked as resolved.

Measured on preprod with a probe that records the raw status of every header
host call for map types 0-8 in all four CDN hooks.

- Trailer (1, 3, 7) and gRPC (4, 5) maps return Unimplemented (12) for every
  header call. They no longer alias the header maps.
- http_call response headers are read-only (writes return 12).
- Unknown map types return BadArgument (2).
- onResponseHeaders: request-header replace returns NotFound (1); add, remove
  and set-all return BadArgument (2).
- onRequestBody/onResponseBody: every header write returns NotFound (1).
- A rejected write leaves the headers unchanged; reads are unchanged.
@godronus
godronus force-pushed the fix/unsupported-header-maps branch from ed5cd78 to 26c8cb5 Compare November 5, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the header-map status and per-hook write-permission changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@godronus
godronus merged commit 81ae651 into main Nov 5, 2026
8 checks passed
@godronus
godronus deleted the fix/unsupported-header-maps branch November 5, 2026 11:24
@godronus

godronus commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 0.2.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants