reasoning: add proposal-level answer meaning guard
- Add answerMeaning schema with supportCategory and resolutionGuidance enums - Add pre-mutation guard that validates proposal alignment with answerMeaning - Update prompt builder to instruct the model on answerMeaning contract - Add tests for schema, guard logic, parsing defaults, and regression cases A-D
This commit is contained in:
@@ -73,6 +73,7 @@ describe("buildGraphUpdatePrompt", () => {
|
||||
expect(prompt).toContain("resolvedUnknownNodeIds");
|
||||
expect(prompt).toContain("affectedNodeIds");
|
||||
expect(prompt).toContain("selectedQuestion");
|
||||
expect(prompt).toContain("answerMeaning");
|
||||
});
|
||||
|
||||
it("lists enum values", () => {
|
||||
@@ -111,4 +112,17 @@ describe("buildGraphUpdatePrompt", () => {
|
||||
"the engine will deterministically choose final priority after validation",
|
||||
);
|
||||
});
|
||||
|
||||
it("instructs the model to preserve user-supported meaning separately from inference", () => {
|
||||
const prompt = buildGraphUpdatePrompt(makeContext());
|
||||
expect(prompt).toContain(
|
||||
"answerMeaning.userSupportedMeaning must state only what the user's answer directly supports",
|
||||
);
|
||||
expect(prompt).toContain(
|
||||
"Put any stronger interpretation in answerMeaning.possibleInference",
|
||||
);
|
||||
expect(prompt).toContain(
|
||||
"If the answer is only a relative priority statement, use supportCategory=relative_priority_only and resolutionGuidance=must_remain_unresolved",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user