Skip to content

Update WPT#4170

Merged
tsctx merged 2 commits intomainfrom
wpt-update
Apr 20, 2025
Merged

Update WPT#4170
tsctx merged 2 commits intomainfrom
wpt-update

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Automated update of the WPT

@github-actions github-actions Bot force-pushed the wpt-update branch 2 times, most recently from 1ce439f to 55e55b4 Compare April 18, 2025 00:19
@tsctx tsctx closed this Apr 20, 2025
@tsctx tsctx reopened this Apr 20, 2025
@metcoder95
Copy link
Copy Markdown
Member

can we merge @tsctx?

@tsctx tsctx merged commit 259d5f8 into main Apr 20, 2025
33 of 37 checks passed
@tsctx tsctx deleted the wpt-update branch April 20, 2025 08:51
This was referenced May 10, 2025
slagiewka pushed a commit to slagiewka/undici that referenced this pull request Feb 14, 2026
productdevbook added a commit to productdevbook/misina that referenced this pull request Apr 26, 2026
New optional driver under `misina/driver/undici`. Hands the entire
connection-pool / keep-alive / pipelining / HTTP/2 surface back to the
caller through any `undici.Agent` / `Pool` / `Client` they construct.
Solves the cross-region inference + RPC throughput problem the issue
flags: native fetch caps at 5 idle connections per origin, won't
negotiate H2, exposes no knobs.

```ts
import { Agent } from "undici"
import { undiciDriver } from "misina/driver/undici"

const api = createMisina({
  driver: undiciDriver({
    dispatcher: new Agent({
      connections: 100,
      keepAliveTimeout: 30_000,
      allowH2: true,
    }),
  }),
})
```

Implementation:
- `undici` is declared in `peerDependencies` with
  `peerDependenciesMeta.undici.optional: true`, so users who don't
  use this driver pay nothing. Range: `^6 || ^7 || ^8`.
- `undici` is **dynamically imported** the first time `request()`
  runs. The rest of misina keeps its static graph zero-dep.
- We re-issue the request as `fetch(url, { method, headers, body,
  signal, redirect, dispatcher })` instead of passing the `Request`
  instance directly — undici 8 stopped accepting cross-realm
  `Request` objects (nodejs/undici#4170).
  Bodies forward with `duplex: "half"` so streaming uploads work.
- `dispatcher` is typed as `any` on purpose — it's an opaque handle
  from undici, and pinning it to a specific class would force every
  consumer to align their undici major exactly. The driver doesn't
  introspect it, just forwards it.
- `fetch` override option lets tests bypass the dynamic import.

Bundle: `driver/undici.mjs` capped at 1.5KB (currently ~700B). Lives
outside the existing 6KB `driver/` budget so the figure stays
honest.

Tests in test/driver-undici.test.ts spin up a local `node:http`
fixture and verify:
- Real undici Agent routes the request, returns a structurally-
  compatible Response.
- A pool with `connections: 1` reuses sockets across three
  concurrent requests (bounded socket count).
- Headers + method survive the round-trip (uses an `/echo-headers`
  endpoint).
- The `fetch` override path is honored without touching `undici`.

`jsr.json` gets the matching `./driver/undici` export. README adds:
- A new highlight bullet.
- A "misina/driver/undici (Node-only, opt-in)" subsection under
  Drivers with the high-throughput recipe + a note that the rest
  of the package stays zero-dep.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.

3 participants