mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
Server changes:
- Add /boards/runs to demo routes (delegates to list_runs)
- Fix demo get_run_status to return StoreRunSummary shape matching OpenAPI spec
- Enrich real /boards/runs to return RunListItem shape with board column mapping
(Running->working, Paused->pending, Completed->merge; others excluded)
- Update existing tests that asserted old RunStatusResponse fields from /boards/runs
Web UI changes:
- Add DemoModeProvider context and useDemoMode hook
- Hide Workflows/Insights nav items in production mode via getVisibleNavigation
- Change run-detail loader to use /runs/{id} directly instead of searching /boards/runs
- Add mapRunSummaryToRunItem for mapping server response to UI shape
- Add Graph tab, hide Stages tab in production mode, always hide Files tab
- Make run-overview and run-graph loaders resilient to 501 via apiJsonOrNull
- Add isNotImplemented and apiJsonOrNull helpers to api.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { mapRunSummaryToRunItem } from "./runs";
|
|
|
|
describe("mapRunSummaryToRunItem", () => {
|
|
test("maps store run summary to RunItem", () => {
|
|
const summary = {
|
|
run_id: "01ABC",
|
|
goal: "Fix the build",
|
|
workflow_slug: "fix_build",
|
|
workflow_name: "Fix Build",
|
|
host_repo_path: "/home/user/myrepo",
|
|
status: "running",
|
|
duration_ms: 65000,
|
|
total_usd_micros: 500000,
|
|
labels: {},
|
|
start_time: "2026-04-08T12:00:00Z",
|
|
status_reason: null,
|
|
pending_control: null,
|
|
};
|
|
const item = mapRunSummaryToRunItem(summary);
|
|
expect(item.id).toBe("01ABC");
|
|
expect(item.title).toBe("Fix the build");
|
|
expect(item.workflow).toBe("fix_build");
|
|
expect(item.repo).toBe("myrepo");
|
|
expect(item.elapsed).toBeDefined();
|
|
});
|
|
|
|
test("handles missing optional fields", () => {
|
|
const summary = {
|
|
run_id: "01DEF",
|
|
goal: null,
|
|
workflow_slug: null,
|
|
workflow_name: null,
|
|
host_repo_path: null,
|
|
status: "submitted",
|
|
duration_ms: null,
|
|
total_usd_micros: null,
|
|
labels: {},
|
|
start_time: null,
|
|
status_reason: null,
|
|
pending_control: null,
|
|
};
|
|
const item = mapRunSummaryToRunItem(summary);
|
|
expect(item.id).toBe("01DEF");
|
|
expect(item.title).toBe("Untitled run");
|
|
expect(item.workflow).toBe("unknown");
|
|
expect(item.repo).toBe("unknown");
|
|
});
|
|
});
|