fix(reasoning): narrow decision audience question routing

This commit is contained in:
2026-08-13 16:58:32 +01:00
parent ea7f227974
commit 8cca70774c
2 changed files with 188 additions and 10 deletions
+140
View File
@@ -302,6 +302,146 @@ describe("formulateQuestion", () => {
);
});
it("60B.21 signing-status node does not route to decision_audience and preserves the proposition", () => {
const unknown = makeNode({
id: "n-customer-signing-status",
label: "Prospective enterprise customer signing status",
description:
"Uncertainty about whether the prospective enterprise customer will sign if we launch this year, so that its resolution is needed to decide which timing option provides superior net value.",
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.questionFamily).not.toBe("decision_foundation");
expect(result.selectedQuestionTemplate).not.toBe("decision_audience");
expect(result.question.toLowerCase()).toContain(
"whether the prospective enterprise customer will sign if we launch this year",
);
expect(result.question.toLowerCase()).not.toContain(
"relevant customer, user, or value recipient",
);
});
it("legitimate audience identity unknown still routes to decision_audience", () => {
const unknown = makeNode({
id: "n-target-customer",
label: "Who is the target customer?",
description:
"Need to know who the target customer is before continuing development.",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const graph = makeGraphFor(unknown, {
centralStatement:
"Before investing more, we need to know whether continuing development is commercially justified.",
});
const result = formulateQuestion({ node: unknown, graph });
expect(result.questionFamily).toBe("decision_foundation");
expect(result.selectedQuestionTemplate).toBe("decision_audience");
expect(result.question).toBe("Who experiences this problem?");
});
it("customer as proposition subject does not imply audience family", () => {
const unknown = makeNode({
id: "n-customer-renewal",
label: "Customer renewal likelihood",
description:
"Uncertainty about whether the customer will renew next year, because that affects the decision.",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const result = formulateQuestion({
node: unknown,
graph: makeGraphFor(unknown),
});
expect(result.selectedQuestionTemplate).not.toBe("decision_audience");
expect(result.question.toLowerCase()).toContain(
"whether the customer will renew next year",
);
});
it("user as proposition subject does not imply audience family", () => {
const unknown = makeNode({
id: "n-user-adoption",
label: "User adoption uncertainty",
description:
"Uncertainty about whether users will adopt the change, because that affects the decision.",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const result = formulateQuestion({
node: unknown,
graph: makeGraphFor(unknown),
});
expect(result.selectedQuestionTemplate).not.toBe("decision_audience");
expect(result.question.toLowerCase()).toContain(
"whether users will adopt the change",
);
});
it("buyer or stakeholder lexical mentions do not automatically trigger audience discovery", () => {
const unknown = makeNode({
id: "n-stakeholder-approval",
label: "Stakeholder approval uncertainty",
description:
"Uncertainty about whether the stakeholder will approve the plan, because that affects the decision.",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const result = formulateQuestion({
node: unknown,
graph: makeGraphFor(unknown),
});
expect(result.selectedQuestionTemplate).not.toBe("decision_audience");
expect(result.question.toLowerCase()).toContain(
"whether the stakeholder will approve the plan",
);
});
it("existing direct interrogative decision behaviour is preserved", () => {
const unknown = makeNode({
id: "n-client-leave",
label: "Will our largest client leave if we relocate?",
description:
"Uncertainty regarding whether our largest client would depart following a relocation to Manchester; matters because their departure would cost approximately £5M per year.",
kind: "unknown",
status: "unknown",
confidence: "medium",
});
const graph = makeGraphFor(unknown, {
centralStatement:
"We need to decide whether relocating is commercially justified.",
});
const result = formulateQuestion({ node: unknown, graph });
expect(result.question.toLowerCase()).toBe(
"will our largest client leave if we relocate?",
);
});
it("evidence-resolvable competing-cause unknown stays on an evidence route rather than neutral clarification", () => {
const unknown = makeNode({
id: "n-delivery-cause",