Skip to content

Effect callbacks in a foreign runtime

Adapter design. This page specifies the unpublished adapter. Run a request with Octokit and Effect.

Capture the registering fiber’s required services when the callback is installed. When Octokit invokes a handler, run its Effect using those services in the subscription’s scope. Return an awaitable to SDK callbacks that wait for completion. Preserve input, result, failure, aggregate behavior and ordering. Synchronous decision callbacks must stay synchronous unless upstream explicitly awaits them. Avoid wrapping a synchronous pagination mapper or throttle decision in a promise by accident.

Subscription acquisition records the exact bridged callback. Release removes that function, closes the queue if present, settles or interrupts the fibers started by that subscription according to the documented contract and rejects new work. Handle scope close racing registration, repeated removal and in-flight handlers. Release must not detach another consumer. For emitters without public removal, create an instance for that subscription or a single long-lived dispatch registration that releases downstream subscribers. Never promise to remove an upstream listener that remains installed.

An optional webhook Stream needs bounded capacity and explicit behavior on overflow. Delivery completion for an awaited handler differs from enqueueing an event for later processing. Keep these APIs distinct. Test two independently scoped consumers, registering services A and B, verify completion before acknowledgment and simulate a handler failure during scope shutdown.