From 4b155dbec80ce03ec6a3bfd48fa0b75f9cf9dee9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 1 Apr 2026 15:17:31 -0700 Subject: [PATCH] Remove dead orchestration snapshot RPC Co-authored-by: codex --- apps/server/src/server.test.ts | 21 +++++++------------ apps/server/src/ws.ts | 11 ---------- apps/web/src/components/ChatView.browser.tsx | 5 +---- .../components/KeybindingsToast.browser.tsx | 5 +---- apps/web/src/wsNativeApi.test.ts | 1 - apps/web/src/wsNativeApi.ts | 1 - apps/web/src/wsRpcClient.ts | 3 --- packages/contracts/src/ipc.ts | 1 - packages/contracts/src/orchestration.ts | 18 ---------------- packages/contracts/src/rpc.ts | 17 ++++----------- 10 files changed, 14 insertions(+), 69 deletions(-) diff --git a/apps/server/src/server.test.ts b/apps/server/src/server.test.ts index 3fff95af02..c0afb383c7 100644 --- a/apps/server/src/server.test.ts +++ b/apps/server/src/server.test.ts @@ -1145,11 +1145,6 @@ it.layer(NodeServices.layer)("server router seam", (it) => { }); const wsUrl = yield* getWsServerUrl("/ws"); - const snapshotResult = yield* Effect.scoped( - withWsRpcClient(wsUrl, (client) => client[ORCHESTRATION_WS_METHODS.getSnapshot]({})), - ); - assert.equal(snapshotResult.snapshotSequence, 1); - const activeSnapshotResult = yield* Effect.scoped( withWsRpcClient(wsUrl, (client) => client[ORCHESTRATION_WS_METHODS.getActiveSnapshot]({})), ); @@ -1266,15 +1261,15 @@ it.layer(NodeServices.layer)("server router seam", (it) => { }).pipe(Effect.provide(NodeHttpServer.layerTest)), ); - it.effect("routes websocket rpc orchestration.getSnapshot errors", () => + it.effect("routes websocket rpc orchestration.getActiveSnapshot errors", () => Effect.gen(function* () { yield* buildAppUnderTest({ layers: { projectionSnapshotQuery: { - getSnapshot: () => + getActiveSnapshot: () => Effect.fail( new PersistenceSqlError({ - operation: "ProjectionSnapshotQuery.getSnapshot", + operation: "ProjectionSnapshotQuery.getActiveSnapshot", detail: "projection unavailable", }), ), @@ -1284,14 +1279,14 @@ it.layer(NodeServices.layer)("server router seam", (it) => { const wsUrl = yield* getWsServerUrl("/ws"); const result = yield* Effect.scoped( - withWsRpcClient(wsUrl, (client) => client[ORCHESTRATION_WS_METHODS.getSnapshot]({})).pipe( - Effect.result, - ), + withWsRpcClient(wsUrl, (client) => + client[ORCHESTRATION_WS_METHODS.getActiveSnapshot]({}), + ).pipe(Effect.result), ); assertTrue(result._tag === "Failure"); - assertTrue(result.failure._tag === "OrchestrationGetSnapshotError"); - assertInclude(result.failure.message, "Failed to load orchestration snapshot"); + assertTrue(result.failure._tag === "OrchestrationGetActiveSnapshotError"); + assertInclude(result.failure.message, "Failed to load active orchestration snapshot"); }).pipe(Effect.provide(NodeHttpServer.layerTest)), ); diff --git a/apps/server/src/ws.ts b/apps/server/src/ws.ts index 5695c0b624..a488d7dcfc 100644 --- a/apps/server/src/ws.ts +++ b/apps/server/src/ws.ts @@ -7,7 +7,6 @@ import { OrchestrationGetActiveSnapshotError, OrchestrationGetFullThreadDiffError, OrchestrationListArchivedThreadsError, - OrchestrationGetSnapshotError, OrchestrationGetTurnDiffError, ORCHESTRATION_WS_METHODS, ProjectSearchEntriesError, @@ -74,16 +73,6 @@ const WsRpcLayer = WsRpcGroup.toLayer( }); return WsRpcGroup.of({ - [ORCHESTRATION_WS_METHODS.getSnapshot]: (_input) => - projectionSnapshotQuery.getSnapshot().pipe( - Effect.mapError( - (cause) => - new OrchestrationGetSnapshotError({ - message: "Failed to load orchestration snapshot", - cause, - }), - ), - ), [ORCHESTRATION_WS_METHODS.getActiveSnapshot]: (_input) => projectionSnapshotQuery.getActiveSnapshot().pipe( Effect.mapError( diff --git a/apps/web/src/components/ChatView.browser.tsx b/apps/web/src/components/ChatView.browser.tsx index e30327f642..aebf7b8d87 100644 --- a/apps/web/src/components/ChatView.browser.tsx +++ b/apps/web/src/components/ChatView.browser.tsx @@ -622,10 +622,7 @@ function resolveWsRpc(body: NormalizedWsRpcRequestBody): unknown { return customResult; } const tag = body._tag; - if ( - tag === ORCHESTRATION_WS_METHODS.getSnapshot || - tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot - ) { + if (tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot) { return fixture.snapshot; } if (tag === WS_METHODS.serverGetConfig) { diff --git a/apps/web/src/components/KeybindingsToast.browser.tsx b/apps/web/src/components/KeybindingsToast.browser.tsx index ab76aa31cd..2bb6c1ef3c 100644 --- a/apps/web/src/components/KeybindingsToast.browser.tsx +++ b/apps/web/src/components/KeybindingsToast.browser.tsx @@ -147,10 +147,7 @@ function buildFixture(): TestFixture { } function resolveWsRpc(tag: string): unknown { - if ( - tag === ORCHESTRATION_WS_METHODS.getSnapshot || - tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot - ) { + if (tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot) { return fixture.snapshot; } if (tag === WS_METHODS.serverGetConfig) { diff --git a/apps/web/src/wsNativeApi.test.ts b/apps/web/src/wsNativeApi.test.ts index b4cfde03f5..a5a0d84f4a 100644 --- a/apps/web/src/wsNativeApi.test.ts +++ b/apps/web/src/wsNativeApi.test.ts @@ -75,7 +75,6 @@ const rpcClientMock = { subscribeLifecycle: vi.fn(), }, orchestration: { - getSnapshot: vi.fn(), getActiveSnapshot: vi.fn(), listArchivedThreads: vi.fn(), dispatchCommand: vi.fn(), diff --git a/apps/web/src/wsNativeApi.ts b/apps/web/src/wsNativeApi.ts index 99558a02f6..e9220b68d3 100644 --- a/apps/web/src/wsNativeApi.ts +++ b/apps/web/src/wsNativeApi.ts @@ -90,7 +90,6 @@ export function createWsNativeApi(): NativeApi { updateSettings: rpcClient.server.updateSettings, }, orchestration: { - getSnapshot: rpcClient.orchestration.getSnapshot, getActiveSnapshot: rpcClient.orchestration.getActiveSnapshot, listArchivedThreads: rpcClient.orchestration.listArchivedThreads, dispatchCommand: rpcClient.orchestration.dispatchCommand, diff --git a/apps/web/src/wsRpcClient.ts b/apps/web/src/wsRpcClient.ts index c02d4447bf..4509cbf666 100644 --- a/apps/web/src/wsRpcClient.ts +++ b/apps/web/src/wsRpcClient.ts @@ -86,7 +86,6 @@ export interface WsRpcClient { readonly subscribeLifecycle: RpcStreamMethod; }; readonly orchestration: { - readonly getSnapshot: RpcUnaryNoArgMethod; readonly getActiveSnapshot: RpcUnaryNoArgMethod< typeof ORCHESTRATION_WS_METHODS.getActiveSnapshot >; @@ -191,8 +190,6 @@ export function createWsRpcClient(transport = new WsTransport()): WsRpcClient { transport.subscribe((client) => client[WS_METHODS.subscribeServerLifecycle]({}), listener), }, orchestration: { - getSnapshot: () => - transport.request((client) => client[ORCHESTRATION_WS_METHODS.getSnapshot]({})), getActiveSnapshot: () => transport.request((client) => client[ORCHESTRATION_WS_METHODS.getActiveSnapshot]({})), dispatchCommand: (input) => diff --git a/packages/contracts/src/ipc.ts b/packages/contracts/src/ipc.ts index 3724ebed43..944070a41f 100644 --- a/packages/contracts/src/ipc.ts +++ b/packages/contracts/src/ipc.ts @@ -174,7 +174,6 @@ export interface NativeApi { updateSettings: (patch: ServerSettingsPatch) => Promise; }; orchestration: { - getSnapshot: () => Promise; getActiveSnapshot: () => Promise; listArchivedThreads: () => Promise; dispatchCommand: (command: ClientOrchestrationCommand) => Promise<{ sequence: number }>; diff --git a/packages/contracts/src/orchestration.ts b/packages/contracts/src/orchestration.ts index ea58cb0efe..60926e4c33 100644 --- a/packages/contracts/src/orchestration.ts +++ b/packages/contracts/src/orchestration.ts @@ -16,7 +16,6 @@ import { } from "./baseSchemas"; export const ORCHESTRATION_WS_METHODS = { - getSnapshot: "orchestration.getSnapshot", getActiveSnapshot: "orchestration.getActiveSnapshot", dispatchCommand: "orchestration.dispatchCommand", getTurnDiff: "orchestration.getTurnDiff", @@ -982,11 +981,6 @@ export const DispatchResult = Schema.Struct({ }); export type DispatchResult = typeof DispatchResult.Type; -export const OrchestrationGetSnapshotInput = Schema.Struct({}); -export type OrchestrationGetSnapshotInput = typeof OrchestrationGetSnapshotInput.Type; -const OrchestrationGetSnapshotResult = OrchestrationReadModel; -export type OrchestrationGetSnapshotResult = typeof OrchestrationGetSnapshotResult.Type; - export const OrchestrationGetActiveSnapshotInput = Schema.Struct({}); export type OrchestrationGetActiveSnapshotInput = typeof OrchestrationGetActiveSnapshotInput.Type; const OrchestrationGetActiveSnapshotResult = OrchestrationReadModel; @@ -1039,10 +1033,6 @@ const OrchestrationReplayEventsResult = Schema.Array(OrchestrationEvent); export type OrchestrationReplayEventsResult = typeof OrchestrationReplayEventsResult.Type; export const OrchestrationRpcSchemas = { - getSnapshot: { - input: OrchestrationGetSnapshotInput, - output: OrchestrationGetSnapshotResult, - }, getActiveSnapshot: { input: OrchestrationGetActiveSnapshotInput, output: OrchestrationGetActiveSnapshotResult, @@ -1069,14 +1059,6 @@ export const OrchestrationRpcSchemas = { }, } as const; -export class OrchestrationGetSnapshotError extends Schema.TaggedErrorClass()( - "OrchestrationGetSnapshotError", - { - message: TrimmedNonEmptyString, - cause: Schema.optional(Schema.Defect), - }, -) {} - export class OrchestrationGetActiveSnapshotError extends Schema.TaggedErrorClass()( "OrchestrationGetActiveSnapshotError", { diff --git a/packages/contracts/src/rpc.ts b/packages/contracts/src/rpc.ts index 2fc8fb3375..3d25984c1f 100644 --- a/packages/contracts/src/rpc.ts +++ b/packages/contracts/src/rpc.ts @@ -35,8 +35,6 @@ import { OrchestrationGetActiveSnapshotInput, OrchestrationGetFullThreadDiffError, OrchestrationGetFullThreadDiffInput, - OrchestrationGetSnapshotError, - OrchestrationGetSnapshotInput, OrchestrationGetTurnDiffError, OrchestrationGetTurnDiffInput, OrchestrationListArchivedThreadsError, @@ -261,12 +259,6 @@ export const WsTerminalCloseRpc = Rpc.make(WS_METHODS.terminalClose, { error: TerminalError, }); -export const WsOrchestrationGetSnapshotRpc = Rpc.make(ORCHESTRATION_WS_METHODS.getSnapshot, { - payload: OrchestrationGetSnapshotInput, - success: OrchestrationRpcSchemas.getSnapshot.output, - error: OrchestrationGetSnapshotError, -}); - export const WsOrchestrationGetActiveSnapshotRpc = Rpc.make( ORCHESTRATION_WS_METHODS.getActiveSnapshot, { @@ -369,15 +361,14 @@ export const WsRpcGroup = RpcGroup.make( WsTerminalClearRpc, WsTerminalRestartRpc, WsTerminalCloseRpc, - WsSubscribeOrchestrationDomainEventsRpc, - WsSubscribeTerminalEventsRpc, - WsSubscribeServerConfigRpc, - WsSubscribeServerLifecycleRpc, - WsOrchestrationGetSnapshotRpc, WsOrchestrationGetActiveSnapshotRpc, WsOrchestrationDispatchCommandRpc, WsOrchestrationGetTurnDiffRpc, WsOrchestrationGetFullThreadDiffRpc, WsOrchestrationListArchivedThreadsRpc, WsOrchestrationReplayEventsRpc, + WsSubscribeOrchestrationDomainEventsRpc, + WsSubscribeTerminalEventsRpc, + WsSubscribeServerConfigRpc, + WsSubscribeServerLifecycleRpc, );