You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 63cdca3
Browse filesBrowse the repository at this point in the historyBrowse files
description: Route HTTP through Effect boundaries instead of raw fetch. Use when lint flags executor/no-raw-fetch or when adding networked protocol/provider code.
4
+
allowed-tools: Read Grep Glob Bash
5
+
---
6
+
7
+
HTTP in core SDK and protocol plugins should go through Effect services so tests
8
+
can replace real networks with local protocol fixtures or mock `HttpClient`
9
+
layers.
10
+
11
+
## Fix Shape
12
+
13
+
- Prefer `effect/unstable/http``HttpClient` and `HttpClientRequest` for
14
+
ordinary HTTP calls.
15
+
- Accept a `Layer.Layer<HttpClient.HttpClient>` option on plugin/provider code
16
+
when callers need to inject a test client.
17
+
- In tests, use real local servers plus `FetchHttpClient.layer` or a captured
18
+
`HttpClient` service from the test layer.
19
+
- Do not add fetch-shaped abstractions in SDK or plugin seams. If a third-party
20
+
library truly only accepts `fetch`, keep the adapter in the owning package,
21
+
name the forced boundary explicitly, and delegate internally to Effect
22
+
`HttpClient`.
23
+
- Do not type new protocol/plugin seams as `typeof globalThis.fetch`; keep the
24
+
ambient runtime boundary out of domain and test APIs.
25
+
- Do not patch `globalThis.fetch`. Replace those tests with a local server,
26
+
`HttpClient` layer, or the approved Effect-backed adapter.
27
+
- Do not add a broad allowlist entry unless the file is a platform entrypoint
28
+
or a temporary migration target.
29
+
30
+
## Approved Boundaries
31
+
32
+
- Worker/handler objects whose public API must expose a `fetch` method.
33
+
- Test calls to a worker or Miniflare binding's `.fetch(...)` method.
34
+
- Small adapters for libraries that only accept `fetch`, if the implementation
35
+
delegates to Effect `HttpClient`.
36
+
- Browser UI event handlers may remain raw only until app-side boundaries are
37
+
classified; prefer SDK/client APIs where available.
0 commit comments