Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(console): stop reporting results that were never measured (#996)
Beenu Aroraad9c3bc69f4b
diff --git a/apps/web/src/components/cases/CasesCountHonesty.test.tsx b/apps/web/src/components/cases/CasesCountHonesty.test.tsxnew file mode 100644index 000000000..986f90e90--- /dev/null+++ b/apps/web/src/components/cases/CasesCountHonesty.test.tsx@@ -0,0 +1,118 @@+/**+ * The counter beside the filters must know what the stat cards above it know.+ *+ * `CasesView` already computes `countsUnknown` and honours it in the five+ * status stat cards, which render an em-dash when the case service has not+ * answered. The small counter in the filter row did not: it printed+ * `0 cases`, so the page gave two different answers about the same unread+ * list — five honest em-dashes and one confident zero, a few pixels apart.+ *+ * Two surfaces disagreeing about the same data is the tell, and the+ * confident one is always the wrong one: a zero reads as+ * measured-and-there-are-none, which is a different claim from+ * not-measured.+ */+import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';+import { cleanup, render, screen } from '@testing-library/react';+import { __setDemoModeForTests } from '@/lib/demoMode';++const swrData = vi.hoisted(() => ({ value: undefined as unknown }));+const swrError = vi.hoisted(() => ({ value: undefined as unknown }));++// Keyed, not blanket: `SavedViewsBar` uses SWR too, and handing it the cases+// payload makes it throw on a shape it never asked for.+vi.mock('swr', () => ({+ __esModule: true,+ default: (key: unknown) => {+ const isCases = Array.isArray(key) && key[0] === 'cases';+ return {+ data: isCases ? swrData.value : undefined,+ error: isCases ? swrError.value : undefined,+ isLoading: false,+ mutate: vi.fn(),+ };+ },+}));++vi.mock('@/lib/api', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/lib/api')>();+ return { ...actual, casesApi: { ...actual.casesApi, list: vi.fn() } };+});++vi.mock('next/link', () => ({+ __esModule: true,+ default: ({ children, href }: { children: React.ReactNode; href: string }) => <a href={href}>{children}</a>,+}));++vi.mock('next/navigation', () => ({+ __esModule: true,+ useRouter: () => ({ push: vi.fn(), replace: vi.fn(), refresh: vi.fn() }),+ usePathname: () => '/cases',+ useSearchParams: () => new URLSearchParams(),+}));++import { CasesView } from './CasesView';++beforeEach(() => {+ swrData.value = undefined;+ swrError.value = undefined;+ __setDemoModeForTests(false);+});++afterEach(() => {+ cleanup();+ __setDemoModeForTests(null);+});++describe('an unread case list is not a count of zero', () => {+ it('does not print a zero when the service has not answered', () => {+ render(<CasesView />);++ expect(screen.queryByText(/^0 cases$/)).toBeNull();+ expect(screen.getByText(/^— cases$/)).toBeInTheDocument();+ });++ it('agrees with the stat cards beside it', () => {+ render(<CasesView />);++ // The five status cards already render an em-dash here. The counter must+ // be the sixth, not the one surface that disagrees.+ const dashes = screen.getAllByText('—');+ expect(dashes.length).toBeGreaterThanOrEqual(5);+ expect(screen.getByText(/^— cases$/)).toBeInTheDocument();+ });++ it('does not print a zero when the read failed', () => {+ swrError.value = new Error('503 Service Unavailable');++ render(<CasesView />);++ expect(screen.queryByText(/^0 cases$/)).toBeNull();+ expect(screen.getByText(/^— cases$/)).toBeInTheDocument();+ });++ it('still counts a genuinely empty list as zero', () => {+ // The other direction. An em-dash forever would pass every assertion+ // above and hide a real, informative zero.+ swrData.value = { cases: [], total: 0 };++ render(<CasesView />);++ expect(screen.getByText(/^0 cases$/)).toBeInTheDocument();+ expect(screen.queryByText(/^— cases$/)).toBeNull();+ });++ it('counts a populated list', () => {+ swrData.value = {+ cases: [+ { id: 'c1', title: 'Ransomware on FIN-WS-04', status: 'open', severity: 'critical', createdAt: '2026-09-27T10:00:00Z', updatedAt: '2026-09-27T10:00:00Z' },+ { id: 'c2', title: 'Impossible travel for j.doe', status: 'open', severity: 'high', createdAt: '2026-09-27T11:00:00Z', updatedAt: '2026-09-27T11:00:00Z' },+ ],+ total: 2,+ };++ render(<CasesView />);++ expect(screen.getByText(/^2 cases$/)).toBeInTheDocument();+ });+});diff --git a/apps/web/src/components/cases/CasesView.tsx b/apps/web/src/components/cases/CasesView.tsxindex c801f1649..934635582 100644--- a/apps/web/src/components/cases/CasesView.tsx+++ b/apps/web/src/components/cases/CasesView.tsx@@ -298,7 +298,17 @@ export function CasesView({ initialCases }: CasesViewProps = {}) {<option value="low">Low</option></select>- <span className="text-xs text-gray-500">{cases.length} cases</span>+ {/* The same `countsUnknown` the five stat cards above already honour.+ This one printed `0 cases` beside their five em-dashes, so the+ page gave two different answers about the same unread list — and+ the confident one was the wrong one, because a zero reads as+ measured-and-none rather than not-measured. */}+ <span+ className="text-xs text-gray-500"+ title={countsUnknown ? 'The case service has not answered, so there is no count to show.' : undefined}+ >+ {countsUnknown ? '— cases' : `${cases.length} cases`}+ </span></div>{/* Cases List */}diff --git a/apps/web/src/components/dashboard/DashboardFirstPaint.test.tsx b/apps/web/src/components/dashboard/DashboardFirstPaint.test.tsxnew file mode 100644index 000000000..353ddda89--- /dev/null+++ b/apps/web/src/components/dashboard/DashboardFirstPaint.test.tsx@@ -0,0 +1,149 @@+/**+ * First paint is a state, and it is not "empty".+ *+ * `PanelUnavailable` had an error branch and an empty branch. The error+ * branch reads as sufficient — a failed request gets an honest error state —+ * right up until you notice which branch runs *before* the request lands.+ * With no data and no error yet, `/dashboard` rendered the empty branch and+ * asserted **"No alerts in the last 24 hours"**: a measured claim about a+ * window nothing had looked at, made milliseconds before the failing request+ * came back and replaced it.+ *+ * This project has re-learned that shape enough times that the test has to+ * name it: assert on first paint, not only on the error branch. A suite that+ * only ever set an error would have passed against the defect.+ *+ * Both directions. A dashboard that answered "not loaded yet" forever would+ * pass the first assertion and be useless, so a genuinely empty window must+ * still read as empty.+ */+import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';+import { cleanup, render, screen } from '@testing-library/react';+import { __setDemoModeForTests } from '@/lib/demoMode';++const swrData = vi.hoisted(() => new Map<string, unknown>());+const swrErrors = vi.hoisted(() => new Map<string, unknown>());+const swrLoading = vi.hoisted(() => new Set<string>());++vi.mock('swr', () => ({+ __esModule: true,+ default: (key: unknown) => {+ const k = typeof key === 'string' ? key : JSON.stringify(key);+ return {+ data: swrData.get(k),+ error: swrErrors.get(k),+ isLoading: swrLoading.has(k),+ mutate: vi.fn(),+ };+ },+}));++vi.mock('@/lib/api', () => ({+ __esModule: true,+ metricsApi: {+ getDashboard: vi.fn(),+ getSOC: vi.fn(),+ getFunnel: vi.fn(),+ getPipelineHealth: vi.fn(),+ },+ investigationsApi: { getCostAggregate: vi.fn() },+}));++vi.mock('next/link', () => ({+ __esModule: true,+ default: ({ children, href }: { children: React.ReactNode; href: string }) => <a href={href}>{children}</a>,+}));++vi.mock('next/navigation', () => ({+ __esModule: true,+ useRouter: () => ({ push: vi.fn(), replace: vi.fn(), refresh: vi.fn() }),+ usePathname: () => '/dashboard',+ useSearchParams: () => new URLSearchParams(),+}));++vi.mock('next/dynamic', () => ({+ __esModule: true,+ default: () => function DynamicStub() {+ return null;+ },+}));++vi.mock('@/lib/realtime', () => ({+ __esModule: true,+ useRealtimeChannel: () => ({ status: 'disconnected', lastEvent: null, events: [] }),+}));++import { DashboardView } from './DashboardView';++/** Every panel claim that is a statement about measured data. */+const MEASURED_CLAIMS = [+ /No alerts in the last 24 hours/i,+ /No dashboard metrics yet/i,+ /No severity data/i,+ /No technique coverage yet/i,+];++beforeEach(() => {+ swrData.clear();+ swrErrors.clear();+ swrLoading.clear();+ __setDemoModeForTests(false);+});++afterEach(() => {+ cleanup();+ __setDemoModeForTests(null);+});++describe('the dashboard does not report a result it has not got', () => {+ it('claims nothing on first paint, while the request is still in flight', () => {+ swrLoading.add('dashboard-metrics');++ render(<DashboardView />);++ for (const claim of MEASURED_CLAIMS) {+ expect(screen.queryByText(claim), `"${claim}" is a measured claim and the request has not landed`).toBeNull();+ }+ expect(screen.getAllByText(/Not loaded yet/i).length).toBeGreaterThan(0);+ });++ it('claims nothing when the response carried no alert totals', () => {+ // Not in flight, no error, and a payload the view cannot read. Equally+ // unmeasured, and the branch a plain `isLoading` check would miss.+ swrData.set('dashboard-metrics', { cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 } });++ render(<DashboardView />);++ for (const claim of MEASURED_CLAIMS) {+ expect(screen.queryByText(claim)).toBeNull();+ }+ expect(screen.getAllByText(/Not loaded yet/i).length).toBeGreaterThan(0);+ });++ it('still shows the failure when the request failed', () => {+ swrErrors.set('dashboard-metrics', new Error('503 Service Unavailable'));++ render(<DashboardView />);++ expect(screen.getAllByText(/503 Service Unavailable/i).length).toBeGreaterThan(0);+ expect(screen.queryByText(/No alerts in the last 24 hours/i)).toBeNull();+ });++ it('still reports a genuinely empty window as empty', () => {+ // The other direction. "Not loaded yet" everywhere forever would pass+ // every assertion above and tell an operator nothing.+ swrData.set('dashboard-metrics', {+ alerts: { total: 0, new: 0, critical: 0, high: 0, medium: 0, low: 0, info: 0, mttr: 0, mttr_sample_count: 0 },+ cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 },+ sources: [],+ topMitre: [],+ alertsTrend: [],+ threatsBySource: [],+ });++ render(<DashboardView />);++ expect(screen.getByText(/No alerts in the last 24 hours/i)).toBeInTheDocument();+ expect(screen.queryByText(/Not loaded yet/i)).toBeNull();+ });+});diff --git a/apps/web/src/components/dashboard/DashboardView.tsx b/apps/web/src/components/dashboard/DashboardView.tsxindex 7f2b248d8..a9007a287 100644--- a/apps/web/src/components/dashboard/DashboardView.tsx+++ b/apps/web/src/components/dashboard/DashboardView.tsx@@ -227,14 +227,31 @@ function MetricCard({ label, value, sub, color = 'blue', trend }: MetricCardProp* data for this panel. Say *that*, and point at the thing* that would produce some.*/+/**+ * Three states, not two.+ *+ * This had an error branch and an empty branch, and the error branch runs+ * first — which reads as complete right up until you notice that the empty+ * branch is also what renders *before* the request lands. On first paint,+ * with no data and no error yet, `/dashboard` asserted "No alerts in the last+ * 24 hours": a measured claim about a window nothing had looked at, made+ * milliseconds before the failing request came back.+ *+ * `pending` is the missing third state. It covers the request still being in+ * flight and the request having answered without the figures this panel needs+ * — both are "not measured", and neither is a report of zero.+ */function PanelUnavailable({error,+ pending,onRetry,emptyTitle,emptyDescription,action,}: {error?: unknown;+ /** The answer is not in. Never claim a measurement. */+ pending?: boolean;onRetry?: () => void;emptyTitle: string;emptyDescription: string;@@ -251,6 +268,15 @@ function PanelUnavailable({/>);}+ if (pending) {+ return (+ <EmptyState+ title="Not loaded yet"+ description="Waiting on the metrics API. This panel will say what it found once it answers."+ className="px-4 py-6"+ />+ );+ }return (<EmptyStatetitle={emptyTitle}@@ -429,7 +455,12 @@ function useDashboardLayout() {// ─── Main Dashboard ───────────────────────────────────────────────────────────export function DashboardView() {- const { data: rawMetrics, error: metricsError, mutate: mutateMetrics } = useSWR(+ const {+ data: rawMetrics,+ error: metricsError,+ isLoading: metricsLoading,+ mutate: mutateMetrics,+ } = useSWR('dashboard-metrics',() => metricsApi.getDashboard(),{@@ -477,6 +508,17 @@ export function DashboardView() {}: null;+ /**+ * Whether these panels have anything measured to report.+ *+ * Both halves matter. `metricsLoading` is the request still being in flight,+ * which is the first-paint case. `!metrics` also covers the request having+ * answered with a payload that carries no alert totals — equally unmeasured,+ * and equally not a zero. A panel reached through either branch must not+ * describe a result.+ */+ const metricsPending = metricsLoading || (!metrics && !metricsError);+const sources = metrics?.sources ?? [];const topMitre = metrics?.topMitre ?? [];const activeSourceCount = sources.filter((s) => s.status === 'active').length;@@ -582,6 +624,7 @@ export function DashboardView() {) : (<PanelUnavailableerror={metricsError}+ pending={metricsPending}onRetry={retryMetrics}emptyTitle="No dashboard metrics yet"emptyDescription="Connect a data source to start populating alert, case and MTTR counters."@@ -602,6 +645,7 @@ export function DashboardView() {) : (<PanelUnavailableerror={metricsError}+ pending={metricsPending}onRetry={retryMetrics}emptyTitle="No alerts in the last 24 hours"emptyDescription="The volume curve plots hourly alert counts once alerts start arriving."@@ -628,6 +672,7 @@ export function DashboardView() {) : (<PanelUnavailableerror={metricsError}+ pending={metricsPending}onRetry={retryMetrics}emptyTitle="No severity data"emptyDescription="Severity counts appear once the API returns alert metrics."@@ -646,6 +691,7 @@ export function DashboardView() {) : (<PanelUnavailableerror={metricsError}+ pending={metricsPending}onRetry={retryMetrics}emptyTitle="No technique coverage yet"emptyDescription="Tactics rank by alert count once detections start firing."@@ -657,6 +703,7 @@ export function DashboardView() {{sources.length === 0 ? (<PanelUnavailableerror={metricsError}+ pending={metricsPending}onRetry={retryMetrics}emptyTitle="No sources connected"emptyDescription="Connect a data source and its event volume appears here."diff --git a/apps/web/src/components/threat-intel/ThreatIntelCountHonesty.test.tsx b/apps/web/src/components/threat-intel/ThreatIntelCountHonesty.test.tsxnew file mode 100644index 000000000..bf91a6d9d--- /dev/null+++ b/apps/web/src/components/threat-intel/ThreatIntelCountHonesty.test.tsx@@ -0,0 +1,138 @@+/**+ * The indicator counters must know what the empty state beside them knows.+ *+ * `ThreatIntelView` already computes `storeUnknown` and uses it to write the+ * right sentence into the empty state — *"The threat-intel service did not+ * answer. This is not a report that no indicators exist."* Directly above+ * that sentence, the panel header printed `0 indicators`, and the five type+ * chips printed `All (0) IP (0) DOMAIN (0) HASH (0) URL (0)`.+ *+ * Six measured-looking zeros sitting on top of a paragraph explaining that+ * nothing was measured. The paragraph was right; the numbers were the ones+ * an analyst reads first.+ */+import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';+import { cleanup, render, screen } from '@testing-library/react';+import { __setDemoModeForTests } from '@/lib/demoMode';++const swrData = vi.hoisted(() => ({ value: undefined as unknown }));+const swrError = vi.hoisted(() => ({ value: undefined as unknown }));++vi.mock('swr', () => ({+ __esModule: true,+ default: () => ({+ data: swrData.value,+ error: swrError.value,+ isLoading: false,+ mutate: vi.fn(),+ }),+}));++vi.mock('@/lib/api', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/lib/api')>();+ return { ...actual, threatIntelApi: { ...actual.threatIntelApi, list: vi.fn(), lookup: vi.fn() } };+});++import { ThreatIntelView } from './ThreatIntelView';++function chipLabels(): string[] {+ return ['All', 'IP', 'DOMAIN', 'HASH', 'URL'].map((name) => {+ const btn = screen.getByRole('button', { name: new RegExp(`^${name}\\s*\\(`) });+ return (btn.textContent ?? '').trim();+ });+}++beforeEach(() => {+ swrData.value = undefined;+ swrError.value = undefined;+ __setDemoModeForTests(false);+});++afterEach(() => {+ cleanup();+ __setDemoModeForTests(null);+});++describe('an unreachable indicator store is not a count of zero', () => {+ it('does not print a zero in the panel header', () => {+ render(<ThreatIntelView />);++ expect(screen.queryByText(/^0 indicators$/)).toBeNull();+ expect(screen.getByText(/^— indicators$/)).toBeInTheDocument();+ });++ it('does not print zeros on the type chips', () => {+ render(<ThreatIntelView />);++ for (const label of chipLabels()) {+ expect(label, `"${label}" reads as a measured count`).toMatch(/\(—\)$/);+ }+ });++ it('agrees with the empty state it sits above', () => {+ render(<ThreatIntelView />);++ // The paragraph was already honest; the numbers were not.+ expect(screen.getByText(/this is not a report that no indicators exist/i)).toBeInTheDocument();+ expect(screen.getByText(/^— indicators$/)).toBeInTheDocument();+ });++ it('does not print a zero when the read failed', () => {+ swrError.value = new Error('503 Service Unavailable');++ render(<ThreatIntelView />);++ expect(screen.queryByText(/^0 indicators$/)).toBeNull();+ expect(screen.getByText(/^— indicators$/)).toBeInTheDocument();+ });++ it('still counts a genuinely empty store as zero', () => {+ // The other direction: a store that answered and holds nothing is a real+ // measurement, and an em-dash would hide it.+ swrData.value = { indicators: [], total: 0 };++ render(<ThreatIntelView />);++ expect(screen.getByText(/^0 indicators$/)).toBeInTheDocument();+ expect(screen.queryByText(/^— indicators$/)).toBeNull();+ for (const label of chipLabels()) {+ expect(label).toMatch(/\(0\)$/);+ }+ });++ it('does not print zeros when the route answered 200 but said it was degraded', () => {+ // The live shape, and the one `!data` could never catch. With no+ // threat-intel service reachable the route answers HTTP 200 with+ // `degraded: true` and a reason — an explicit non-measurement.+ swrData.value = {+ indicators: [],+ total: 0,+ degraded: true,+ reason: 'the threat-intel service did not answer (ConnectError); no indicators can be listed',+ };++ render(<ThreatIntelView />);++ expect(screen.queryByText(/^0 indicators$/)).toBeNull();+ expect(screen.getByText(/^— indicators$/)).toBeInTheDocument();+ for (const label of chipLabels()) {+ expect(label).toMatch(/\(—\)$/);+ }+ // And it says what the route said, rather than a generic sentence.+ expect(screen.getByText(/did not answer \(ConnectError\)/i)).toBeInTheDocument();+ });++ it('counts a populated store', () => {+ swrData.value = {+ indicators: [+ { id: 'i1', type: 'ip', value: '203.0.113.10', severity: 'high', confidence: 90, sources: ['feodo'], firstSeen: '2026-09-27T10:00:00Z', lastSeen: '2026-09-27T12:00:00Z' },+ { id: 'i2', type: 'domain', value: 'malicious.example', severity: 'medium', confidence: 70, sources: ['otx'], firstSeen: '2026-09-27T10:00:00Z', lastSeen: '2026-09-27T12:00:00Z' },+ ],+ total: 2,+ };++ render(<ThreatIntelView />);++ expect(screen.getByText(/^2 indicators$/)).toBeInTheDocument();+ });+});diff --git a/apps/web/src/components/threat-intel/ThreatIntelView.tsx b/apps/web/src/components/threat-intel/ThreatIntelView.tsxindex 1ec230cd4..eb73cb5f9 100644--- a/apps/web/src/components/threat-intel/ThreatIntelView.tsx+++ b/apps/web/src/components/threat-intel/ThreatIntelView.tsx@@ -260,7 +260,15 @@ export function ThreatIntelView() {// absence. `?? []` then published "Malicious (of shown): 0" — a security// verdict — and an empty state telling the operator to go connect a feed,// on a store the page could not reach.- const storeUnknown = !data;+ //+ // `degraded` is the other half, and the live one. With no threat-intel+ // service reachable the route answers **HTTP 200** carrying+ // `degraded: true` and a reason — an explicit statement that nothing was+ // measured — so `!data` is false and every figure on this page rendered a+ // confident zero over it. `threatIntelApi.lookup` already treats the same+ // flag as a failed lookup; the list did not.+ const storeUnknown = !data || data.degraded === true;+ const degradedReason = data?.reason?.trim() || null;// Not `?? MOCK_INDICATORS`. `fallbackData` above already withholds the// sample set outside the hosted demo; repeating the constant here put it@@ -358,7 +366,9 @@ export function ThreatIntelView() {: 'text-gray-400 bg-gray-800/60 hover:bg-gray-800')}>- {t === 'all' ? 'All' : t.toUpperCase()} ({typeCounts[t] ?? 0})+ {/* Five chips reading `(0)` is five measured claims about a+ store the page could not reach. */}+ {t === 'all' ? 'All' : t.toUpperCase()} ({storeUnknown ? '—' : typeCounts[t] ?? 0})</button>))}</div>@@ -368,10 +378,18 @@ export function ThreatIntelView() {<div className="bg-gray-900/60 border border-gray-800/60 rounded-xl p-4"><div className="flex items-center justify-between mb-3"><h3 className="text-sm font-medium text-gray-300">Indicators of Compromise</h3>- <span className="text-xs text-gray-500">- {totalCollected > indicators.length- ? `${indicators.length.toLocaleString()} of ${totalCollected.toLocaleString()} indicators`- : `${indicators.length.toLocaleString()} indicators`}+ {/* `storeUnknown` is the same signal the empty state below uses to+ say "this is not a report that no indicators exist". This+ counter said `0 indicators` directly above that sentence. */}+ <span+ className="text-xs text-gray-500"+ title={storeUnknown ? 'The threat-intel service has not answered, so there is no count to show.' : undefined}+ >+ {storeUnknown+ ? '— indicators'+ : totalCollected > indicators.length+ ? `${indicators.length.toLocaleString()} of ${totalCollected.toLocaleString()} indicators`+ : `${indicators.length.toLocaleString()} indicators`}</span></div>{indicators.length === 0 ? (@@ -405,7 +423,10 @@ export function ThreatIntelView() {storeUnknown? isLoading? 'Reading indicators from the threat-intel service.'- : `The threat-intel service did not answer${error ? '' : ''}. This is not a report that no indicators exist.`+ : // The route's own `reason` when it sent one, because+ // "did not answer (ConnectError)" tells an operator+ // where to look and a generic sentence does not.+ `${degradedReason ?? 'The threat-intel service did not answer'}. This is not a report that no indicators exist.`: 'Connect a TI feed (MISP, OTX, AbuseIPDB, GreyNoise, internal STIX/TAXII) from Settings → Connectors to start enriching alerts with reputation context.'}className="bg-transparent py-8"diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex 27dbc2223..7a5a00692 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -3136,11 +3136,24 @@ export const threatIntelApi = {// `total` is the store's count of indicators in scope; `shown` is how many// this response carries. They are different numbers and the console renders// both — it used to render the page length as the catalogue size.+ //+ // `degraded`/`reason` are on the type because the route sets them and the+ // list path was throwing them away. Measured against a running stack with+ // no threat-intel service, this route answers **HTTP 200** with+ // `{"indicators":[],"total":0,"degraded":true,"reason":"the threat-intel+ // service did not answer (ConnectError); no indicators can be listed"}` —+ // so a consumer keying only on "did the request succeed" reads an explicit+ // non-measurement as a measurement of zero. `lookup` above already treats+ // the same flag as a failed lookup.list: (filters: { type?: IndicatorType; tag?: string; q?: string } = {}) =>- request<{ indicators: ThreatIndicator[]; total: number; shown?: number; bounded?: boolean }>(- '/api/v1/threat-intel/indicators',- { params: filters as Record<string, string> },- ),+ request<{+ indicators: ThreatIndicator[];+ total: number;+ shown?: number;+ bounded?: boolean;+ degraded?: boolean;+ reason?: string;+ }>('/api/v1/threat-intel/indicators', { params: filters as Record<string, string> }),};// ─── AI Agents ────────────────────────────────────────────────────────────────