[codex] Bound relay registration replay diagnostics (#3420)
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
3ecf3685ba
commit
4d790f0064
2 files changed
+20
-6
No files matched your search
@@ -7,6 +7,7 @@ import * as NodeCryptoLayer from "@effect/platform-node/NodeCrypto";
|
||||
import { describe, expect, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Logger from "effect/Logger";
|
||||
import * as Redacted from "effect/Redacted";
|
||||
import { FetchHttpClient } from "effect/unstable/http";
|
||||
|
||||
@@ -232,6 +233,11 @@ describe("MobileRegistrations", () => {
|
||||
});
|
||||
|
||||
it.effect("keeps device registration successful when activity replay fails", () => {
|
||||
const messages: unknown[] = [];
|
||||
const logger = Logger.make(({ message }) => {
|
||||
messages.push(message);
|
||||
});
|
||||
|
||||
return Effect.gen(function* () {
|
||||
const result = yield* Effect.gen(function* () {
|
||||
const registrations = yield* MobileRegistrations.MobileRegistrations;
|
||||
@@ -250,7 +256,7 @@ describe("MobileRegistrations", () => {
|
||||
Effect.fail(
|
||||
new AgentActivityRows.AgentActivityRowListPersistenceError({
|
||||
userId: "dev:julius",
|
||||
cause: "replay failed",
|
||||
cause: "sensitive device replay detail",
|
||||
}),
|
||||
),
|
||||
}),
|
||||
@@ -262,7 +268,11 @@ describe("MobileRegistrations", () => {
|
||||
);
|
||||
|
||||
expect(result).toEqual({ ok: true });
|
||||
});
|
||||
expect(messages).toContainEqual([
|
||||
"device registration activity replay failed",
|
||||
{ errorTag: "AgentActivityRowListPersistenceError" },
|
||||
]);
|
||||
}).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false })));
|
||||
});
|
||||
|
||||
it.effect("unregisters the current user's device", () => {
|
||||
|
||||
@@ -51,8 +51,10 @@ export const make = Effect.gen(function* () {
|
||||
deviceId: input.payload.deviceId,
|
||||
})
|
||||
.pipe(
|
||||
Effect.tapError((cause) =>
|
||||
Effect.logWarning("device registration activity replay failed", { cause }),
|
||||
Effect.tapError((error) =>
|
||||
Effect.logWarning("device registration activity replay failed", {
|
||||
errorTag: error._tag,
|
||||
}),
|
||||
),
|
||||
Effect.ignore,
|
||||
);
|
||||
@@ -70,8 +72,10 @@ export const make = Effect.gen(function* () {
|
||||
deviceId: input.payload.deviceId,
|
||||
})
|
||||
.pipe(
|
||||
Effect.tapError((cause) =>
|
||||
Effect.logWarning("live activity registration replay failed", { cause }),
|
||||
Effect.tapError((error) =>
|
||||
Effect.logWarning("live activity registration replay failed", {
|
||||
errorTag: error._tag,
|
||||
}),
|
||||
),
|
||||
Effect.ignore,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user