authorgravatar for 92423096+nateEc@users.noreply.github.comYukun Shan <92423096+nateEc@users.noreply.github.com> 2026-09-01 01:21:36+08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-31 10:21:36-07:00
log2921050c698fb195e2f5590b7cfab8fdfe0ec729
tree5bc35e34d3a43b6706feaa0a422be1f7bee74569
parentad38700ac678b8c8a0310d434a44d94a7ee6a47f
signature Signed by PGP key B5690EEEBB952194

fix(contracts): accept CLI event origins (#8905)


2 files changed, 7 insertions(+), 3 deletions(-)

apps/server/src/persistence/Layers/OrchestrationEventStore.test.ts+5-1
......@@ -17,7 +17,7 @@ const layer = it.layer(
1717);
1818
1919layer("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+2-2
......@@ -86,12 +86,12 @@ export const RpcClientId = NonNegativeInt.pipe(Schema.brand("RpcClientId"));
8686export 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 */
94export const ClientSurface = Schema.Literals(["web", "desktop", "mobile"]);
94export const ClientSurface = Schema.Literals(["web", "desktop", "mobile", "cli"]);
9595export type ClientSurface = typeof ClientSurface.Type;
9696
9797export const ClientOs = Schema.Literals([