fix(reasoning): clean proposition question formulation

This commit is contained in:
2026-08-13 17:45:28 +01:00
parent 4a434bb939
commit f955b875af
2 changed files with 138 additions and 15 deletions
+94
View File
@@ -442,6 +442,100 @@ describe("formulateQuestion", () => {
);
});
it("60B.24 regression strips whether-rationale and uses evidence framing without mutating the source node", () => {
const description =
"Whether one prospective enterprise customer will sign if we launch this year; they account for ~£700k of the £1.2M expected annual revenue, so that resolving their intent is needed to assess the financial impact of launching now.";
const unknown = makeNode({
id: "n-60b24-signing-status",
label: "Prospective enterprise customer signing status",
description,
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const graph = makeGraphFor(unknown, {
centralStatement:
"We need to decide which launch timing option provides superior net value.",
});
const result = formulateQuestion({ node: unknown, graph });
expect(result.question).toContain(
"whether one prospective enterprise customer will sign if we launch this year",
);
expect(result.question).toContain("What evidence would clarify");
expect(result.question).not.toContain("£700k");
expect(result.question).not.toContain("£1.2M");
expect(result.question).not.toContain("resolving their intent");
expect(result.question).not.toContain("financial impact");
expect(unknown.description).toBe(description);
});
it("clean whether proposition uses evidence framing rather than a direct whether-question", () => {
const unknown = makeNode({
id: "n-supplier-renewal",
label: "Supplier renewal likelihood",
description: "Whether the supplier will renew the contract.",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const result = formulateQuestion({
node: unknown,
graph: makeGraphFor(unknown),
});
expect(result.question).toBe(
"What evidence would clarify whether the supplier will renew the contract?",
);
expect(result.question).not.toBe(
"Whether the supplier will renew the contract?",
);
});
it("wh-question remains unchanged", () => {
const unknown = makeNode({
id: "n-wh-question",
label: "What would change the preferred option?",
description: "What would change the preferred option?",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const result = formulateQuestion({
node: unknown,
graph: makeGraphFor(unknown),
});
expect(result.question).toBe("What would change the preferred option?");
});
it("non-whether semicolon content is not globally truncated", () => {
const unknown = makeNode({
id: "n-semicolon-baseline",
label:
"Unknown baseline measurement basis; current and previous figures were prepared differently.",
description:
"Baseline measurement basis; current and previous figures were prepared differently.",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const result = formulateQuestion({
node: unknown,
graph: makeGraphFor(unknown),
});
expect(result.question).toContain(
"baseline measurement basis; current and previous figures were prepared differently",
);
expect(result.question).not.toContain("What would clarify whether");
});
it("evidence-resolvable competing-cause unknown stays on an evidence route rather than neutral clarification", () => {
const unknown = makeNode({
id: "n-delivery-cause",