fix historical alert flow packet resolution

This commit is contained in:
dirtydishes 2026-05-20 02:59:53 -04:00
parent 3632f36272
commit adba1f6b5a
4 changed files with 473 additions and 17 deletions

View file

@ -43,6 +43,8 @@ import {
shouldClearOptionFocusSeed,
smartMoneyProfileLabel,
smartMoneyToneForProfile,
getAlertFlowPacketRefs,
resolveAlertFlowPacket,
statusLabel,
toggleFilterValue
} from "./terminal";
@ -133,6 +135,33 @@ describe("alert context hydration helpers", () => {
expect(evidence.prints.get("print:1")?.execution_nbbo_bid).toBe(1.2);
expect(evidence.prints.get("print:1")?.execution_underlying_spot).toBe(450.05);
});
it("finds flow-packet refs even when they are not first in alert evidence", () => {
const alert = makeAlert({
evidence_refs: ["smartmoney:single_leg_event:flowpacket:1", "flowpacket:1", "print:1"]
});
expect(getAlertFlowPacketRefs(alert)).toEqual(["flowpacket:1"]);
});
it("resolves the primary alert flow packet from hydrated historical context", () => {
const packet = {
trace_id: "flowpacket:1",
id: "flowpacket:1",
members: ["print:1"],
source_ts: 1,
ingest_ts: 2,
seq: 1,
features: {},
join_quality: {}
} as any;
const alert = makeAlert({
evidence_refs: ["smartmoney:single_leg_event:flowpacket:1", "flowpacket:1", "print:1"]
});
const packets = new Map<string, typeof packet>([[packet.id, packet]]);
expect(resolveAlertFlowPacket(alert, packets)).toBe(packet);
});
});
describe("live manifest", () => {