feat: advance reasoning after comparability is resolved

This commit is contained in:
2026-08-02 17:06:34 +01:00
parent 7d408701b5
commit 25a989450c
9 changed files with 649 additions and 5 deletions
+64
View File
@@ -166,6 +166,40 @@ function makeUpdateSuccess(overrides = {}) {
resolvedUnknownNodeIds: ["n-unknown"],
previousActiveUnknownNodeId: "n-unknown",
newActiveUnknownNodeId: "n-next-unknown",
previousReasoningState: {
comparabilityStatus: "uncertain",
reasoningStages: [
{
stage: "comparability",
status: "uncertain",
outcome:
"Comparability between the observations is not yet established across period, scale, or measurement basis.",
},
{
stage: "relationship",
status: "insufficient_information",
outcome: "not assessed until comparability is established",
},
],
},
reasoningState: {
comparabilityStatus: "confirmed",
relationshipStatus: "insufficient_information",
reasoningStages: [
{
stage: "comparability",
status: "confirmed",
outcome:
"Comparability was confirmed by the user answer covering the same period and source basis.",
},
{
stage: "relationship",
status: "insufficient_information",
outcome:
"There is not enough structure to classify the relationship safely.",
},
],
},
changesApplied: {
updatedNodeCount: 2,
resolvedUnknownCount: 1,
@@ -458,6 +492,36 @@ describe("graph-backed UI rendering", () => {
);
});
it("update view shows comparability progression without raw ids in the normal view", () => {
const html = renderToStaticMarkup(
<GraphUpdateView
updateResult={{
...makeUpdateSuccess({
selectedQuestion: {
nodeId: "n-next-unknown",
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: "A broad follow-up is now justified.",
},
}),
previousSituationGraph: makeGraphResult().situationGraph,
}}
/>,
);
expect(html).toContain("Comparability:");
expect(html).toContain("uncertain → confirmed");
expect(html).toContain("Relationship status:");
expect(html).toContain("insufficient_information");
expect(html).toContain("Reasoning stages:");
expect(html).toContain("comparability: confirmed");
expect(html).toContain("relationship: insufficient_information");
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?",
);
expect(html).not.toContain("reasoning:comparability");
});
it("situation graph marks newly surfaced and active unknowns", () => {
const html = renderToStaticMarkup(
<SituationGraphView