Skip to content

Commit 4b476dd

Browse files
committed
fix(contracts): accept CLI event origins
Accept cli as a persisted client origin surface so historical orchestration events decode on startup. Cover replay of a CLI-origin event through the SQLite event store. Verify with the focused event-store tests and contracts typecheck.
1 parent 9b2d043 commit 4b476dd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎apps/server/src/persistence/Layers/OrchestrationEventStore.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const layer = it.layer(
1717
);
1818

1919
layer("OrchestrationEventStore", (it) => {
20-
it.effect("stores json columns as strings and replays decoded events", () =>
20+
it.effect("stores json columns as strings and replays CLI-origin events", () =>
2121
Effect.gen(function* () {
2222
const eventStore = yield* OrchestrationEventStore;
2323
const sql = yield* SqlClient.SqlClient;
@@ -34,6 +34,9 @@ layer("OrchestrationEventStore", (it) => {
3434
correlationId: CommandId.make("cmd-store-roundtrip"),
3535
metadata: {
3636
adapterKey: "codex",
37+
origin: {
38+
surface: "cli",
39+
},
3740
},
3841
payload: {
3942
projectId: ProjectId.make("project-roundtrip"),
@@ -66,6 +69,7 @@ layer("OrchestrationEventStore", (it) => {
6669
assert.equal(replayed.length, 1);
6770
assert.equal(replayed[0]?.type, "project.created");
6871
assert.equal(replayed[0]?.metadata.adapterKey, "codex");
72+
assert.deepEqual(replayed[0]?.metadata.origin, { surface: "cli" });
6973
}),
7074
);
7175

‎packages/contracts/src/baseSchemas.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ export const RpcClientId = NonNegativeInt.pipe(Schema.brand("RpcClientId"));
8686
export type RpcClientId = typeof RpcClientId.Type;
8787

8888
/**
89-
* Which client app a connection comes from. Unlike
89+
* Which client surface a connection or command comes from. Unlike
9090
* `AuthClientMetadataDeviceType` (a UA-style device class where web and
9191
* desktop are both "desktop"), this names the actual product surface.
9292
* Optional everywhere it appears: old clients never send it.
9393
*/
94-
export const ClientSurface = Schema.Literals(["web", "desktop", "mobile"]);
94+
export const ClientSurface = Schema.Literals(["web", "desktop", "mobile", "cli"]);
9595
export type ClientSurface = typeof ClientSurface.Type;
9696

9797
export const ClientOs = Schema.Literals([

0 commit comments

Comments
 (0)