reasoning: require structural progress for supported meaning

This commit is contained in:
2026-08-11 12:32:03 +01:00
parent 3b868b266e
commit 6adcd817e1
4 changed files with 244 additions and 2 deletions
+49
View File
@@ -129,3 +129,52 @@ describe("buildGraphUpdatePrompt", () => {
);
});
});
// ── Semantic-to-mutation contract (57J.39) ──────────────
describe("buildGraphUpdatePrompt — semantic-to-mutation MUST rule", () => {
it("contains the explicit structural-materialization MUST rule", () => {
const prompt = buildGraphUpdatePrompt(makeContext());
expect(prompt).toContain("MUST express its effect through structural mutation");
});
it("rule permits update/refine of existing structure", () => {
const prompt = buildGraphUpdatePrompt(makeContext());
expect(prompt).toContain("update/refinement of existing structure");
});
it("rule permits resolving an existing unknown", () => {
const prompt = buildGraphUpdatePrompt(makeContext());
expect(prompt).toContain("resolution of an existing unknown");
});
it("rule permits genuinely new unknown when needed", () => {
const prompt = buildGraphUpdatePrompt(makeContext());
expect(prompt).toContain("a genuinely new unknown");
});
it("rule explicitly states answerMeaning alone is not sufficient", () => {
const prompt = buildGraphUpdatePrompt(makeContext());
expect(prompt).toContain("answerMeaning alone is not sufficient");
});
it("rule does NOT force adding a new node", () => {
const prompt = buildGraphUpdatePrompt(makeContext());
// The rule should be silent about forcing new nodes — this is preserved by existing rule #7.
// Verify the MUST rule exists but doesn't contain "must add a new node" or similar.
const mustRuleMatch = prompt.match(
/6\..*?(?=\n7\.)/s,
);
expect(mustRuleMatch).not.toBe(null);
expect(mustRuleMatch[0]).not.toContain("must add a new node");
});
it("does not imply possibleInference alone triggers mutation", () => {
const prompt = buildGraphUpdatePrompt(makeContext());
// The rule must reference userSupportedMeaning specifically, not possibleInference as a trigger.
const mustRuleMatch = prompt.match(
/6\..*?(?=\n7\.)/s,
);
expect(mustRuleMatch[0]).toContain("userSupportedMeaning");
});
});