The dashboard is embedded in the single binary, which serves api/openapi.yaml. It was still calling the old services' routes, so pages that read them answered with a not-found: the task board, its activity feed and setup panel, logs, alerts, audit and its export, bindings, schedules, channels, repositories, skills, curators, the control-plane settings pages, identities and org agents, the org switcher, secret-reference checks, task metadata, and the audit, usage, summary and version reads. Each of those surfaces is removed, and a test compares every /api path in the dashboard's source with api/openapi.yaml so the next one fails the gate instead of the browser. Settings that the binary does serve (model providers, instructions, policies, members) keep their pages.
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import type { EventsCountReaders } from "../src/pages/events/lib/counts.ts";
|
|
|
|
const { loadEventCounts } = await import("../src/pages/events/lib/counts.ts");
|
|
|
|
/** Readers standing in for api.captures and api.mappings. */
|
|
function readers(overrides: Partial<EventsCountReaders> = {}): EventsCountReaders {
|
|
return {
|
|
captures: async () => ({ captures: [{}, {}] }),
|
|
mappings: async () => ({ mappings: [{}] }),
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
test("each count is the length of what its own read answered with", async () => {
|
|
assert.deepEqual(await loadEventCounts(readers()), {
|
|
inspector: 2,
|
|
mappings: 1,
|
|
});
|
|
});
|
|
|
|
test("a count that could not be read stays blank, not zero", async () => {
|
|
const counts = await loadEventCounts(
|
|
readers({
|
|
mappings: async () => {
|
|
throw new Error("offline");
|
|
},
|
|
}),
|
|
);
|
|
assert.equal(counts.mappings, undefined);
|
|
assert.equal(counts.inspector, 2, "a failed sibling read blanked its count");
|
|
});
|
|
|
|
test("a response without its list counts as an empty list", async () => {
|
|
const counts = await loadEventCounts(
|
|
readers({
|
|
captures: async () => null,
|
|
mappings: async () => ({}),
|
|
}),
|
|
);
|
|
assert.equal(counts.inspector, 0);
|
|
assert.equal(counts.mappings, 0);
|
|
});
|