Unified · Split
| @@ -1145,11 +1145,6 @@ it.layer(NodeServices.layer)("server router seam", (it) => { · 1144 unmodified lines | ||
| 1145 | 1145 | }); |
| 1146 | 1146 | |
| 1147 | 1147 | const wsUrl = yield* getWsServerUrl("/ws"); |
| 1148 | − const snapshotResult = yield* Effect.scoped( | |
| 1149 | − withWsRpcClient(wsUrl, (client) => client[ORCHESTRATION_WS_METHODS.getSnapshot]({})), | |
| 1150 | − ); | |
| 1151 | − assert.equal(snapshotResult.snapshotSequence, 1); | |
| 1152 | − | |
| 1153 | 1148 | const activeSnapshotResult = yield* Effect.scoped( |
| 1154 | 1149 | withWsRpcClient(wsUrl, (client) => client[ORCHESTRATION_WS_METHODS.getActiveSnapshot]({})), |
| 1155 | 1150 | ); |
| @@ -1266,15 +1261,15 @@ it.layer(NodeServices.layer)("server router seam", (it) => { · 110 unmodified lines | ||
| 1266 | 1261 | }).pipe(Effect.provide(NodeHttpServer.layerTest)), |
| 1267 | 1262 | ); |
| 1268 | 1263 | |
| 1269 | − it.effect("routes websocket rpc orchestration.getSnapshot errors", () => | |
| 1264 | + it.effect("routes websocket rpc orchestration.getActiveSnapshot errors", () => | |
| 1270 | 1265 | Effect.gen(function* () { |
| 1271 | 1266 | yield* buildAppUnderTest({ |
| 1272 | 1267 | layers: { |
| 1273 | 1268 | projectionSnapshotQuery: { |
| 1274 | − getSnapshot: () => | |
| 1269 | + getActiveSnapshot: () => | |
| 1275 | 1270 | Effect.fail( |
| 1276 | 1271 | new PersistenceSqlError({ |
| 1277 | − operation: "ProjectionSnapshotQuery.getSnapshot", | |
| 1272 | + operation: "ProjectionSnapshotQuery.getActiveSnapshot", | |
| 1278 | 1273 | detail: "projection unavailable", |
| 1279 | 1274 | }), |
| 1280 | 1275 | ), |
| @@ -1284,14 +1279,14 @@ it.layer(NodeServices.layer)("server router seam", (it) => { · 3 unmodified lines | ||
| 1284 | 1279 | |
| 1285 | 1280 | const wsUrl = yield* getWsServerUrl("/ws"); |
| 1286 | 1281 | const result = yield* Effect.scoped( |
| 1287 | − withWsRpcClient(wsUrl, (client) => client[ORCHESTRATION_WS_METHODS.getSnapshot]({})).pipe( | |
| 1288 | − Effect.result, | |
| 1289 | − ), | |
| 1282 | + withWsRpcClient(wsUrl, (client) => | |
| 1283 | + client[ORCHESTRATION_WS_METHODS.getActiveSnapshot]({}), | |
| 1284 | + ).pipe(Effect.result), | |
| 1290 | 1285 | ); |
| 1291 | 1286 | |
| 1292 | 1287 | assertTrue(result._tag === "Failure"); |
| 1293 | − assertTrue(result.failure._tag === "OrchestrationGetSnapshotError"); | |
| 1294 | − assertInclude(result.failure.message, "Failed to load orchestration snapshot"); | |
| 1288 | + assertTrue(result.failure._tag === "OrchestrationGetActiveSnapshotError"); | |
| 1289 | + assertInclude(result.failure.message, "Failed to load active orchestration snapshot"); | |
| 1295 | 1290 | }).pipe(Effect.provide(NodeHttpServer.layerTest)), |
| 1296 | 1291 | ); |
| 1297 | 1292 | |
| @@ -7,7 +7,6 @@ import { · 6 unmodified lines | ||
| 7 | 7 | OrchestrationGetActiveSnapshotError, |
| 8 | 8 | OrchestrationGetFullThreadDiffError, |
| 9 | 9 | OrchestrationListArchivedThreadsError, |
| 10 | − OrchestrationGetSnapshotError, | |
| 11 | 10 | OrchestrationGetTurnDiffError, |
| 12 | 11 | ORCHESTRATION_WS_METHODS, |
| 13 | 12 | ProjectSearchEntriesError, |
| @@ -74,16 +73,6 @@ const WsRpcLayer = WsRpcGroup.toLayer( · 60 unmodified lines | ||
| 74 | 73 | }); |
| 75 | 74 | |
| 76 | 75 | return WsRpcGroup.of({ |
| 77 | − [ORCHESTRATION_WS_METHODS.getSnapshot]: (_input) => | |
| 78 | − projectionSnapshotQuery.getSnapshot().pipe( | |
| 79 | − Effect.mapError( | |
| 80 | − (cause) => | |
| 81 | − new OrchestrationGetSnapshotError({ | |
| 82 | − message: "Failed to load orchestration snapshot", | |
| 83 | − cause, | |
| 84 | − }), | |
| 85 | − ), | |
| 86 | − ), | |
| 87 | 76 | [ORCHESTRATION_WS_METHODS.getActiveSnapshot]: (_input) => |
| 88 | 77 | projectionSnapshotQuery.getActiveSnapshot().pipe( |
| 89 | 78 | Effect.mapError( |
| @@ -622,10 +622,7 @@ function resolveWsRpc(body: NormalizedWsRpcRequestBody): unknown { · 621 unmodified lines | ||
| 622 | 622 | return customResult; |
| 623 | 623 | } |
| 624 | 624 | const tag = body._tag; |
| 625 | − if ( | |
| 626 | − tag === ORCHESTRATION_WS_METHODS.getSnapshot || | |
| 627 | − tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot | |
| 628 | − ) { | |
| 625 | + if (tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot) { | |
| 629 | 626 | return fixture.snapshot; |
| 630 | 627 | } |
| 631 | 628 | if (tag === WS_METHODS.serverGetConfig) { |
| @@ -147,10 +147,7 @@ function buildFixture(): TestFixture { · 146 unmodified lines | ||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | function resolveWsRpc(tag: string): unknown { |
| 150 | − if ( | |
| 151 | − tag === ORCHESTRATION_WS_METHODS.getSnapshot || | |
| 152 | − tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot | |
| 153 | − ) { | |
| 150 | + if (tag === ORCHESTRATION_WS_METHODS.getActiveSnapshot) { | |
| 154 | 151 | return fixture.snapshot; |
| 155 | 152 | } |
| 156 | 153 | if (tag === WS_METHODS.serverGetConfig) { |
| @@ -75,7 +75,6 @@ const rpcClientMock = { · 74 unmodified lines | ||
| 75 | 75 | subscribeLifecycle: vi.fn(), |
| 76 | 76 | }, |
| 77 | 77 | orchestration: { |
| 78 | − getSnapshot: vi.fn(), | |
| 79 | 78 | getActiveSnapshot: vi.fn(), |
| 80 | 79 | listArchivedThreads: vi.fn(), |
| 81 | 80 | dispatchCommand: vi.fn(), |
| @@ -90,7 +90,6 @@ export function createWsNativeApi(): NativeApi { · 89 unmodified lines | ||
| 90 | 90 | updateSettings: rpcClient.server.updateSettings, |
| 91 | 91 | }, |
| 92 | 92 | orchestration: { |
| 93 | − getSnapshot: rpcClient.orchestration.getSnapshot, | |
| 94 | 93 | getActiveSnapshot: rpcClient.orchestration.getActiveSnapshot, |
| 95 | 94 | listArchivedThreads: rpcClient.orchestration.listArchivedThreads, |
| 96 | 95 | dispatchCommand: rpcClient.orchestration.dispatchCommand, |
| @@ -86,7 +86,6 @@ export interface WsRpcClient { · 85 unmodified lines | ||
| 86 | 86 | readonly subscribeLifecycle: RpcStreamMethod<typeof WS_METHODS.subscribeServerLifecycle>; |
| 87 | 87 | }; |
| 88 | 88 | readonly orchestration: { |
| 89 | − readonly getSnapshot: RpcUnaryNoArgMethod<typeof ORCHESTRATION_WS_METHODS.getSnapshot>; | |
| 90 | 89 | readonly getActiveSnapshot: RpcUnaryNoArgMethod< |
| 91 | 90 | typeof ORCHESTRATION_WS_METHODS.getActiveSnapshot |
| 92 | 91 | >; |
| @@ -191,8 +190,6 @@ export function createWsRpcClient(transport = new WsTransport()): WsRpcClient { · 98 unmodified lines | ||
| 191 | 190 | transport.subscribe((client) => client[WS_METHODS.subscribeServerLifecycle]({}), listener), |
| 192 | 191 | }, |
| 193 | 192 | orchestration: { |
| 194 | − getSnapshot: () => | |
| 195 | − transport.request((client) => client[ORCHESTRATION_WS_METHODS.getSnapshot]({})), | |
| 196 | 193 | getActiveSnapshot: () => |
| 197 | 194 | transport.request((client) => client[ORCHESTRATION_WS_METHODS.getActiveSnapshot]({})), |
| 198 | 195 | dispatchCommand: (input) => |
| @@ -174,7 +174,6 @@ export interface NativeApi { · 173 unmodified lines | ||
| 174 | 174 | updateSettings: (patch: ServerSettingsPatch) => Promise<ServerSettings>; |
| 175 | 175 | }; |
| 176 | 176 | orchestration: { |
| 177 | − getSnapshot: () => Promise<OrchestrationReadModel>; | |
| 178 | 177 | getActiveSnapshot: () => Promise<OrchestrationReadModel>; |
| 179 | 178 | listArchivedThreads: () => Promise<OrchestrationListArchivedThreadsResult>; |
| 180 | 179 | dispatchCommand: (command: ClientOrchestrationCommand) => Promise<{ sequence: number }>; |
| @@ -16,7 +16,6 @@ import { · 15 unmodified lines | ||
| 16 | 16 | } from "./baseSchemas"; |
| 17 | 17 | |
| 18 | 18 | export const ORCHESTRATION_WS_METHODS = { |
| 19 | − getSnapshot: "orchestration.getSnapshot", | |
| 20 | 19 | getActiveSnapshot: "orchestration.getActiveSnapshot", |
| 21 | 20 | dispatchCommand: "orchestration.dispatchCommand", |
| 22 | 21 | getTurnDiff: "orchestration.getTurnDiff", |
| @@ -982,11 +981,6 @@ export const DispatchResult = Schema.Struct({ · 959 unmodified lines | ||
| 982 | 981 | }); |
| 983 | 982 | export type DispatchResult = typeof DispatchResult.Type; |
| 984 | 983 | |
| 985 | −export const OrchestrationGetSnapshotInput = Schema.Struct({}); | |
| 986 | −export type OrchestrationGetSnapshotInput = typeof OrchestrationGetSnapshotInput.Type; | |
| 987 | −const OrchestrationGetSnapshotResult = OrchestrationReadModel; | |
| 988 | −export type OrchestrationGetSnapshotResult = typeof OrchestrationGetSnapshotResult.Type; | |
| 989 | − | |
| 990 | 984 | export const OrchestrationGetActiveSnapshotInput = Schema.Struct({}); |
| 991 | 985 | export type OrchestrationGetActiveSnapshotInput = typeof OrchestrationGetActiveSnapshotInput.Type; |
| 992 | 986 | const OrchestrationGetActiveSnapshotResult = OrchestrationReadModel; |
| @@ -1039,10 +1033,6 @@ const OrchestrationReplayEventsResult = Schema.Array(OrchestrationEvent); · 46 unmodified lines | ||
| 1039 | 1033 | export type OrchestrationReplayEventsResult = typeof OrchestrationReplayEventsResult.Type; |
| 1040 | 1034 | |
| 1041 | 1035 | export const OrchestrationRpcSchemas = { |
| 1042 | − getSnapshot: { | |
| 1043 | − input: OrchestrationGetSnapshotInput, | |
| 1044 | − output: OrchestrationGetSnapshotResult, | |
| 1045 | − }, | |
| 1046 | 1036 | getActiveSnapshot: { |
| 1047 | 1037 | input: OrchestrationGetActiveSnapshotInput, |
| 1048 | 1038 | output: OrchestrationGetActiveSnapshotResult, |
| @@ -1069,14 +1059,6 @@ export const OrchestrationRpcSchemas = { · 20 unmodified lines | ||
| 1069 | 1059 | }, |
| 1070 | 1060 | } as const; |
| 1071 | 1061 | |
| 1072 | −export class OrchestrationGetSnapshotError extends Schema.TaggedErrorClass<OrchestrationGetSnapshotError>()( | |
| 1073 | − "OrchestrationGetSnapshotError", | |
| 1074 | − { | |
| 1075 | − message: TrimmedNonEmptyString, | |
| 1076 | − cause: Schema.optional(Schema.Defect), | |
| 1077 | − }, | |
| 1078 | −) {} | |
| 1079 | − | |
| 1080 | 1062 | export class OrchestrationGetActiveSnapshotError extends Schema.TaggedErrorClass<OrchestrationGetActiveSnapshotError>()( |
| 1081 | 1063 | "OrchestrationGetActiveSnapshotError", |
| 1082 | 1064 | { |
| @@ -35,8 +35,6 @@ import { · 34 unmodified lines | ||
| 35 | 35 | OrchestrationGetActiveSnapshotInput, |
| 36 | 36 | OrchestrationGetFullThreadDiffError, |
| 37 | 37 | OrchestrationGetFullThreadDiffInput, |
| 38 | − OrchestrationGetSnapshotError, | |
| 39 | − OrchestrationGetSnapshotInput, | |
| 40 | 38 | OrchestrationGetTurnDiffError, |
| 41 | 39 | OrchestrationGetTurnDiffInput, |
| 42 | 40 | OrchestrationListArchivedThreadsError, |
| @@ -261,12 +259,6 @@ export const WsTerminalCloseRpc = Rpc.make(WS_METHODS.terminalClose, { · 218 unmodified lines | ||
| 261 | 259 | error: TerminalError, |
| 262 | 260 | }); |
| 263 | 261 | |
| 264 | −export const WsOrchestrationGetSnapshotRpc = Rpc.make(ORCHESTRATION_WS_METHODS.getSnapshot, { | |
| 265 | − payload: OrchestrationGetSnapshotInput, | |
| 266 | − success: OrchestrationRpcSchemas.getSnapshot.output, | |
| 267 | − error: OrchestrationGetSnapshotError, | |
| 268 | −}); | |
| 269 | − | |
| 270 | 262 | export const WsOrchestrationGetActiveSnapshotRpc = Rpc.make( |
| 271 | 263 | ORCHESTRATION_WS_METHODS.getActiveSnapshot, |
| 272 | 264 | { |
| @@ -369,15 +361,14 @@ export const WsRpcGroup = RpcGroup.make( · 96 unmodified lines | ||
| 369 | 361 | WsTerminalClearRpc, |
| 370 | 362 | WsTerminalRestartRpc, |
| 371 | 363 | WsTerminalCloseRpc, |
| 372 | − WsSubscribeOrchestrationDomainEventsRpc, | |
| 373 | − WsSubscribeTerminalEventsRpc, | |
| 374 | − WsSubscribeServerConfigRpc, | |
| 375 | − WsSubscribeServerLifecycleRpc, | |
| 376 | − WsOrchestrationGetSnapshotRpc, | |
| 377 | 364 | WsOrchestrationGetActiveSnapshotRpc, |
| 378 | 365 | WsOrchestrationDispatchCommandRpc, |
| 379 | 366 | WsOrchestrationGetTurnDiffRpc, |
| 380 | 367 | WsOrchestrationGetFullThreadDiffRpc, |
| 381 | 368 | WsOrchestrationListArchivedThreadsRpc, |
| 382 | 369 | WsOrchestrationReplayEventsRpc, |
| 370 | + WsSubscribeOrchestrationDomainEventsRpc, | |
| 371 | + WsSubscribeTerminalEventsRpc, | |
| 372 | + WsSubscribeServerConfigRpc, | |
| 373 | + WsSubscribeServerLifecycleRpc, | |
| 383 | 374 | ); |