Remove dead orchestration snapshot RPC
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
3b01bbe18f
commit
4b155dbec8
10 files changed
+14
-69
No files matched your search
@@ -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)),
|
||||
);
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -75,7 +75,6 @@ const rpcClientMock = {
|
||||
subscribeLifecycle: vi.fn(),
|
||||
},
|
||||
orchestration: {
|
||||
getSnapshot: vi.fn(),
|
||||
getActiveSnapshot: vi.fn(),
|
||||
listArchivedThreads: vi.fn(),
|
||||
dispatchCommand: vi.fn(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -86,7 +86,6 @@ export interface WsRpcClient {
|
||||
readonly subscribeLifecycle: RpcStreamMethod<typeof WS_METHODS.subscribeServerLifecycle>;
|
||||
};
|
||||
readonly orchestration: {
|
||||
readonly getSnapshot: RpcUnaryNoArgMethod<typeof ORCHESTRATION_WS_METHODS.getSnapshot>;
|
||||
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) =>
|
||||
|
||||
@@ -174,7 +174,6 @@ export interface NativeApi {
|
||||
updateSettings: (patch: ServerSettingsPatch) => Promise<ServerSettings>;
|
||||
};
|
||||
orchestration: {
|
||||
getSnapshot: () => Promise<OrchestrationReadModel>;
|
||||
getActiveSnapshot: () => Promise<OrchestrationReadModel>;
|
||||
listArchivedThreads: () => Promise<OrchestrationListArchivedThreadsResult>;
|
||||
dispatchCommand: (command: ClientOrchestrationCommand) => Promise<{ sequence: number }>;
|
||||
|
||||
@@ -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>()(
|
||||
"OrchestrationGetSnapshotError",
|
||||
{
|
||||
message: TrimmedNonEmptyString,
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
},
|
||||
) {}
|
||||
|
||||
export class OrchestrationGetActiveSnapshotError extends Schema.TaggedErrorClass<OrchestrationGetActiveSnapshotError>()(
|
||||
"OrchestrationGetActiveSnapshotError",
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
Reference in new issue
Block a user