History

replace ad-hoc union for contract type

Julius Marminge committed 8 months ago

Commit fdcb05d1 parent 21216826 files · +20 −13Browse files

Unified · Split

6 files
  1. apps/server/integration/OrchestrationEngineHarness.integration.ts +2 −1
  2. apps/server/integration/TestProviderAdapter.integration.ts +6 −5
  3. apps/server/integration/orchestrationEngine.integration.test.ts +2 −1
  4. apps/server/src/orchestration/Layers/CheckpointReactor.test.ts +3 −3
  5. apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts +6 −2
  6. apps/server/src/provider/Layers/ProviderService.test.ts +1 −1
apps/server/integration/OrchestrationEngineHarness.integration.ts+2−1
@@ -6,6 +6,7 @@ import { execFileSync } from "node:child_process"; · 5 unmodified lines
66 import * as NodeServices from "@effect/platform-node/NodeServices";
77 import {
88 ApprovalRequestId,
9+ ProviderKind,
910 type OrchestrationEvent,
1011 type OrchestrationThread,
1112 } from "@t3tools/contracts";
@@ -205,7 +206,7 @@ export interface OrchestrationIntegrationHarness { · 193 unmodified lines
205206 }
206207
207208 interface MakeOrchestrationIntegrationHarnessOptions {
208− readonly provider?: "codex" | "claudeCode";
209+ readonly provider?: ProviderKind;
209210 readonly realCodex?: boolean;
210211 }
211212
apps/server/integration/TestProviderAdapter.integration.ts+6−5
@@ -10,6 +10,7 @@ import { · 9 unmodified lines
1010 ProviderTurnStartResult,
1111 ThreadId,
1212 TurnId,
13+ ProviderKind,
1314 } from "@t3tools/contracts";
1415 import { Effect, Queue, Stream } from "effect";
1516
@@ -35,7 +36,7 @@ export interface TestTurnResponse { · 19 unmodified lines
3536 export type FixtureProviderRuntimeEvent = {
3637 readonly type: string;
3738 readonly eventId: EventId;
38− readonly provider: "codex" | "claudeCode";
39+ readonly provider: ProviderKind;
3940 readonly createdAt: string;
4041 readonly threadId: string;
4142 readonly turnId?: string | undefined;
@@ -177,7 +178,7 @@ function normalizeFixtureEvent(rawEvent: Record<string, unknown>): ProviderRunti · 135 unmodified lines
177178
178179 export interface TestProviderAdapterHarness {
179180 readonly adapter: ProviderAdapterShape<ProviderAdapterError>;
180− readonly provider: "codex" | "claudeCode";
181+ readonly provider: ProviderKind;
181182 readonly queueTurnResponse: (
182183 threadId: ThreadId,
183184 response: TestTurnResponse,
@@ -197,7 +198,7 @@ export interface TestProviderAdapterHarness { · 13 unmodified lines
197198 }
198199
199200 interface MakeTestProviderAdapterHarnessOptions {
200− readonly provider?: "codex" | "claudeCode";
201+ readonly provider?: ProviderKind;
201202 }
202203
203204 function nowIso(): string {
@@ -205,7 +206,7 @@ function nowIso(): string { · 1 unmodified line
205206 }
206207
207208 function sessionNotFound(
208− provider: "codex" | "claudeCode",
209+ provider: ProviderKind,
209210 threadId: ThreadId,
210211 ): ProviderAdapterSessionNotFoundError {
211212 return new ProviderAdapterSessionNotFoundError({
@@ -215,7 +216,7 @@ function sessionNotFound( · 3 unmodified lines
215216 }
216217
217218 function missingSessionEffect(
218− provider: "codex" | "claudeCode",
219+ provider: ProviderKind,
219220 threadId: ThreadId,
220221 ): Effect.Effect<never, ProviderAdapterError> {
221222 return Effect.fail(sessionNotFound(provider, threadId));
apps/server/integration/orchestrationEngine.integration.test.ts+2−1
@@ -8,6 +8,7 @@ import { · 7 unmodified lines
88 EventId,
99 MessageId,
1010 ProjectId,
11+ ProviderKind,
1112 ThreadId,
1213 } from "@t3tools/contracts";
1314 import { assert, it } from "@effect/vitest";
@@ -36,7 +37,7 @@ const PROJECT_ID = asProjectId("project-1"); · 22 unmodified lines
3637 const THREAD_ID = ThreadId.makeUnsafe("thread-1");
3738 const FIXTURE_TURN_ID = "fixture-turn";
3839 const APPROVAL_REQUEST_ID = asApprovalRequestId("req-approval-1");
39−type IntegrationProvider = "codex" | "claudeCode";
40+type IntegrationProvider = ProviderKind;
4041
4142 function nowIso() {
4243 return new Date().toISOString();
apps/server/src/orchestration/Layers/CheckpointReactor.test.ts+3−3
@@ -3,7 +3,7 @@ import os from "node:os"; · 2 unmodified lines
33 import path from "node:path";
44 import { execFileSync } from "node:child_process";
55
6−import type { ProviderRuntimeEvent, ProviderSession } from "@t3tools/contracts";
6+import type { ProviderKind, ProviderRuntimeEvent, ProviderSession } from "@t3tools/contracts";
77 import {
88 CommandId,
99 DEFAULT_PROVIDER_INTERACTION_MODE,
@@ -44,7 +44,7 @@ const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value); · 34 unmodified lines
4444 type LegacyProviderRuntimeEvent = {
4545 readonly type: string;
4646 readonly eventId: EventId;
47− readonly provider: "codex" | "claudeCode";
47+ readonly provider: ProviderKind;
4848 readonly createdAt: string;
4949 readonly threadId: ThreadId;
5050 readonly turnId?: string | undefined;
@@ -235,7 +235,7 @@ describe("CheckpointReactor", () => { · 184 unmodified lines
235235 readonly projectWorkspaceRoot?: string;
236236 readonly threadWorktreePath?: string | null;
237237 readonly providerSessionCwd?: string;
238− readonly providerName?: "codex" | "claudeCode";
238+ readonly providerName?: ProviderKind;
239239 }) {
240240 const cwd = createGitRepository();
241241 tempDirs.push(cwd);
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts+6−2
@@ -2,7 +2,11 @@ import fs from "node:fs"; · 1 unmodified line
22 import os from "node:os";
33 import path from "node:path";
44
5−import type { OrchestrationReadModel, ProviderRuntimeEvent } from "@t3tools/contracts";
5+import type {
6+ OrchestrationReadModel,
7+ ProviderKind,
8+ ProviderRuntimeEvent,
9+} from "@t3tools/contracts";
610 import {
711 ApprovalRequestId,
812 CommandId,
@@ -45,7 +49,7 @@ const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value); · 36 unmodified lines
4549 type LegacyProviderRuntimeEvent = {
4650 readonly type: string;
4751 readonly eventId: EventId;
48− readonly provider: "codex" | "claudeCode";
52+ readonly provider: ProviderKind;
4953 readonly createdAt: string;
5054 readonly threadId: ThreadId;
5155 readonly turnId?: string | undefined;
apps/server/src/provider/Layers/ProviderService.test.ts+1−1
@@ -52,7 +52,7 @@ const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value); · 51 unmodified lines
5252 type LegacyProviderRuntimeEvent = {
5353 readonly type: string;
5454 readonly eventId: EventId;
55− readonly provider: "codex" | "claudeCode";
55+ readonly provider: ProviderKind;
5656 readonly createdAt: string;
5757 readonly threadId: ThreadId;
5858 readonly turnId?: string | undefined;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t