diff --git a/ts/EFFECT_NATIVE_REWRITE_AUDIT.md b/ts/EFFECT_NATIVE_REWRITE_AUDIT.md index 1b6c63e5..ccc4ced6 100644 --- a/ts/EFFECT_NATIVE_REWRITE_AUDIT.md +++ b/ts/EFFECT_NATIVE_REWRITE_AUDIT.md @@ -12,8 +12,8 @@ Verified source roots: - Effect v4 subtree: `/home/elpresidank/YeeBois/projects/beep-effect2/.repos/effect-v4` - Installed Effect beta used by this workspace: `ts/node_modules/effect` -Current signal counts from `ts/packages` after the 2026-06-02 client RPC -acquisition cause tap slice: +Current signal counts from `ts/packages` after the 2026-06-02 client socket +close Effect boundary slice: | Signal | Count | | --- | ---: | @@ -142,6 +142,10 @@ Notes: only to update connection state on runtime/client acquisition failure. `effect-rpc-client.ts` now uses `Effect.tapCause` and `Cause.pretty` before the public Promise boundary. +- The client socket close Effect boundary slice removed the Promise `.catch` + from `BaseApi.close()`. The void public facade now runs `rpc.close()` through + `Effect.tryPromise` and logs the tagged socket close error through + `Effect.catch`. - `Record` and `throwLibrarianServiceError` are now clean in `ts/packages`. @@ -1010,6 +1014,26 @@ Notes: - `cd ts && bun run test` - `git diff --check` +### 2026-06-02: Client Socket Close Effect Boundary Slice + +- Status: migrated and root-verified. +- Completed: + - `ts/packages/client/src/socket/trustgraph-socket.ts` now wraps + `rpc.close()` with `Effect.tryPromise` inside the public `close(): void` + facade. + - Close failures are mapped to the existing tagged `TrustGraphSocketError` + shape and logged through `Effect.catch` instead of a Promise `.catch`. + - The remaining client socket Promise `.catch` matches are streaming callback + compatibility bridges that route failures to legacy `onError` callbacks. +- Verification: + - `cd ts && bun run check:tsgo` + - `bun run --cwd ts/packages/client build` + - `bun run --cwd ts/packages/client test` + - `cd ts && bun run check` + - `cd ts && bun run build` + - `cd ts && bun run test` + - `git diff --check` + ## Subagent Findings To Preserve - MCP/workbench: diff --git a/ts/packages/client/src/socket/trustgraph-socket.ts b/ts/packages/client/src/socket/trustgraph-socket.ts index 2f8c4f8d..f046f0a4 100644 --- a/ts/packages/client/src/socket/trustgraph-socket.ts +++ b/ts/packages/client/src/socket/trustgraph-socket.ts @@ -504,9 +504,14 @@ export function makeBaseApi( * Closes the WebSocket connection and cleans up */ close() { - rpc.close().catch((err) => { - logClientError("[socket close error]", err); - }); + Effect.runFork( + Effect.tryPromise({ + try: () => rpc.close(), + catch: (error) => socketError("socket-close", toErrorMessage(error, "Socket close failed")), + }).pipe( + Effect.catch((error) => Effect.sync(() => logClientError("[socket close error]", error))), + ), + ); }, /**