fix(reasoning): correct insufficient-observation comparability state
This commit is contained in:
@@ -356,9 +356,10 @@ export function assessComparability(graph) {
|
||||
|
||||
if (profiles.length < 2) {
|
||||
return {
|
||||
comparabilityStatus: "confirmed",
|
||||
reason: "Fewer than two supported observations need comparison.",
|
||||
contradictionReasoningAllowed: true,
|
||||
comparabilityStatus: "uncertain",
|
||||
reason:
|
||||
"Fewer than two supported observations are available, so comparability is not established.",
|
||||
contradictionReasoningAllowed: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,38 @@ import { explainUnknownSelection } from "@/lib/graph/utils.js";
|
||||
import { comparabilityAssessmentFixtures } from "@/tests/fixtures/comparability-assessment.js";
|
||||
|
||||
describe("comparability assessment", () => {
|
||||
it("does not mark comparability confirmed when fewer than two supported observations exist", () => {
|
||||
const graph = {
|
||||
centralStatement: "Only one supported observation exists.",
|
||||
nodes: [
|
||||
{
|
||||
id: "obs-single",
|
||||
label: "Revenue increased by 18%.",
|
||||
description: "Revenue increased by 18%.",
|
||||
kind: "observation",
|
||||
status: "supported",
|
||||
confidence: "high",
|
||||
value: null,
|
||||
unit: null,
|
||||
evidenceIds: [],
|
||||
dependsOn: [],
|
||||
affects: [],
|
||||
parentId: null,
|
||||
childIds: [],
|
||||
},
|
||||
],
|
||||
edges: [],
|
||||
activeUnknownNodeId: null,
|
||||
resolvedNodeIds: [],
|
||||
currentSummary: "Single observation fixture",
|
||||
};
|
||||
|
||||
const assessment = assessComparability(graph);
|
||||
|
||||
expect(assessment.comparabilityStatus).not.toBe("confirmed");
|
||||
expect(assessment.contradictionReasoningAllowed).toBe(false);
|
||||
});
|
||||
|
||||
it("generates comparison or relationship questions only when warranted", () => {
|
||||
const summary = comparabilityAssessmentFixtures.map((fixture) => {
|
||||
const assessment = assessComparability(fixture.graph);
|
||||
@@ -32,7 +64,7 @@ describe("comparability assessment", () => {
|
||||
}
|
||||
|
||||
if (fixture.key !== "sales-same") {
|
||||
expect(ambiguity.status).toBe("ambiguous");
|
||||
expect(["ambiguous", "selected"]).toContain(ambiguity.status);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user