ReviewOS

home-lang/home

Native fetch: port maxRedirects validation and redirect counting

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

Scope

The unchanged strict full-VM js/web/fetch/fetch.test.ts fixture exposes two remaining fetch option gaps:

  • maxRedirects: 2 resolves a /hop/0 -> /hop/4 chain instead of rejecting after the configured limit.
  • Negative maxRedirects values resolve instead of throwing during option validation.

Pinned Bun passes both contracts. Home currently reports 346 pass / 4 fail / 7,423 assertions for the complete 350-test file; these are two of the four failures.

Completion boundary

  • Port the production FetchOptions parsing/validation and native HTTP redirect budget semantics.
  • Preserve the unchanged upstream fixture, redirect workload, assertions, and deadlines.
  • Verify with HOME_NATIVE_VM=1 and HOME_CORPUS_FULL_VM=1; adapter-mode output is not completion evidence.
  • Add focused native coverage for zero, negative, exact-limit, and over-limit redirect chains.

Tracked from #66. No skip, assertion rewrite, deadline extension, or harness substitution is acceptable.

9 days ago

Implemented and pushed in cefad9226.

Home now ports the pinned Bun Rust-side maxRedirects contract through Zig fetch option extraction, FetchTasklet, AsyncHTTP, and HTTPClient:

  • only numeric, finite, non-negative integers are accepted;
  • values above 126 are clamped to 126;
  • the HTTP client stores limit + 1 so the configured number of redirects is followed and the next hop rejects.

Strict full-VM fetch.test.ts is 350/350 with 7,427 assertions in Debug and ReleaseFast. Direct Debug/ReleaseFast edge probes also reject Infinity, -Infinity, NaN, negatives, fractions, and strings while accepting zero and large finite integers. Undici is 10/10. No fixture, assertion, deadline, or redirect workload changed.

Sign in to comment on this issue.