fix: continue question selection after graph updates

This commit is contained in:
2026-08-03 11:28:49 +01:00
parent b00928d6fb
commit 3e2edd2edc
7 changed files with 509 additions and 2 deletions
+100
View File
@@ -275,6 +275,94 @@ function makeUpdateSuccess(overrides = {}) {
};
}
function makeCommercialUpdateSuccess(overrides = {}) {
return {
success: true,
stage: "update_applied",
updatedSituationGraph: {
centralStatement:
"I have developed a new reasoning method that aims to help people determine whether they have enough justified confidence to make a decision. I believe it could become a commercial product, but I do not yet know whether it solves a genuine problem, whether people would value it enough to pay for it, or whether it is fundamentally different from existing AI tools. Before investing significant time and money into building it further, I want to determine whether continuing development is commercially justified.",
currentSummary: "Commercial update summary",
activeUnknownNodeId: "n-other-people",
resolvedNodeIds: ["n-who"],
nodes: [
{
id: "n-commercial-parent",
label:
"Commercial justification for whether continuing development is commercially justified",
description:
"Need to know whether this solves a genuine problem, whether people would value it enough to pay for it, and whether it is commercially justified before continuing development.",
kind: "unknown",
status: "provisional",
confidence: "medium",
},
{
id: "n-who",
label: "Who experiences this problem",
description:
"Need to know who experiences this problem, because that must be clear before deciding whether it is commercially justified.",
kind: "unknown",
status: "resolved",
confidence: "medium",
value:
"I experience it myself when I am trying to decide whether a project, idea or investment is justified, but I do not yet know how common that problem is for other people.",
parentId: "n-commercial-parent",
},
{
id: "n-other-people",
label: "Whether other people experience this problem",
description:
"Need to know whether other people experience this problem, because that must be established before deciding whether the problem is broadly important.",
kind: "unknown",
status: "unknown",
confidence: "medium",
parentId: "n-commercial-parent",
},
],
edges: [
{
id: "e-other-parent",
fromNodeId: "n-other-people",
toNodeId: "n-commercial-parent",
relationship: "depends_on",
confidence: "medium",
description:
"This child unknown must be investigated before the broader parent explanation can be resolved.",
},
],
},
proposal: {
addedNodes: [],
updatedNodes: [{ nodeId: "n-who", newStatus: "resolved", reason: "answered" }],
addedEdges: [],
removedEdgeIds: [],
resolvedUnknownNodeIds: ["n-who"],
affectedNodeIds: ["n-commercial-parent"],
selectedQuestion: null,
},
selectedQuestion: {
nodeId: "n-other-people",
question: "What makes you think other people experience this problem too?",
reason:
"Formulated as a direct foundational question because this child unknown should be answered one step at a time.",
reasoningPattern: "decision",
questionFamily: "decision_foundation",
},
previousActiveUnknownNodeId: "n-who",
newActiveUnknownNodeId: "n-other-people",
affectedNodeIds: ["n-commercial-parent"],
resolvedUnknownNodeIds: ["n-who"],
diagnostics: {
unresolvedCandidateCount: 2,
eligibleCandidateCount: 1,
candidateNodeIds: ["n-other-people"],
resolvedCurrentTurnNodeIds: ["n-who"],
noQuestionReason: null,
},
...overrides,
};
}
describe("scenario-form UI helpers", () => {
it("submits to /api/cases/start", async () => {
const fetchImpl = vi.fn().mockResolvedValue({ ok: true });
@@ -700,4 +788,16 @@ describe("graph-backed UI rendering", () => {
expect(html).toContain("Proposal details");
});
it("does not show the no-question fallback when a commercial follow-up sibling exists", () => {
const html = renderToStaticMarkup(
<GraphUpdateView updateResult={makeCommercialUpdateSuccess()} />,
);
expect(html).toContain(
"What makes you think other people experience this problem too?",
);
expect(html).toContain("New active unknown");
expect(html).not.toContain("No next question selected yet.");
});
});