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