fix: keep demo run facts strictly factual
This commit is contained in:
@@ -166,10 +166,32 @@ describe("RunOutputFacts", () => {
|
|||||||
|
|
||||||
expect(screen.getByText("ISSUE-001")).toBeDefined();
|
expect(screen.getByText("ISSUE-001")).toBeDefined();
|
||||||
expect(screen.getByText("local://issue-board/ISSUE-001")).toBeDefined();
|
expect(screen.getByText("local://issue-board/ISSUE-001")).toBeDefined();
|
||||||
expect(screen.getByText("Create the selected issue.")).toBeDefined();
|
|
||||||
expect(screen.getByRole("region", { name: /workflow markdown output/i })).toBeInTheDocument();
|
expect(screen.getByRole("region", { name: /workflow markdown output/i })).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not render a null output comment as a fake fact", () => {
|
||||||
|
const createdFacts = makeCreatedFacts("# Report");
|
||||||
|
if (createdFacts.output.state !== "created") {
|
||||||
|
throw new Error("Expected created output facts");
|
||||||
|
}
|
||||||
|
|
||||||
|
render(
|
||||||
|
<RunOutputFacts
|
||||||
|
facts={{
|
||||||
|
...createdFacts,
|
||||||
|
output: {
|
||||||
|
...createdFacts.output,
|
||||||
|
output: { ...createdFacts.output.output, comment: null },
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
priority="report"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(screen.queryByText("Comment")).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("none")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
it("renders output report as the primary scroll region", () => {
|
it("renders output report as the primary scroll region", () => {
|
||||||
const createdFacts = makeCreatedFacts("# Report\n\n" + "body\n".repeat(40));
|
const createdFacts = makeCreatedFacts("# Report\n\n" + "body\n".repeat(40));
|
||||||
|
|
||||||
@@ -232,7 +254,6 @@ describe("RunTraceFacts", () => {
|
|||||||
|
|
||||||
expect(screen.getByText("list_documents")).toBeDefined();
|
expect(screen.getByText("list_documents")).toBeDefined();
|
||||||
expect(screen.getByText("review_issues")).toBeDefined();
|
expect(screen.getByText("review_issues")).toBeDefined();
|
||||||
expect(screen.getByText("2 captured")).toBeInTheDocument();
|
|
||||||
expect(screen.getAllByText("captured as empty object").length).toBeGreaterThanOrEqual(2);
|
expect(screen.getAllByText("captured as empty object").length).toBeGreaterThanOrEqual(2);
|
||||||
expect(screen.getAllByText("Resolved input").length).toBe(2);
|
expect(screen.getAllByText("Resolved input").length).toBe(2);
|
||||||
expect(screen.getAllByText("captured as empty object")[0]!.closest(".run-trace-frame__fact")).toHaveAttribute(
|
expect(screen.getAllByText("captured as empty object")[0]!.closest(".run-trace-frame__fact")).toHaveAttribute(
|
||||||
@@ -241,6 +262,19 @@ describe("RunTraceFacts", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not summarize trace evidence with a frame count", () => {
|
||||||
|
render(<RunTraceFacts facts={makeTraceFacts(3)} />);
|
||||||
|
|
||||||
|
expect(screen.getByRole("heading", { name: "Recorded execution trace" })).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText(/trace frames.*captured/i)).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses an honest empty state when no trace entries are available", () => {
|
||||||
|
render(<RunTraceFacts facts={baseFacts} />);
|
||||||
|
|
||||||
|
expect(screen.getByText("No trace entries recorded for this view.")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
it("renders trace frames inside a scrollable list", () => {
|
it("renders trace frames inside a scrollable list", () => {
|
||||||
const traceFacts = makeTraceFacts(8);
|
const traceFacts = makeTraceFacts(8);
|
||||||
|
|
||||||
|
|||||||
@@ -121,8 +121,6 @@ export const RunOutputFacts = ({ facts, priority = "summary" }: RunOutputFactsPr
|
|||||||
</dd>
|
</dd>
|
||||||
<dt>Selected issue IDs</dt>
|
<dt>Selected issue IDs</dt>
|
||||||
<dd>{facts.output.output.selected_issue_ids.join(", ")}</dd>
|
<dd>{facts.output.output.selected_issue_ids.join(", ")}</dd>
|
||||||
<dt>Comment</dt>
|
|
||||||
<dd>{facts.output.output.comment ?? "none"}</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
{priority === "report" ? (
|
{priority === "report" ? (
|
||||||
<div className="run-facts-scroll-region run-facts-scroll-region--markdown" role="region" aria-label="workflow markdown output">
|
<div className="run-facts-scroll-region run-facts-scroll-region--markdown" role="region" aria-label="workflow markdown output">
|
||||||
@@ -147,11 +145,9 @@ const TraceFact = ({ label, value }: { readonly label: string; readonly value: s
|
|||||||
|
|
||||||
export const RunTraceFacts = ({ facts }: RunTraceFactsProps) => (
|
export const RunTraceFacts = ({ facts }: RunTraceFactsProps) => (
|
||||||
<div className="run-facts-card run-trace-facts" role="region" aria-label="workflow trace proof">
|
<div className="run-facts-card run-trace-facts" role="region" aria-label="workflow trace proof">
|
||||||
<h3>
|
<h3>Recorded execution trace</h3>
|
||||||
Trace frames <span className="run-facts-count">{facts.trace.frames.length} captured</span>
|
|
||||||
</h3>
|
|
||||||
{facts.trace.frames.length === 0 ? (
|
{facts.trace.frames.length === 0 ? (
|
||||||
<p>No trace frames captured.</p>
|
<p>No trace entries recorded for this view.</p>
|
||||||
) : (
|
) : (
|
||||||
<div className="run-facts-scroll-region run-facts-scroll-region--trace" role="region" aria-label="workflow trace frames">
|
<div className="run-facts-scroll-region run-facts-scroll-region--trace" role="region" aria-label="workflow trace frames">
|
||||||
<ul className="run-facts-list">
|
<ul className="run-facts-list">
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ describe("demo-run-facts", () => {
|
|||||||
const facts = projectDemoRunFacts(controller());
|
const facts = projectDemoRunFacts(controller());
|
||||||
expect(facts.output.state).toBe("not-created");
|
expect(facts.output.state).toBe("not-created");
|
||||||
if (facts.output.state === "not-created") {
|
if (facts.output.state === "not-created") {
|
||||||
expect(facts.output.message).toBe("Output not created yet");
|
expect(facts.output.message).toBe("No report output has been produced for this run.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ const readOutputFacts = (
|
|||||||
|
|
||||||
const output = parseReportOutput(resumeInterpreted?.["output"] ?? completedInterpreted?.["output"]);
|
const output = parseReportOutput(resumeInterpreted?.["output"] ?? completedInterpreted?.["output"]);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
return { state: "not-created", message: "Output not created yet" };
|
return { state: "not-created", message: "No report output has been produced for this run." };
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
state: "created",
|
state: "created",
|
||||||
|
|||||||
Reference in New Issue
Block a user