feat(pi-workflow): add human-readable run labels
This commit is contained in:
@@ -134,6 +134,44 @@ test("focused dashboard renders compact and narrow cards within width", () => {
|
||||
assert.equal(selected, "run-1");
|
||||
});
|
||||
|
||||
test("dashboard disambiguates duplicate feature labels without changing selection IDs", () => {
|
||||
let selected: string | null | undefined;
|
||||
const dashboard = new FocusedWorkflowDashboard(
|
||||
[
|
||||
run({ runId: "12345678-aaaa", featureName: "search-page" }),
|
||||
run({ runId: "12345678-bbbb", featureName: "search-page" }),
|
||||
],
|
||||
theme,
|
||||
(value) => { selected = value; },
|
||||
);
|
||||
const lines = dashboard.render(100);
|
||||
assert.ok(lines.some((line) => line.includes("search-page · 12345678-a")));
|
||||
assert.ok(lines.some((line) => line.includes("search-page · 12345678-b")));
|
||||
dashboard.handleInput("\r");
|
||||
dashboard.handleInput("\r");
|
||||
assert.equal(selected, "12345678-aaaa");
|
||||
});
|
||||
|
||||
test("dashboard disambiguates collisions outside its visible window at common widths", () => {
|
||||
const runs = Array.from({ length: 30 }, (_, index) =>
|
||||
run({
|
||||
runId:
|
||||
index === 0
|
||||
? "12345678-aaaa"
|
||||
: index === 29
|
||||
? "12345678-bbbb"
|
||||
: `run-${index}`,
|
||||
featureName: index === 0 || index === 29 ? "shared-label" : `feature-${index}`,
|
||||
}),
|
||||
);
|
||||
const dashboard = new FocusedWorkflowDashboard(runs, theme, () => {});
|
||||
for (const width of [80, 60]) {
|
||||
const lines = dashboard.render(width);
|
||||
assert.ok(lines.some((line) => line.includes("shared-label · 12345678-a")));
|
||||
assert.ok(lines.every((line) => visibleWidth(line) <= width));
|
||||
}
|
||||
});
|
||||
|
||||
test("dashboard windows long-lived session run lists", () => {
|
||||
const runs = Array.from({ length: 30 }, (_, index) =>
|
||||
run({ runId: `run-${index}`, featureName: `feature-${index}` }),
|
||||
@@ -339,6 +377,34 @@ test("dashboard verifies and opens Assignment transcripts on demand", async () =
|
||||
}
|
||||
});
|
||||
|
||||
test("dashboard reports the supplied run ID when direct inspection cannot resolve it", async () => {
|
||||
const notifications: string[] = [];
|
||||
const ctx = {
|
||||
hasUI: true,
|
||||
mode: "tui",
|
||||
sessionManager: { getSessionId: () => "session-1" },
|
||||
ui: {
|
||||
custom: async () => {
|
||||
throw new Error("missing runs must not open the dashboard");
|
||||
},
|
||||
notify: (message: string) => notifications.push(message),
|
||||
},
|
||||
} as unknown as ExtensionCommandContext;
|
||||
const result = await openWorkflowDashboard(
|
||||
{ getActiveTools: () => ["read"] } as unknown as ExtensionAPI,
|
||||
{
|
||||
store: { listRuns: async () => [run()] } as never,
|
||||
engineForContext: () => Promise.reject(new Error("unused")),
|
||||
},
|
||||
ctx,
|
||||
"missing-run-id",
|
||||
);
|
||||
assert.deepEqual(result, {});
|
||||
assert.deepEqual(notifications, [
|
||||
"Workflow Run missing-run-id was not found for this session.",
|
||||
]);
|
||||
});
|
||||
|
||||
test("dashboard exposes continuation only for pending handoff intents", async () => {
|
||||
const workflow = run({
|
||||
planArtifact: { path: "/state/plan.md", revision: 3, digest: "digest" },
|
||||
|
||||
Reference in New Issue
Block a user