resolve main merge conflicts for alert context and beads state

This commit is contained in:
dirtydishes 2026-05-17 21:12:19 -04:00
commit dc932cf18e
11 changed files with 843 additions and 153 deletions

View file

@ -47,6 +47,7 @@ import {
ensureOptionPrintsTable,
fetchAlertsAfter,
fetchAlertsBefore,
fetchAlertContextByTraceId,
fetchClassifierHitsAfter,
fetchClassifierHitsBefore,
fetchSmartMoneyEventsAfter,
@ -119,6 +120,7 @@ import {
resolveLiveStateConfig,
shouldFanoutLiveEvent
} from "./live";
import { isAlertContextPath, parseAlertContextTraceIdPath } from "./alert-context";
import { parseOptionPrintQuery } from "./option-queries";
import {
buildSyntheticDerivedStatus,
@ -1488,6 +1490,25 @@ const run = async () => {
return jsonResponse({ data });
}
if (req.method === "GET" && isAlertContextPath(url.pathname)) {
try {
const traceId = parseAlertContextTraceIdPath(url.pathname);
if (traceId === null) {
return jsonResponse({ error: "not found" }, 404);
}
const data = await fetchAlertContextByTraceId(clickhouse, traceId);
return jsonResponse(data);
} catch (error) {
return jsonResponse(
{
error: "invalid alert context query",
detail: error instanceof Error ? error.message : String(error)
},
400
);
}
}
if (req.method === "GET" && url.pathname === "/history/options") {
try {
const { beforeTs, beforeSeq, limit } = parseBeforeParams(url);