fix(confidence-engine): project unexplained transitions
This commit is contained in:
@@ -269,6 +269,51 @@ describe("buildInitialGraph", () => {
|
||||
}));
|
||||
});
|
||||
|
||||
it("projects relationships referencing unexplained transition source IDs", () => {
|
||||
const reconstruction = {
|
||||
...makeReconstructionFixture(),
|
||||
observedStates: [
|
||||
{ id: "obs-rate", description: "Complaint rate is not yet known", confidence: "high" },
|
||||
],
|
||||
unexplainedTransitions: [
|
||||
{
|
||||
id: "ut-1",
|
||||
description: "Support wait time increased without an explanation",
|
||||
entity: "Support",
|
||||
previousState: "2 hours",
|
||||
currentState: "8 hours",
|
||||
confidence: "medium",
|
||||
},
|
||||
],
|
||||
relationships: [{
|
||||
id: "r-transition",
|
||||
fromId: "obs-rate",
|
||||
toId: "ut-1",
|
||||
relationship: "depends_on",
|
||||
description: "Understanding the rate depends on the unexplained transition.",
|
||||
confidence: "medium",
|
||||
}],
|
||||
};
|
||||
|
||||
const result = buildInitialGraph({ reconstruction, evidence: [] });
|
||||
const rateNode = result.nodes.find((node) => node.label === "Complaint rate is not yet known");
|
||||
const transitionNode = result.nodes.find(
|
||||
(node) => node.description === "Support wait time increased without an explanation",
|
||||
);
|
||||
|
||||
expect(transitionNode).toMatchObject({
|
||||
kind: "transition",
|
||||
status: "unknown",
|
||||
description: "Support wait time increased without an explanation",
|
||||
});
|
||||
expect(result.edges).toContainEqual(expect.objectContaining({
|
||||
id: "e-rel-r-transition",
|
||||
fromNodeId: rateNode.id,
|
||||
toNodeId: transitionNode.id,
|
||||
relationship: "depends_on",
|
||||
}));
|
||||
});
|
||||
|
||||
it("skips relationships with invalid source IDs without creating substitute nodes", () => {
|
||||
const reconstruction = {
|
||||
...makeReconstructionFixture(),
|
||||
|
||||
Reference in New Issue
Block a user