fix: persist and retry run alerts and honor notification modes
This commit is contained in:
@@ -31,6 +31,26 @@ const frame = (runId, status, extra = {}) => ({
|
||||
...extra,
|
||||
});
|
||||
|
||||
test("off suppresses every browser alert from summaries and pushed modes", () => {
|
||||
for (const status of ["waiting", "failed", "succeeded"]) {
|
||||
const ledger = createAlertLedger();
|
||||
ledger.seed([{ id: 1, status: "running", notify_mode: "off" }]);
|
||||
assert.equal(ledger.observe(frame(1, status)), null);
|
||||
ledger.seed([{ id: 1, status: "running", notify_mode: "on" }]);
|
||||
assert.equal(ledger.observe(frame(1, status, { notify_mode: "off" })), null);
|
||||
}
|
||||
});
|
||||
|
||||
test("on adds final success once while auto retains attention-only semantics", () => {
|
||||
const ledger = createAlertLedger();
|
||||
ledger.seed([{ id: 1, status: "running", notify_mode: "on" }, { id: 2, status: "running", notify_mode: "auto" }]);
|
||||
const alert = ledger.observe(frame(1, "succeeded"));
|
||||
assert.equal(alert.title, "A run succeeded");
|
||||
assert.equal(alert.key, "1:Succeeded");
|
||||
assert.equal(ledger.observe(frame(1, "succeeded")), null);
|
||||
assert.equal(ledger.observe(frame(2, "succeeded")), null);
|
||||
});
|
||||
|
||||
test("headlines are exactly the app's two, and unknown kinds are blank", () => {
|
||||
assert.equal(alertTitle(AttentionKind.Failed), "A run failed");
|
||||
assert.equal(alertTitle(AttentionKind.Decision), "A run needs your decision");
|
||||
|
||||
@@ -87,6 +87,16 @@ function frame({
|
||||
|
||||
// --- lifecycle vocabulary ----------------------------------------------------
|
||||
|
||||
test("run summaries and detail preserve notification mode from live frames", () => {
|
||||
const incoming = { ...frame({ pipelineId: 4, name: "test", status: "queued" }), notify_mode: "off" };
|
||||
assert.equal(newRunSummaryFromFrame(incoming).notify_mode, "off");
|
||||
const runs = [summary(1)];
|
||||
const folded = foldRunEvent(runs, { ...incoming, status: "running" });
|
||||
assert.equal(folded.runs[0].notify_mode, "off");
|
||||
const result = foldRunEventDetail(detail({status:"running"}), { ...incoming, status: "failed" });
|
||||
assert.equal(result.notify_mode, "off");
|
||||
});
|
||||
|
||||
test("the lifecycle ladders mirror RunEvents.kt", () => {
|
||||
assert.deepEqual(TERMINAL_RUN_STATUSES, ["succeeded", "failed", "canceled", "interrupted"]);
|
||||
assert.equal(runLifecycleRank("queued"), 0);
|
||||
|
||||
Reference in New Issue
Block a user