hydrate alert evidence from clickhouse

This commit is contained in:
dirtydishes 2026-05-17 11:02:30 -04:00
parent cd0a1dd9e5
commit c0b5b6dbeb
10 changed files with 701 additions and 62 deletions

View file

@ -0,0 +1,18 @@
import { describe, expect, it } from "bun:test";
import { isAlertContextPath, parseAlertContextTraceIdPath } from "../src/alert-context";
describe("alert context route helpers", () => {
it("extracts a valid alert trace id from the context endpoint path", () => {
expect(parseAlertContextTraceIdPath("/flow/alerts/alert%3Actx%2Fone/context")).toBe("alert:ctx/one");
});
it("returns null for unrelated alert paths", () => {
expect(isAlertContextPath("/flow/alerts")).toBe(false);
expect(parseAlertContextTraceIdPath("/flow/alerts/alert:ctx")).toBeNull();
});
it("rejects malformed trace ids safely", () => {
expect(() => parseAlertContextTraceIdPath("/flow/alerts/%20/context")).toThrow();
expect(() => parseAlertContextTraceIdPath("/flow/alerts/%24bad/context")).toThrow();
});
});