fix: compact graph for interrupt demo beats

This commit is contained in:
lda
2026-07-09 03:56:29 +07:00 Verified
parent 6300d682ee
commit a0b5105b7c
2 changed files with 23 additions and 2 deletions
@@ -132,13 +132,13 @@ describe("DemoWorkflowScene", () => {
expect(screen.getByLabelText("workflow.runs.trace operation")).toBeInTheDocument(); expect(screen.getByLabelText("workflow.runs.trace operation")).toBeInTheDocument();
}); });
it("passes run proof into graph-heavy beats", () => { it("passes run proof into full graph beats", () => {
const { unmount } = renderBeat("graph"); const { unmount } = renderBeat("graph");
expect(screen.getByLabelText("workflow graph proof")).toHaveTextContent("run_recorded_lda_report"); expect(screen.getByLabelText("workflow graph proof")).toHaveTextContent("run_recorded_lda_report");
expect(screen.getByLabelText("workflow graph proof")).toHaveTextContent("5 workflow nodes"); expect(screen.getByLabelText("workflow graph proof")).toHaveTextContent("5 workflow nodes");
unmount(); unmount();
renderBeat("approval", "interrupt-evidence"); renderBeat("output", "interrupt-evidence");
expect(screen.getByLabelText("workflow graph proof")).toHaveTextContent("JSON-RPC evidence"); expect(screen.getByLabelText("workflow graph proof")).toHaveTextContent("JSON-RPC evidence");
}); });
@@ -164,6 +164,24 @@ describe("DemoWorkflowScene", () => {
expect(screen.getByLabelText("demo continuity")).toHaveTextContent("issue_review"); expect(screen.getByLabelText("demo continuity")).toHaveTextContent("issue_review");
}); });
it("uses compact graph context for interrupt-focused beats", () => {
const interrupt = renderBeat("interrupt");
expect(screen.getByLabelText("workflow graph")).toHaveAttribute("data-graph-variant", "compact");
interrupt.unmount();
renderBeat("approval", "interrupt-evidence");
expect(screen.getByLabelText("workflow graph")).toHaveAttribute("data-graph-variant", "compact");
});
it("keeps full graph mode for graph and output beats", () => {
const graph = renderBeat("graph");
expect(screen.getByLabelText("workflow graph")).toHaveAttribute("data-graph-variant", "full");
graph.unmount();
renderBeat("output", "interrupt-evidence");
expect(screen.getByLabelText("workflow graph")).toHaveAttribute("data-graph-variant", "full");
});
it("adds outcome proof to approval, resume, output, and trace beats", () => { it("adds outcome proof to approval, resume, output, and trace beats", () => {
const approval = renderBeat("approval", "interrupt-evidence"); const approval = renderBeat("approval", "interrupt-evidence");
expect(screen.getByLabelText("demo outcome proof")).toHaveTextContent("schema-backed"); expect(screen.getByLabelText("demo outcome proof")).toHaveTextContent("schema-backed");
@@ -62,6 +62,8 @@ export const DemoWorkflowScene = ({
// Presentation-only proof labels keep the graph tied to the recorded run // Presentation-only proof labels keep the graph tied to the recorded run
// without changing the canonical replay event payload. // without changing the canonical replay event payload.
const graphVariant = beat.id === "interrupt" || beat.id === "approval" ? "compact" : "full";
const runProof = { const runProof = {
runId: runStart?.resultingIds.runId ?? null, runId: runStart?.resultingIds.runId ?? null,
traceLabel: "5 workflow nodes", traceLabel: "5 workflow nodes",
@@ -113,6 +115,7 @@ export const DemoWorkflowScene = ({
selectedNodeId={selectedNodeId} selectedNodeId={selectedNodeId}
selectNode={selectNode} selectNode={selectNode}
proof={runProof} proof={runProof}
variant={graphVariant}
/> />
{contractMode && contract && ( {contractMode && contract && (
<InterruptContractPreview <InterruptContractPreview