feat(confidence-engine): tighten focused relationship attribution

This commit is contained in:
2026-08-26 07:56:27 +01:00
parent 3ca37b0918
commit 42a7e82d88
2 changed files with 47 additions and 1 deletions
@@ -118,6 +118,52 @@ describe("buildFocusedDeconstructPrompt", () => {
});
});
describe("buildFocusedDeconstructPrompt — relationship rule boundary lock", () => {
it("relationship instruction explicitly prohibits observation restatement", () => {
const prompt = buildFocusedDeconstructPrompt({
targetLabel: "X",
targetDescription: "Y",
centralStatement: "Z",
question: "Q?",
answer: "A.",
});
expect(prompt).toContain("Do not create a relationship by merely restating");
});
it("relationship instruction explicitly prohibits promotion of tentative/conditional meaning", () => {
const prompt = buildFocusedDeconstructPrompt({
targetLabel: "X",
targetDescription: "Y",
centralStatement: "Z",
question: "Q?",
answer: "A.",
});
expect(prompt).toContain("Tentative, speculative, or conditional language must not be promoted into an established relationship");
});
it("relationship instruction requires direct link between two distinct propositions", () => {
const prompt = buildFocusedDeconstructPrompt({
targetLabel: "X",
targetDescription: "Y",
centralStatement: "Z",
question: "Q?",
answer: "A.",
});
expect(prompt).toContain("must connect two distinct propositions that the user's answer itself links");
});
it("relationship instruction explicitly permits relationships: [] when no direct link exists", () => {
const prompt = buildFocusedDeconstructPrompt({
targetLabel: "X",
targetDescription: "Y",
centralStatement: "Z",
question: "Q?",
answer: "A.",
});
expect(prompt).toContain("relationships: []");
});
});
describe("validateFocusedDeconstructSchema", () => {
it("passes when all required fields are present", () => {
const result = { targetNodeId: "a", observations: [], uncertainties: [], assumptions: [], relationships: [], possibleFollowUpQuestions: [] };