fix(confidence-engine): simplify active follow-up presentation

This commit is contained in:
2026-08-30 08:51:18 +01:00
parent 8bded90094
commit ae1201bb27
3 changed files with 121 additions and 19 deletions
@@ -2195,5 +2195,59 @@ describe("v0.49 RENDERED — in-place follow-up context ownership", () => {
const prevLearningHeadings = screen.queryAllByText(/previous learning/i);
expect(prevLearningHeadings).toHaveLength(1);
});
// ── v0.49 REGRESSION: selected follow-up must not render twice ──
it("v0.49 regression: selected follow-up renders exactly once, no '(current question)' duplicate", () => {
const turn1Q = "Completed question?";
const turn1A = "Complete answer.";
// Q3 completed with raised follow-up Q4
const contribs = [
makeContrib(turn1Q, turn1A, 1),
];
// After setFollowUpQuestion: focused.question === "Q4", possibleFollowUpQuestions = ["Q4"], hasActiveFollowUp = true
render(
<div style={{ display: "grid", gridTemplateColumns: "1fr 1fr" }}>
<FocusedQuestionBody
nodeId="node-test"
isFocused={true}
hasContent={true}
processingStep="idle"
formulationStep="active"
deconstructMsg=""
focusedAnswer=""
setFocusedAnswer={() => {}}
handleDeconstructSubmit={() => {}}
retryFormulation={() => {}}
setFollowUpQuestion={() => {}}
focused={
{
question: "Q4",
answer: null,
status: "formulated",
result: {
observations: ["finding"],
uncertainties: [],
possibleFollowUpQuestions: ["Q4"],
assumptions: [],
relationships: [],
},
error: null,
}
}
focusedContributions={contribs}
/>
</div>,
);
// The selected follow-up text should appear exactly once (in the active block), not duplicated in candidate row.
const q4Text = screen.getAllByText("Q4");
expect(q4Text).toHaveLength(1);
// After selection, "(current question)" label must NOT be rendered — the active form communicates selection unambiguously.
const currentQuestionLabels = screen.queryAllByText(/\(current question\)/i);
expect(currentQuestionLabels).toHaveLength(0);
});
});
});