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 =
126126 | OrchestrationCommandJsonParseError
127127 | OrchestrationCommandDecodeError;
128128
129export function toOrchestrationCommandDecodeError(error: Schema.SchemaError) {
130 return new OrchestrationCommandDecodeError({
131 issue: SchemaIssue.makeFormatterDefault()(error.issue),
132 cause: error,
133 });
134}
135
136129export function toProjectorDecodeError(eventType: string) {
137130 return (error: Schema.SchemaError): OrchestrationProjectorDecodeError =>
138131 new OrchestrationProjectorDecodeError({
......@@ -141,19 +134,3 @@ export function toProjectorDecodeError(eventType: string) {
141134 cause: error,
142135 });
143136}
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";
66import * as Scope from "effect/Scope";
77import * as Stream from "effect/Stream";
88
9export const LIVE_STREAM_MAX_ITEMS = 1_000;
10export const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024;
9const LIVE_STREAM_MAX_ITEMS = 1_000;
10const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024;
1111
1212export interface RetainedLiveItem<A> {
1313 readonly value: A;
apps/server/src/orchestration/ThreadPullRequestReactor.ts+1
......@@ -77,6 +77,7 @@ export function pullRequestMatchesProject(
7777 );
7878}
7979
80/** @public Service construction is part of the canonical Effect module API. */
8081export const make = Effect.gen(function* () {
8182 const engine = yield* OrchestrationEngine.OrchestrationEngineService;
8283 const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
apps/server/src/orchestration/ThreadSettlementPolicy.ts+1-1
......@@ -8,7 +8,7 @@ export interface SettlementPullRequest {
88}
99
1010const 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
1313function latestTimestamp(values: ReadonlyArray<string | null | undefined>): string | null {
1414 let latest: string | null = null;
apps/server/src/orchestration/ThreadSettlementReactor.ts+1
......@@ -32,6 +32,7 @@ export class ThreadSettlementReactor extends Context.Service<
3232 }
3333>()("t3/orchestration/ThreadSettlementReactor") {}
3434
35/** @public Service construction is part of the canonical Effect module API. */
3536export const make = Effect.gen(function* () {
3637 const engine = yield* OrchestrationEngine.OrchestrationEngineService;
3738 const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
apps/server/src/orchestration/commandInvariants.ts+1-1
......@@ -25,7 +25,7 @@ function findThreadById(
2525 return readModel.threads.find((thread) => thread.id === threadId);
2626}
2727
28export function findProjectById(
28function findProjectById(
2929 readModel: OrchestrationReadModel,
3030 projectId: ProjectId,
3131): OrchestrationProject | undefined {
apps/server/src/orchestration/runtimeLayer.ts+3-3
......@@ -8,16 +8,16 @@ import { OrchestrationProjectionSnapshotQueryLive } from "./Layers/ProjectionSna
88import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts";
99import * as ThreadPlanProgress from "./ThreadPlanProgress.ts";
1010
11export const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll(
11const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll(
1212 OrchestrationEventStoreLive,
1313 OrchestrationCommandReceiptRepositoryLive,
1414);
1515
16export const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe(
16const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe(
1717 Layer.provide(OrchestrationEventStoreLive),
1818);
1919
20export const OrchestrationInfrastructureLayerLive = Layer.mergeAll(
20const OrchestrationInfrastructureLayerLive = Layer.mergeAll(
2121 OrchestrationProjectionSnapshotQueryLive,
2222 OrchestrationEventInfrastructureLayerLive,
2323 OrchestrationProjectionPipelineLayerLive,