feat: add one-turn situation graph update UI

This commit is contained in:
2026-08-02 09:43:42 +01:00
parent a948910ba8
commit a9bce79658
11 changed files with 901 additions and 42 deletions
+54
View File
@@ -280,6 +280,60 @@ describe("applyValidatedProposal", () => {
expect(result.updatedSituationGraph.resolvedNodeIds).toContain(
ids.complaintRateUnknown,
);
expect(
result.updatedSituationGraph.nodes.find(
(node) => node.id === ids.complaintRateUnknown,
)?.status,
).toBe("resolved");
});
it("rejects resolvedUnknownNodeIds that do not reference actual unknown nodes", () => {
const { graph, proposal, ids } = makeApplicationFixture();
const result = applyValidatedProposal({
situationGraph: graph,
proposal: {
...proposal,
resolvedUnknownNodeIds: [ids.qualityDeterioration],
},
});
expect(result.success).toBe(false);
expect(result.stage).toBe("proposal_compatibility");
expect(result.errors.join(" ")).toContain(
"Resolved unknown must reference an existing unknown node",
);
});
it("rejects a duplicate semantic node without resolution", () => {
const { graph, proposal } = makeApplicationFixture();
const result = applyValidatedProposal({
situationGraph: graph,
proposal: {
...proposal,
resolvedUnknownNodeIds: [],
updatedNodes: proposal.updatedNodes.filter(
(update) => update.nodeId !== "n-complaint-rate-unknown",
),
addedNodes: [
makeNode({
id: "n-parallel-rate",
label: "Complaint rate",
description: "Need the complaint rate per 100 units",
kind: "observation",
status: "supported",
confidence: "medium",
}),
],
},
});
expect(result.success).toBe(false);
expect(result.stage).toBe("proposal_compatibility");
expect(result.errors.join(" ")).toContain(
"duplicating unresolved unknown meaning",
);
});
it("keeps the active unknown when it remains unresolved", () => {