fix(workbench): suppress unconfigured demo alerts

The not_configured branch previously promoted mock task failures into critical alerts. Return an explicit empty alert source so the exception badge reflects only actionable backend state.
This commit is contained in:
2026-09-24 15:13:14 +08:00
parent 7e969e7e8c
commit a5e5acb03b
5 changed files with 24 additions and 11 deletions
@@ -66,7 +66,7 @@ describe("workbench runtime data", () => {
expect(getMsUntilNextHeaderDataTimeTick(new Date(2026, 6, 22, 15, 43, 30))).toBe(90_000);
});
it("keeps mock conditions and shows no work orders when backend storage is not configured", () => {
it("keeps mock conditions without inventing alerts when backend storage is not configured", () => {
const resolved = resolveWorkbenchRuntimeData([mockCondition], {
availability: "not_configured",
source: "none",
@@ -86,7 +86,8 @@ describe("workbench runtime data", () => {
expect(resolved.runtimeDataSource).toBe("mock");
expect(resolved.scheduledConditions).toEqual([mockCondition]);
expect(resolved.workbenchAlerts).toHaveLength(1);
expect(resolved.workbenchAlerts).toEqual([]);
expect(resolved.alertDataSource).toBe("none");
expect(resolved.scenarioDataSource).toBe("mock");
expect(resolved.artifactDataSource).toBe("mock");
expect(resolved.workOrderDataSource).toBe("none");
@@ -132,9 +133,8 @@ describe("workbench runtime data", () => {
expect(resolved.runtimeDataSource).toBe("mock");
expect(resolved.scheduledConditions).toEqual([mockCondition]);
expect(resolved.workbenchAlerts).not.toEqual([backendAlert]);
expect(resolved.workbenchAlerts[0]?.id).toBe("scheduled-condition-alert-mock-condition");
expect(resolved.alertDataSource).toBe("mock");
expect(resolved.workbenchAlerts).toEqual([]);
expect(resolved.alertDataSource).toBe("none");
expect(resolved.scenarioDataSource).toBe("mock");
expect(resolved.workOrderDataSource).toBe("none");
@@ -11,7 +11,6 @@ import {
} from "../data/scheduled-conditions";
import { WORKBENCH_SCENARIOS } from "../data/workbench-session";
import type { ScheduledConditionItem } from "../types";
import { createScheduledConditionAlerts } from "../utils/scheduled-condition-alerts";
import type { WorkbenchSyncState } from "./use-workbench-sync";
const HEADER_DATA_TIME_STEP_MINUTES = 5;
@@ -106,8 +105,8 @@ export function resolveWorkbenchRuntimeData(
scheduledConditions: [...fallbackConditions, ...resolvedWorkOrders],
workbenchAlerts: backendAlertsConfigured
? backendSnapshot!.alerts
: createScheduledConditionAlerts(fallbackConditions),
alertDataSource: backendAlertsConfigured ? "backend" as const : "mock" as const,
: [],
alertDataSource: backendAlertsConfigured ? "backend" as const : "none" as const,
runtimeDataSource: "mock" as const,
scenarios: useBackendScenarios ? backendSnapshot!.scenarios : WORKBENCH_SCENARIOS,
scenarioDataSource: useBackendScenarios ? "analysis_runs" as const : "mock" as const,