feat: back next questions with explicit graph unknowns

This commit is contained in:
2026-08-02 19:03:07 +01:00
parent 25a989450c
commit b1c633ba5c
7 changed files with 310 additions and 40 deletions
+46 -18
View File
@@ -115,32 +115,46 @@ function makeUpdateSuccess(overrides = {}) {
},
{
id: "n-next-unknown",
label: "Commercial value definition",
description: "Need a definition because the decision depends on it.",
label:
"Explanation for why revenue increased by 18%, but cash in the bank fell over the same period",
description:
"Need to understand what change or event could explain why these observations differ, because that is needed to investigate their relationship.",
kind: "unknown",
status: "unknown",
confidence: "high",
confidence: "medium",
value: null,
unit: null,
},
],
edges: [],
edges: [
{
id: "e-rel-next",
fromNodeId: "n-conclusion",
toNodeId: "n-next-unknown",
relationship: "depends_on",
confidence: "medium",
description:
"This unresolved explanation arises from the now-assessed relationship between the observations.",
},
],
},
proposal: {
addedNodes: [
{
id: "n-next-unknown",
label: "Commercial value definition",
description: "Need a definition because the decision depends on it.",
label:
"Explanation for why revenue increased by 18%, but cash in the bank fell over the same period",
description:
"Need to understand what change or event could explain why these observations differ, because that is needed to investigate their relationship.",
kind: "unknown",
status: "unknown",
confidence: "high",
confidence: "medium",
value: null,
unit: null,
evidenceIds: [],
dependsOn: [],
dependsOn: ["n-conclusion"],
affects: [],
parentId: null,
parentId: "n-conclusion",
childIds: [],
},
],
@@ -153,19 +167,27 @@ function makeUpdateSuccess(overrides = {}) {
affectedNodeIds: ["n-conclusion"],
selectedQuestion: {
nodeId: "n-next-unknown",
question: "How should commercial value be defined for this decision?",
reason: "A narrower consequential uncertainty remains.",
question:
"What changed during that period that could help explain why revenue increased by 18%, but cash in the bank fell over the same period?",
reason:
"Formulated as a neutral clarification question because no narrower investigation strategy clearly applied.",
},
},
selectedQuestion: {
nodeId: "n-next-unknown",
question: "How should commercial value be defined for this decision?",
reason: "A narrower consequential uncertainty remains.",
question:
"What changed during that period that could help explain why revenue increased by 18%, but cash in the bank fell over the same period?",
reason:
"Formulated as a neutral clarification question because no narrower investigation strategy clearly applied.",
},
affectedNodeIds: ["n-conclusion"],
resolvedUnknownNodeIds: ["n-unknown"],
previousActiveUnknownNodeId: "n-unknown",
newActiveUnknownNodeId: "n-next-unknown",
emergentReasoningNodeCreated: true,
emergentReasoningNodeId: "n-next-unknown",
emergentReasoningNodeReason:
"Created a new unresolved reasoning unknown so the next justified question is backed by the graph.",
previousReasoningState: {
comparabilityStatus: "uncertain",
reasoningStages: [
@@ -404,7 +426,9 @@ describe("graph-backed UI rendering", () => {
);
expect(html).toContain("Newly surfaced unknowns");
expect(html).toContain("Commercial value definition");
expect(html).toContain(
"Explanation for why revenue increased by 18%, but cash in the bank fell over the same period",
);
});
it("affected nodes render", () => {
@@ -432,7 +456,7 @@ describe("graph-backed UI rendering", () => {
);
expect(html).toContain(
"How should commercial value be defined for this decision?",
"What changed during that period that could help explain why revenue increased by 18%, but cash in the bank fell over the same period?",
);
});
@@ -469,7 +493,9 @@ describe("graph-backed UI rendering", () => {
expect(html).toContain("Previous active unknown");
expect(html).toContain("Complaint rate denominator");
expect(html).toContain("New active unknown");
expect(html).toContain("Commercial value definition");
expect(html).toContain(
"Explanation for why revenue increased by 18%, but cash in the bank fell over the same period",
);
});
it("successful update renders prior and new state together", () => {
@@ -488,7 +514,7 @@ describe("graph-backed UI rendering", () => {
expect(html).toContain("New active unknown");
expect(html).toContain("Next question");
expect(html).toContain(
"How should commercial value be defined for this decision?",
"What changed during that period that could help explain why revenue increased by 18%, but cash in the bank fell over the same period?",
);
});
@@ -543,7 +569,9 @@ describe("graph-backed UI rendering", () => {
/>,
);
expect(html).toContain("How should commercial value be defined for this decision?");
expect(html).toContain(
"What changed during that period that could help explain why revenue increased by 18%, but cash in the bank fell over the same period?",
);
});
it("raw ids remain only in collapsed proposal details", () => {