DashboardopencodemakeRuntime InstanceState ownership

makeRuntime InstanceState ownership

Category: preference
Confidence: 1.00
ID: 01a0ab03-ec58-7eaf-8664-f35a9199dab9
Project ID: c0425955-02bc-4c17-9af2-b114c00077e7
Cross-project: No
Recalled in other projects: 0
Source session: 1WhcGbpUVESyGRsty
Created: 2026-09-16 16:19:16
Updated: 2026-09-16 16:19:16

Content

Always build services with makeRuntime from src/effect/run-service.ts and own per-directory/project state through InstanceState. Chose scoped InstanceState.make, Effect.addFinalizer/acquireRelease, and forkScoped over module globals or detached promises because reload and directory cleanup must own every resource; non-blocking init() forks InstanceState.get(state) at the call site.

Move to: