authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 01:20:46-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 01:20:46-07:00
log68aa7aa8305e9dfc0d98543f607d88bd37fb66e2
treec45cc4a6d29db93ee481e7e1cefa230fd018b606
parent86f079964b9c3d2a087907d2ef8273c3dbcb960b
signature Signed by PGP key B5690EEEBB952194

refactor(server): keep telemetry identity errors private (#10032)


2 files changed, 2 insertions(+), 22 deletions(-)

apps/server/src/telemetry/Identify.test.ts-20
...@@ -33,26 +33,6 @@ const findIdentityLog = (...@@ -33,26 +33,6 @@ const findIdentityLog = (
33 errorTag: string,33 errorTag: string,
34) => logs.find((log) => log.annotations.source === source && log.annotations.errorTag === errorTag);34) => logs.find((log) => log.annotations.source === source && log.annotations.errorTag === errorTag);
3535
36it("preserves exact telemetry identity causes without deriving messages from them", () => {
37 const decodeCause = new Error("private nested decode details");
38 const decodeError = new Identify.TelemetryIdentityDecodeError({
39 source: "codex",
40 filePath: "/tmp/auth.json",
41 cause: decodeCause,
42 });
43 const readCause = new Error("private nested read details");
44 const readError = new Identify.TelemetryIdentityReadError({
45 source: "anonymous",
46 filePath: "/tmp/anonymous-id",
47 cause: readCause,
48 });
49
50 assert.strictEqual(decodeError.cause, decodeCause);
51 assert.strictEqual(readError.cause, readCause);
52 assert.notInclude(decodeError.message, decodeCause.message);
53 assert.notInclude(readError.message, readCause.message);
54});
55
56it.layer(NodeServices.layer)("telemetry identity", (it) => {36it.layer(NodeServices.layer)("telemetry identity", (it) => {
57 it.effect("uses the persisted anonymous id when provider identities are absent", () =>37 it.effect("uses the persisted anonymous id when provider identities are absent", () =>
58 Effect.gen(function* () {38 Effect.gen(function* () {
apps/server/src/telemetry/Identify.ts+2-2
...@@ -23,7 +23,7 @@ const ClaudeJsonSchema = Schema.Struct({...@@ -23,7 +23,7 @@ const ClaudeJsonSchema = Schema.Struct({
23export const TelemetryIdentitySource = Schema.Literals(["codex", "claude", "anonymous"]);23export const TelemetryIdentitySource = Schema.Literals(["codex", "claude", "anonymous"]);
24export type TelemetryIdentitySource = typeof TelemetryIdentitySource.Type;24export type TelemetryIdentitySource = typeof TelemetryIdentitySource.Type;
2525
26export class TelemetryIdentityReadError extends Schema.TaggedErrorClass<TelemetryIdentityReadError>()(26class TelemetryIdentityReadError extends Schema.TaggedErrorClass<TelemetryIdentityReadError>()(
27 "TelemetryIdentityReadError",27 "TelemetryIdentityReadError",
28 {28 {
29 source: TelemetryIdentitySource,29 source: TelemetryIdentitySource,
...@@ -36,7 +36,7 @@ export class TelemetryIdentityReadError extends Schema.TaggedErrorClass<Telemetr...@@ -36,7 +36,7 @@ export class TelemetryIdentityReadError extends Schema.TaggedErrorClass<Telemetr
36 }36 }
37}37}
3838
39export class TelemetryIdentityDecodeError extends Schema.TaggedErrorClass<TelemetryIdentityDecodeError>()(39class TelemetryIdentityDecodeError extends Schema.TaggedErrorClass<TelemetryIdentityDecodeError>()(
40 "TelemetryIdentityDecodeError",40 "TelemetryIdentityDecodeError",
41 {41 {
42 source: Schema.Literals(["codex", "claude"]),42 source: Schema.Literals(["codex", "claude"]),