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 fd4b099
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .macroscope/check-run-agents/effect-service-conventions.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,18 @@ Review changed TypeScript for the conventions below. They apply when a pull requ
44
44
- Use plain `make` and `layer` in a module named for its implementation (`BunPtyAdapter.ts`). Keep implementation-specific names when one abstract port module holds several implementations (`makeCloudflaredRelayClient`, `layerCloudflared` in `RelayClient.ts`). `infra/relay/src/db.ts` may keep its inline `Layer.succeed(RelayDb, db)`.
45
45
- When a service moves, delete the old files and update every consumer, including orchestration, MCP, tests, and integration harnesses. Do not leave compatibility re-export shims.
46
46
47
+
## Effect functions and tracing
48
+
49
+
- Reusable functions use named `Effect.fn("Service.operation")`, not functions wrapping
50
+
`Effect.gen`. Inline programs, callbacks, and layer construction can keep `Effect.gen`.
51
+
- Named `Effect.fn` creates a span; the unnamed form does not. Default to named spans for service
52
+
operations and I/O. `Effect.fnUntraced` is deliberate for per-chunk/per-event work, tight loops,
53
+
or helpers duplicating an existing tracing boundary; require a nearby reason for new uses.
54
+
- Preserve existing span names/options and avoid adding duplicate spans. Pass combinators after
55
+
the generator body; transforms receive the original function arguments after the effect.
56
+
- Preserve generic signatures, laziness, resource scope, and interruption behavior. An explicit
57
+
generator return type is `Effect.fn.Return<A, E, R>`.
58
+
47
59
## Dependency acquisition and runtime boundaries
48
60
49
61
- Production service construction acquires its Effect dependencies from the environment with `yield* Foo.Foo`, and `make`/`layer` types expose those requirements. Flag a factory that takes `Foo["Service"]` (or an object of Effect-returning methods) as a parameter when that value is a service dependency. Passing service instances explicitly in tests is fine; passing pure configuration, immutable domain values, or deliberate callback strategies is not service injection.
Copy file name to clipboardExpand all lines: AGENTS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,12 @@ Architecture and its constraints: `docs/internals/overview.md`. Glossary: `docs/
153
153
- Client mutations use `createEnvironmentRpcCommand`. Add protected methods to `CLIENT_GUARDED_RPC_SCOPES` in contracts and use the command's `permissionAtom` for UI availability. Grants are checked at execution against the destination environment; the server remains authoritative. Keep raw RPC clients inside `rpc/`, and extend the permission behavior tests when adding a protected method.
154
154
- Server features are services; transports stay thin. A `ws.ts` RPC handler, HTTP route, or MCP tool decodes input, calls one service method, and maps errors. See [Effect services](docs/internals/effect-services.md).
155
155
-`apps/web/src/components/ui` exports own their look. Pick a `variant` or `size`; do not restyle one with `className`. If none fits and the look is a generic concept, add a variant to the component; a look that belongs to one feature stays in that feature's own component, not in `components/ui`. Layout classes (width, flex, margin, position) belong on the parent. `shadcn/no-restyle` fails lint on violations. See [Web UI](docs/internals/web-ui.md).
156
+
- Reusable Effect functions use `Effect.fn("Service.operation")` with a stable span name, not a
157
+
function wrapping `Effect.gen`. Keep `Effect.gen` for inline programs and layer construction.
158
+
Use `Effect.fnUntraced` only when spans would be too frequent (stream chunks, per-event
159
+
projection, tight loops) or duplicate an existing tracing boundary; explain that choice nearby.
160
+
Named `Effect.fn` creates a span; the unnamed form does not. Preserve existing span names and
161
+
options, and pass combinators as additional function-builder arguments.
156
162
- Inferred types over annotations. `any` is the enemy.
157
163
- Comments say why: a constraint, an external quirk, or an invariant the code can't show. Don't restate names or signatures, narrate steps, or record history. `t3code/no-low-value-comments` catches the mechanical cases.
158
164
- Our users drive agents all day and notice a dropped frame, a lying spinner, and a stale label. No continuously repainting animations; they peg the GPU on high-refresh displays.
0 commit comments