| ... | @@ -12,7 +12,7 @@ import { | ... | @@ -12,7 +12,7 @@ import { |
| 12 | OrchestrationProposedPlanId, | 12 | OrchestrationProposedPlanId, |
| 13 | OrchestrationReadModel, | 13 | OrchestrationReadModel, |
| 14 | OrchestrationThreadSearchSource, | 14 | OrchestrationThreadSearchSource, |
| 15 | OrchestrationShellSnapshot, | 15 | type OrchestrationShellSnapshot, |
| 16 | OrchestrationThread, | 16 | OrchestrationThread, |
| 17 | OrchestrationThreadDetailSnapshot, | 17 | OrchestrationThreadDetailSnapshot, |
| 18 | ProjectScript, | 18 | ProjectScript, |
| ... | @@ -82,7 +82,6 @@ import { | ... | @@ -82,7 +82,6 @@ import { |
| 82 | } from "../Services/ProjectionSnapshotQuery.ts"; | 82 | } from "../Services/ProjectionSnapshotQuery.ts"; |
| 83 | | 83 | |
| 84 | const decodeReadModel = Schema.decodeUnknownEffect(OrchestrationReadModel); | 84 | const decodeReadModel = Schema.decodeUnknownEffect(OrchestrationReadModel); |
| 85 | const decodeShellSnapshot = Schema.decodeUnknownEffect(OrchestrationShellSnapshot); | | |
| 86 | const decodeThread = Schema.decodeUnknownEffect(OrchestrationThread); | 85 | const decodeThread = Schema.decodeUnknownEffect(OrchestrationThread); |
| 87 | const decodeImportedTranscriptsPayload = Schema.decodeUnknownOption( | 86 | const decodeImportedTranscriptsPayload = Schema.decodeUnknownOption( |
| 88 | Schema.fromJsonString( | 87 | Schema.fromJsonString( |
| ... | @@ -2746,7 +2745,10 @@ pending_approval_requests AS ( | ... | @@ -2746,7 +2745,10 @@ pending_approval_requests AS ( |
| 2746 | ); | 2745 | ); |
| 2747 | const pullRequestsByThread = groupPullRequestRowsByThread(pullRequestRows); | 2746 | const pullRequestsByThread = groupPullRequestRowsByThread(pullRequestRows); |
| 2748 | | 2747 | |
| 2749 | const snapshot = { | 2748 | // Built from schema-decoded rows, so no second decode here. The HTTP |
| | 2749 | // and RPC layers encode it against OrchestrationShellSnapshot on the |
| | 2750 | // way out, like the per-item shells from getThreadShellById. |
| | 2751 | return { |
| 2750 | snapshotSequence: computeSnapshotSequence(stateRows), | 2752 | snapshotSequence: computeSnapshotSequence(stateRows), |
| 2751 | projects: Arr.filterMap(projectRows, (row) => | 2753 | projects: Arr.filterMap(projectRows, (row) => |
| 2752 | row.deletedAt === null | 2754 | row.deletedAt === null |
| ... | @@ -2800,15 +2802,7 @@ pending_approval_requests AS ( | ... | @@ -2800,15 +2802,7 @@ pending_approval_requests AS ( |
| 2800 | : Result.failVoid, | 2802 | : Result.failVoid, |
| 2801 | ), | 2803 | ), |
| 2802 | updatedAt: updatedAt ?? "1970-01-01T00:00:00.000Z", | 2804 | updatedAt: updatedAt ?? "1970-01-01T00:00:00.000Z", |
| 2803 | }; | 2805 | } satisfies OrchestrationShellSnapshot; |
| 2804 | | | |
| 2805 | return yield* decodeShellSnapshot(snapshot).pipe( | | |
| 2806 | Effect.mapError( | | |
| 2807 | toPersistenceDecodeError( | | |
| 2808 | "ProjectionSnapshotQuery.getShellSnapshot:decodeShellSnapshot", | | |
| 2809 | ), | | |
| 2810 | ), | | |
| 2811 | ); | | |
| 2812 | }), | 2806 | }), |
| 2813 | ), | 2807 | ), |
| 2814 | Effect.mapError((error) => { | 2808 | Effect.mapError((error) => { |
| ... | @@ -2941,7 +2935,7 @@ pending_approval_requests AS ( | ... | @@ -2941,7 +2935,7 @@ pending_approval_requests AS ( |
| 2941 | sessionRows.map((row) => [row.threadId, mapSessionRow(row)] as const), | 2935 | sessionRows.map((row) => [row.threadId, mapSessionRow(row)] as const), |
| 2942 | ); | 2936 | ); |
| 2943 | | 2937 | |
| 2944 | const snapshot = { | 2938 | return { |
| 2945 | snapshotSequence: computeSnapshotSequence(stateRows), | 2939 | snapshotSequence: computeSnapshotSequence(stateRows), |
| 2946 | projects: Arr.filterMap(projectRows, (row) => | 2940 | projects: Arr.filterMap(projectRows, (row) => |
| 2947 | row.deletedAt === null && activeProjectIds.has(row.projectId) | 2941 | row.deletedAt === null && activeProjectIds.has(row.projectId) |
| ... | @@ -2991,15 +2985,7 @@ pending_approval_requests AS ( | ... | @@ -2991,15 +2985,7 @@ pending_approval_requests AS ( |
| 2991 | planProgress: threadPlanProgress.getThreadPlanProgress(row.threadId), | 2985 | planProgress: threadPlanProgress.getThreadPlanProgress(row.threadId), |
| 2992 | })), | 2986 | })), |
| 2993 | updatedAt: updatedAt ?? "1970-01-01T00:00:00.000Z", | 2987 | updatedAt: updatedAt ?? "1970-01-01T00:00:00.000Z", |
| 2994 | }; | 2988 | } satisfies OrchestrationShellSnapshot; |
| 2995 | | | |
| 2996 | return yield* decodeShellSnapshot(snapshot).pipe( | | |
| 2997 | Effect.mapError( | | |
| 2998 | toPersistenceDecodeError( | | |
| 2999 | "ProjectionSnapshotQuery.getArchivedShellSnapshot:decodeShellSnapshot", | | |
| 3000 | ), | | |
| 3001 | ), | | |
| 3002 | ); | | |
| 3003 | }), | 2989 | }), |
| 3004 | ), | 2990 | ), |
| 3005 | Effect.mapError((error) => { | 2991 | Effect.mapError((error) => { |