Deferred execution and interruption
Adapter design. This page specifies the unpublished adapter. Run a request with Octokit and Effect.
The shared constructor accepts a function from an AbortSignal to a fresh promise. Constructing, mapping or providing an operation performs zero network I/O. Each independent run calls the thunk once per execution attempt. Effect interrupts the fiber. Octokit sends the HTTP request. Merge fiber, caller and applicable default request signals without mutating options or replacing custom fetch, headers or hooks. Release any listeners the adapter installs, including on early failure.
| Situation | Required outcome |
|---|---|
| Caller signal already aborted | Return caller cancellation before starting a fetch. Preserve fiber interruption as a distinct outcome. |
| Fiber interrupted while fetch is pending | Request transport observes abort; fiber exit remains interrupted even if fetch rejects with an HTTP-looking error. |
| Caller cancels a shared client request | Only that operation stops. Concurrent calls keep their own signals. |
| Result or failure races cancellation | Settle once, release listeners once, ignore a late settlement safely. |
| SDK method hides inner I/O or user plugin ignores signals | Stop the waiting fiber; describe which background work can still finish. Do not promise remote cancellation or rollback. |
| A response body is still streaming | Request completion and body consumption have different lifetimes; scope a reader opened by the adapter and close it on interruption. |
Treat synchronous exceptions from documented fallible SDK calls explicitly. Keep exceptions from caller defects distinguishable from recoverable GitHub failures. An endpoint’s synchronous metadata is not a promise. Keep effect construction separate from evaluating side-effecting getters and optional App modules. Effect construction · Measured behavior