fix(telemetry): review findings

- wau/mau trailing scans run hourly and on day finalization, not every tick
- exclusion lookup failures cached 30s so an st outage cannot amplify
- unverified relation filter dropped; player emptiness checked in js
- anonymous unauthenticated read failures no longer logged
- alerts and exclusions ensure supertokens init on cold pods
This commit is contained in:
2026-08-25 23:26:34 -07:00
parent 31f6237446
commit 1ddcffc511
8 changed files with 93 additions and 15 deletions
+36
View File
@@ -308,6 +308,42 @@ describe("serverFnLoggingMiddleware control flow and dedup", () => {
expect(h.createActivity.mock.calls[0][0].error).toContain("FORBIDDEN");
});
it("does not record anonymous Unauthenticated failures", async () => {
setRequest("http://localhost:3000/_serverFn/x");
await expect(
runMiddleware({
next: async () => {
throw new Error("Unauthenticated");
},
data: undefined,
context: {},
serverFnMeta: { id: "x", name: "fetchMe" },
})
).rejects.toThrow("Unauthenticated");
await flushWrites();
expect(h.createActivity).not.toHaveBeenCalled();
});
it("still records Unauthenticated failures for identified actors", async () => {
setRequest("http://localhost:3000/_serverFn/x");
setRequestActor(h.request as unknown as Request, { playerId: "p1" });
await expect(
runMiddleware({
next: async () => {
throw new Error("Unauthenticated");
},
data: undefined,
context: {},
serverFnMeta: { id: "x", name: "fetchMe" },
})
).rejects.toThrow("Unauthenticated");
await vi.waitFor(() => expect(h.createActivity).toHaveBeenCalledTimes(1));
});
it("does not record activity for excluded players", async () => {
setRequest("http://localhost:3000/_serverFn/doThing");
setRequestActor(h.request as unknown as Request, { playerId: "excluded-player" });