fix(dashboard): address observability review findings
This commit is contained in:
parent
2d2b905d18
commit
bfb9a91e49
11 changed files with 188 additions and 10 deletions
|
|
@ -47,6 +47,68 @@ describe("dashboard runtime loader", () => {
|
|||
expect(store.listRevisions()).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("refreshes an existing initial seed when the bundled seed changes", async () => {
|
||||
const store = await createTestStore();
|
||||
const oldSeed = olderDimensionLabSeed();
|
||||
store.seedDashboardIfEmpty(oldSeed, {
|
||||
actor: "initial-seed",
|
||||
message: "load initial dashboard document",
|
||||
});
|
||||
|
||||
const runtime = loadDashboardRuntime(store, {
|
||||
refreshSeedDocument: true,
|
||||
seedDocument: dimensionLabDashboardFixture,
|
||||
seedIfEmpty: true,
|
||||
});
|
||||
|
||||
expect(runtime.state).toBe("ready");
|
||||
if (runtime.state !== "ready") throw new Error("expected ready dashboard");
|
||||
expect(runtime.document.statusStrips[0]?.items.map((item) => item.id)).toContain(
|
||||
"auto-refresh",
|
||||
);
|
||||
expect(runtime.document.serviceGroups.flatMap((group) => group.services).map((service) => service.id)).toContain(
|
||||
"prompt-registry",
|
||||
);
|
||||
expect(store.listRevisions()).toHaveLength(2);
|
||||
expect(store.getActiveDashboard()?.revision.actor).toBe("initial-seed");
|
||||
});
|
||||
|
||||
test("does not refresh a dashboard after a user-authored revision", async () => {
|
||||
const store = await createTestStore();
|
||||
const oldSeed = olderDimensionLabSeed();
|
||||
store.seedDashboardIfEmpty(oldSeed, {
|
||||
actor: "initial-seed",
|
||||
message: "load initial dashboard document",
|
||||
});
|
||||
store.commitDashboard(
|
||||
{
|
||||
...oldSeed,
|
||||
metadata: {
|
||||
...oldSeed.metadata,
|
||||
title: "Custom Dashboard",
|
||||
},
|
||||
},
|
||||
{
|
||||
actor: "agent",
|
||||
message: "customize dashboard",
|
||||
},
|
||||
);
|
||||
|
||||
const runtime = loadDashboardRuntime(store, {
|
||||
refreshSeedDocument: true,
|
||||
seedDocument: dimensionLabDashboardFixture,
|
||||
seedIfEmpty: true,
|
||||
});
|
||||
|
||||
expect(runtime.state).toBe("ready");
|
||||
if (runtime.state !== "ready") throw new Error("expected ready dashboard");
|
||||
expect(runtime.document.metadata.title).toBe("Custom Dashboard");
|
||||
expect(runtime.document.statusStrips[0]?.items.map((item) => item.id)).not.toContain(
|
||||
"auto-refresh",
|
||||
);
|
||||
expect(store.listRevisions()).toHaveLength(2);
|
||||
});
|
||||
|
||||
test("returns empty state when no dashboard is active and seeding is disabled", async () => {
|
||||
const store = await createTestStore();
|
||||
|
||||
|
|
@ -69,3 +131,20 @@ async function createTestStore() {
|
|||
|
||||
return store;
|
||||
}
|
||||
|
||||
function olderDimensionLabSeed() {
|
||||
const document = structuredClone(dimensionLabDashboardFixture);
|
||||
document.statusStrips = document.statusStrips.map((strip) => ({
|
||||
...strip,
|
||||
items: strip.items.filter((item) => item.id !== "auto-refresh"),
|
||||
}));
|
||||
document.serviceGroups = document.serviceGroups.map((group) =>
|
||||
group.id === "ai-automation"
|
||||
? {
|
||||
...group,
|
||||
services: group.services.filter((service) => service.id !== "prompt-registry"),
|
||||
}
|
||||
: group,
|
||||
);
|
||||
return document;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue