feat: evolve investigation into guided conversation

This commit is contained in:
2026-08-03 17:01:04 +01:00
parent 0dd15345e4
commit 7bc1c93486
4 changed files with 169 additions and 123 deletions
+55 -44
View File
@@ -885,7 +885,7 @@ describe("ReasoningWorkspace UI", () => {
expect(html).toContain("Complaints increased while production increased.");
});
it("shows current understanding section", () => {
it("shows what we've established section", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace
{...makeWorkspaceProps({
@@ -899,29 +899,20 @@ describe("ReasoningWorkspace UI", () => {
/>,
);
expect(html).toContain("Current understanding");
expect(html).toContain("What we&#x27;ve established");
expect(html).toContain("Nodes: 2 observation, 1 unknown");
});
it("shows current focus section with the active unknown", () => {
it("prominently displays the current investigation", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace {...makeWorkspaceProps()} />,
);
expect(html).toContain("What we are working out");
expect(html).toContain("Complaint rate denominator");
});
it("prominently displays the next question", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace {...makeWorkspaceProps()} />,
);
expect(html).toContain("Next question");
expect(html).toContain("Current investigation");
expect(html).toContain("What denominator is being used for the complaint rate?");
});
it("shows reasoning progress with plain language instead of unexplained count", () => {
it("shows confidence-building progress text", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace
{...makeWorkspaceProps({
@@ -935,11 +926,11 @@ describe("ReasoningWorkspace UI", () => {
/>,
);
expect(html).toContain("Reasoning progress");
expect(html).toContain("We are still building confidence about your situation");
expect(html).not.toContain("3 remaining");
});
it("explains areas that still need investigation in the progress card", () => {
it("explains areas that still need investigation in plain language", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace {...makeWorkspaceProps()} />,
);
@@ -980,7 +971,7 @@ describe("ReasoningWorkspace UI", () => {
<ReasoningWorkspace {...makeWorkspaceProps()} />,
);
expect(html).toContain("Your answer");
expect(html).toContain("Your response");
expect(html).toContain("Update situation");
});
@@ -1018,9 +1009,8 @@ describe("ReasoningWorkspace UI", () => {
// Labels and human-readable text should be present
expect(html).toContain("Your situation");
expect(html).toContain("Current understanding");
expect(html).toContain("What we are working out");
expect(html).toContain("Next question");
expect(html).toContain("What we&#x27;ve established");
expect(html).toContain("Current investigation");
expect(html).toContain("Complaint rate denominator");
// Raw node IDs only appear in developer details (collapsed), not in user-facing sections
@@ -1044,8 +1034,8 @@ describe("ReasoningWorkspace UI", () => {
<ReasoningWorkspace {...makeWorkspaceProps()} />,
);
expect(html).toContain("Reasoning progress");
expect(html).toContain("Current focus");
expect(html).not.toContain("Reasoning progress");
});
it("active unknown is shown in plain language, not raw IDs", () => {
@@ -1061,7 +1051,7 @@ describe("ReasoningWorkspace UI", () => {
expect(html).toContain("Developer details");
});
it("reasoning progress handles zero remaining gracefully", () => {
it("progress card handles zero remaining gracefully", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace
{...makeWorkspaceProps({
@@ -1075,7 +1065,7 @@ describe("ReasoningWorkspace UI", () => {
/>,
);
expect(html).toContain("Reasoning progress");
expect(html).toContain("All areas under investigation are now complete");
});
it("loading card appears immediately with spinner and heading", () => {
@@ -1099,7 +1089,7 @@ describe("ReasoningWorkspace UI", () => {
<ReasoningWorkspace {...makeWorkspaceProps()} />,
);
expect(html).toContain("Your answer");
expect(html).toContain("Your response");
expect(html).toContain("Update situation");
});
@@ -1159,23 +1149,7 @@ describe("ReasoningWorkspace UI", () => {
/>,
);
expect(html).toContain("There is no next question at the moment.");
});
it("initial loading state appears with spinner heading", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace
status="loading"
updateStatus="idle"
result={null}
answer=""
setAnswer={vi.fn()}
onAnswerSubmit={vi.fn()}
/>,
);
expect(html).toContain("Working through your situation");
expect(html).toContain("Reading your situation");
expect(html).toContain("fully investigated");
});
it("update loading state appears with spinner heading", () => {
@@ -1222,7 +1196,7 @@ describe("ReasoningWorkspace UI", () => {
// Should not show any result panels or workspace
expect(html).not.toContain("Your situation");
expect(html).not.toContain("Next question");
expect(html).not.toContain("Current investigation");
});
it("update error is visible", () => {
@@ -1263,7 +1237,7 @@ describe("ReasoningWorkspace UI", () => {
/>,
);
expect(html).not.toContain("Your answer");
expect(html).not.toContain("Your response");
expect(html).not.toContain("Update situation");
});
@@ -1487,7 +1461,7 @@ describe("ReasoningWorkspace UI", () => {
);
expect(html).not.toContain("Working through your situation");
expect(html).toContain("Next question");
expect(html).toContain("Current investigation");
expect(html).toContain("Update situation");
});
@@ -1542,4 +1516,41 @@ describe("ReasoningWorkspace UI", () => {
// No form controls remain during loading
expect(html).not.toContain("Update situation");
});
it("investigation complete message shows confident language when satisfied", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace
status="success"
updateStatus="idle"
result={makeWorkspaceResult({
selectedQuestion: null,
diagnostics: { ...makeWorkspaceResult().diagnostics, noQuestionReason: "All unknowns satisfied" },
})}
answer=""
setAnswer={vi.fn()}
onAnswerSubmit={vi.fn()}
/>,
);
expect(html).toContain("fully investigated");
expect(html).not.toContain("There is no next question at the moment");
});
it("investigation complete shows confidence-building fallback", () => {
const html = renderToStaticMarkup(
<ReasoningWorkspace
status="success"
updateStatus="idle"
result={makeWorkspaceResult({
selectedQuestion: null,
diagnostics: { ...makeWorkspaceResult().diagnostics, noQuestionReason: null },
})}
answer=""
setAnswer={vi.fn()}
onAnswerSubmit={vi.fn()}
/>,
);
expect(html).toContain("We have established enough for now");
});
});