Skip to content

feat(wpt-wintertc): run fetch tests against a real wptserve, refine expectations, stabilize the ratchet#4

Open
Alan Wisper (wisper-dev) wants to merge 4 commits into
mainfrom
feat/wpt-wintertc-server
Open

feat(wpt-wintertc): run fetch tests against a real wptserve, refine expectations, stabilize the ratchet#4
Alan Wisper (wisper-dev) wants to merge 4 commits into
mainfrom
feat/wpt-wintertc-server

Conversation

@wisper-dev

Copy link
Copy Markdown
Member

Summary

Makes the WinterTC WPT fetch/ suite actually execute by running upstream Python wptserve as a
loopback HTTP sidecar (the way Deno and workerd run fetch conformance), refines the expectations so
the pass rate reflects what is structurally achievable in this cut, and makes the committed ratchet
stable against the fetch suite's run-to-run flakiness.

What changed

Server sidecar -- harness/src/adapters/wpt-server.ts

  • Starts wpt serve on loopback HTTP for the fetch/ group only; encoding/url run serverless.
  • Reads the bound port from wptserve's log instead of pre-allocating one -- removes the
    bind-then-hope-it's-free (TOCTOU) race.
  • Explicit loopback bind (bind_address + browser_host), confirmed 127.0.0.1-only.
  • Teardown: SIGINT for a clean child-listener reap, SIGKILL + pkill-by-config-path fallback, temp
    config-dir cleanup.

Adapter -- harness/src/adapters/wpt-wintertc.ts

  • Gates the server on fetch/ paths; a server-start failure is attributed explicitly (each fetch
    task errors loudly rather than silently collapsing the fetch metric).
  • Normalizes the ephemeral server port out of test ids, so tests whose subtest names embed the URL
    (e.g. mode-same-origin) stay ratchetable across runs.

Setup -- bin/setup.ts

  • Patches the vendored wpt serve to run offline (system Python, no venv), guards commands.json
    parsing, makes the paths edit idempotent, and verifies the patch under setup --check.

Expectations -- expectations/wpt-wintertc.toml + ratchet

  • Skips structurally-unreachable tests: .https / .h2 (HTTP-only cut: no WPT-CA trust, no
    HTTP/2) and the browser-only .window.js files with zero headless passes.
  • Keeps the .window.js files that DO pass headless, so their passing subtests count (previously
    masked by a blanket skip).
  • Regenerates the ratchet as a union across runs (threads 1 and 4): a flaky pass reads as a
    new-pass, never a spurious regression.

Tests -- cover the server lifecycle, port parsing, the fetch/ gate, and the server-failure path.

Conformance

wpt-wintertc: 88.2% pass (threads 4) / 88.0% (threads 1), 0 regressions against the committed
ratchet, both single- and multi-threaded.

Notes

  • Pairs with the runtime-side branch (encoding_rs TextDecoder, URL setters, data:-URL
    XMLHttpRequest, relative-fetch() base resolution).
  • Two harness unit tests fail independently of this change: the cpython suite is not checked out
    locally, and the javac-jtreg registry test asserts jtregCaseTimeoutSeconds = 300 while
    registry.toml is now 900.

The fetch/api tests resolve relative URLs against the document location and
fetch WPT resources and stateful handlers; with no server they die in setup
("Failed to parse URL"). Deno and workerd both run upstream Python wptserve as
a sidecar — this mirrors that.

- setup.ts: add tools/ to the WPT sparse checkout and patch it to run
  `wpt serve` without a virtualenv (system Python + WPT's vendored deps).
- wpt-server.ts: start wptserve on a free 127.0.0.1 port, wait until it serves,
  stop it via SIGINT so its multiprocessing child servers are reaped, not
  orphaned.
- adapter: start the server only when fetch tasks are in scope, hand its origin
  to the runner, stop it when the run ends; a start failure does not sink the
  serverless encoding/url tests.
- wintertc-runner.js: root the document location and get-host-info at the
  server so relative fetches reach real resources.

Scope: HTTP, same-origin only. Cross-origin subdomains and .https/.h2 tests
still fail — they need the web-platform.test subdomain aliases and a client
that trusts WPT's CA — but now produce a real fetch-conformance signal instead
of a setup crash.
.window.js tests need a document / window / navigation the Elide runtime has
no equivalent for, and fetch-later needs window / iframe / bfcache — they are
structurally unreachable, not regressions. Skipping them (74 of 313 files)
keeps the pass rate over reachable tests.

encodeInto.any.js is deliberately not skipped: its ArrayBuffer branch passes
and skip is file-level, so skipping would drop the passing subtests; only its
SharedArrayBuffer branch (needs WebAssembly.Memory) stays a known failure.
wpt-server:
- read the bound HTTP port from wptserve stdout (removes the pre-allocation
  race), bind loopback explicitly, reap child listeners on stop, and clean up
  the temp config dir

wpt-wintertc:
- normalize the ephemeral server port out of test ids so they stay ratchetable
- gate the server on fetch/ paths and attribute a server-start failure
  explicitly instead of collapsing fetch metrics silently

setup:
- guard commands.json parsing, verify the offline serve patch, and make the
  paths edit idempotent

expectations:
- skip the structurally-unreachable .https / .h2 tests, list the browser-only
  window.js files precisely (keeping those that pass headless), and correct the
  encodeInto note
- regenerate the ratchet (union across runs) to prune now-skipped entries

tests:
- cover the server lifecycle, port parsing, and the server-failure gate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant