authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-08 01:11:09-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-08 01:11:09-07:00
log0af04f1801ea75119c74fd406ced7da6c9c71721
tree3a4a30d46891c64ad9b26d0fee23e9675a346574
parent6f4cd07b900299629b9f2f9a9336f5c090556a51
signature Signed by PGP key B5690EEEBB952194

refactor(server): classify orchestration exports (#10275)


7 files changed, 9 insertions(+), 30 deletions(-)

apps/server/src/orchestration/Errors.ts-23
...@@ -126,13 +126,6 @@ export type OrchestrationEngineError =...@@ -126,13 +126,6 @@ export type OrchestrationEngineError =
126 | OrchestrationCommandJsonParseError126 | OrchestrationCommandJsonParseError
127 | OrchestrationCommandDecodeError;127 | OrchestrationCommandDecodeError;
128128
129export function toOrchestrationCommandDecodeError(error: Schema.SchemaError) {
130 return new OrchestrationCommandDecodeError({
131 issue: SchemaIssue.makeFormatterDefault()(error.issue),
132 cause: error,
133 });
134}
135
136export function toProjectorDecodeError(eventType: string) {129export function toProjectorDecodeError(eventType: string) {
137 return (error: Schema.SchemaError): OrchestrationProjectorDecodeError =>130 return (error: Schema.SchemaError): OrchestrationProjectorDecodeError =>
138 new OrchestrationProjectorDecodeError({131 new OrchestrationProjectorDecodeError({
...@@ -141,19 +134,3 @@ export function toProjectorDecodeError(eventType: string) {...@@ -141,19 +134,3 @@ export function toProjectorDecodeError(eventType: string) {
141 cause: error,134 cause: error,
142 });135 });
143}136}
144
145export function toOrchestrationJsonParseError(cause: unknown) {
146 return new OrchestrationCommandJsonParseError({
147 detail: `Failed to parse orchestration command JSON`,
148 cause,
149 });
150}
151
152export function toListenerCallbackError(listener: "read-model" | "domain-event") {
153 return (cause: unknown): OrchestrationListenerCallbackError =>
154 new OrchestrationListenerCallbackError({
155 listener,
156 detail: `Failed to invoke orchestration ${listener} listener`,
157 cause,
158 });
159}
apps/server/src/orchestration/LiveStreamBudget.ts+2-2
...@@ -6,8 +6,8 @@ import * as Exit from "effect/Exit";...@@ -6,8 +6,8 @@ import * as Exit from "effect/Exit";
6import * as Scope from "effect/Scope";6import * as Scope from "effect/Scope";
7import * as Stream from "effect/Stream";7import * as Stream from "effect/Stream";
88
9export const LIVE_STREAM_MAX_ITEMS = 1_000;9const LIVE_STREAM_MAX_ITEMS = 1_000;
10export const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024;10const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024;
1111
12export interface RetainedLiveItem<A> {12export interface RetainedLiveItem<A> {
13 readonly value: A;13 readonly value: A;
apps/server/src/orchestration/ThreadPullRequestReactor.ts+1
...@@ -77,6 +77,7 @@ export function pullRequestMatchesProject(...@@ -77,6 +77,7 @@ export function pullRequestMatchesProject(
77 );77 );
78}78}
7979
80/** @public Service construction is part of the canonical Effect module API. */
80export const make = Effect.gen(function* () {81export const make = Effect.gen(function* () {
81 const engine = yield* OrchestrationEngine.OrchestrationEngineService;82 const engine = yield* OrchestrationEngine.OrchestrationEngineService;
82 const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;83 const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
apps/server/src/orchestration/ThreadSettlementPolicy.ts+1-1
...@@ -8,7 +8,7 @@ export interface SettlementPullRequest {...@@ -8,7 +8,7 @@ export interface SettlementPullRequest {
8}8}
99
10const DAY_MS = 24 * 60 * 60 * 1_000;10const DAY_MS = 24 * 60 * 60 * 1_000;
11export const QUEUED_TURN_START_GRACE_MS = 2 * 60 * 1_000;11const QUEUED_TURN_START_GRACE_MS = 2 * 60 * 1_000;
1212
13function latestTimestamp(values: ReadonlyArray<string | null | undefined>): string | null {13function latestTimestamp(values: ReadonlyArray<string | null | undefined>): string | null {
14 let latest: string | null = null;14 let latest: string | null = null;
apps/server/src/orchestration/ThreadSettlementReactor.ts+1
...@@ -32,6 +32,7 @@ export class ThreadSettlementReactor extends Context.Service<...@@ -32,6 +32,7 @@ export class ThreadSettlementReactor extends Context.Service<
32 }32 }
33>()("t3/orchestration/ThreadSettlementReactor") {}33>()("t3/orchestration/ThreadSettlementReactor") {}
3434
35/** @public Service construction is part of the canonical Effect module API. */
35export const make = Effect.gen(function* () {36export const make = Effect.gen(function* () {
36 const engine = yield* OrchestrationEngine.OrchestrationEngineService;37 const engine = yield* OrchestrationEngine.OrchestrationEngineService;
37 const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;38 const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
apps/server/src/orchestration/commandInvariants.ts+1-1
...@@ -25,7 +25,7 @@ function findThreadById(...@@ -25,7 +25,7 @@ function findThreadById(
25 return readModel.threads.find((thread) => thread.id === threadId);25 return readModel.threads.find((thread) => thread.id === threadId);
26}26}
2727
28export function findProjectById(28function findProjectById(
29 readModel: OrchestrationReadModel,29 readModel: OrchestrationReadModel,
30 projectId: ProjectId,30 projectId: ProjectId,
31): OrchestrationProject | undefined {31): OrchestrationProject | undefined {
apps/server/src/orchestration/runtimeLayer.ts+3-3
...@@ -8,16 +8,16 @@ import { OrchestrationProjectionSnapshotQueryLive } from "./Layers/ProjectionSna...@@ -8,16 +8,16 @@ import { OrchestrationProjectionSnapshotQueryLive } from "./Layers/ProjectionSna
8import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts";8import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts";
9import * as ThreadPlanProgress from "./ThreadPlanProgress.ts";9import * as ThreadPlanProgress from "./ThreadPlanProgress.ts";
1010
11export const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll(11const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll(
12 OrchestrationEventStoreLive,12 OrchestrationEventStoreLive,
13 OrchestrationCommandReceiptRepositoryLive,13 OrchestrationCommandReceiptRepositoryLive,
14);14);
1515
16export const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe(16const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe(
17 Layer.provide(OrchestrationEventStoreLive),17 Layer.provide(OrchestrationEventStoreLive),
18);18);
1919
20export const OrchestrationInfrastructureLayerLive = Layer.mergeAll(20const OrchestrationInfrastructureLayerLive = Layer.mergeAll(
21 OrchestrationProjectionSnapshotQueryLive,21 OrchestrationProjectionSnapshotQueryLive,
22 OrchestrationEventInfrastructureLayerLive,22 OrchestrationEventInfrastructureLayerLive,
23 OrchestrationProjectionPipelineLayerLive,23 OrchestrationProjectionPipelineLayerLive,