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

This commit is contained in:
Yukun Shan authored and GitHub committed 2026-08-31 10:21:36 -07:00
1 parent ad38700ac6
commit 2921050c69
2 files changed
+7 -3

No files matched your search

@@ -17,7 +17,7 @@ const layer = it.layer(
);
layer("OrchestrationEventStore", (it) => {
it.effect("stores json columns as strings and replays decoded events", () =>
it.effect("stores json columns as strings and replays CLI-origin events", () =>
Effect.gen(function* () {
const eventStore = yield* OrchestrationEventStore;
const sql = yield* SqlClient.SqlClient;
@@ -34,6 +34,9 @@ layer("OrchestrationEventStore", (it) => {
correlationId: CommandId.make("cmd-store-roundtrip"),
metadata: {
adapterKey: "codex",
origin: {
surface: "cli",
},
},
payload: {
projectId: ProjectId.make("project-roundtrip"),
@@ -66,6 +69,7 @@ layer("OrchestrationEventStore", (it) => {
assert.equal(replayed.length, 1);
assert.equal(replayed[0]?.type, "project.created");
assert.equal(replayed[0]?.metadata.adapterKey, "codex");
assert.deepEqual(replayed[0]?.metadata.origin, { surface: "cli" });
}),
);
+2 -2
View File
@@ -86,12 +86,12 @@ export const RpcClientId = NonNegativeInt.pipe(Schema.brand("RpcClientId"));
export type RpcClientId = typeof RpcClientId.Type;
/**
* Which client app a connection comes from. Unlike
* Which client surface a connection or command comes from. Unlike
* `AuthClientMetadataDeviceType` (a UA-style device class where web and
* desktop are both "desktop"), this names the actual product surface.
* Optional everywhere it appears: old clients never send it.
*/
export const ClientSurface = Schema.Literals(["web", "desktop", "mobile"]);
export const ClientSurface = Schema.Literals(["web", "desktop", "mobile", "cli"]);
export type ClientSurface = typeof ClientSurface.Type;
export const ClientOs = Schema.Literals([