reasoning: use structured semantic fidelity contract

This commit is contained in:
2026-08-11 16:45:00 +01:00
parent b6a232ff6f
commit 7d06cd3c47
7 changed files with 630 additions and 97 deletions
+30 -2
View File
@@ -4,6 +4,8 @@ import {
SituationStatus,
ConfidenceLevel,
SituationRelationship,
answerResolutionGuidance,
answerSupportCategory,
situationNodeSchema,
situationEdgeSchema,
situationGraphSchema,
@@ -212,13 +214,39 @@ describe("graphUpdateSchema", () => {
userSupportedMeaning: "Risk matters more to me.",
possibleInference:
"This may imply caution, but does not establish a hard constraint.",
supportCategory: "relative priority only",
resolutionGuidance: "leave unresolved",
supportCategory: answerSupportCategory.relative_priority_only,
resolutionGuidance: answerResolutionGuidance.must_remain_unresolved,
},
});
expect(result.success).toBe(true);
});
it("rejects invalid supportCategory values", () => {
const result = graphUpdateSchema.safeParse({
answerMeaning: {
userSupportedMeaning: "Risk matters more to me.",
possibleInference: null,
supportCategory: "relative priority only",
resolutionGuidance: answerResolutionGuidance.must_remain_unresolved,
},
});
expect(result.success).toBe(false);
});
it("rejects invalid resolutionGuidance values", () => {
const result = graphUpdateSchema.safeParse({
answerMeaning: {
userSupportedMeaning: "Risk matters more to me.",
possibleInference: null,
supportCategory: answerSupportCategory.relative_priority_only,
resolutionGuidance: "leave unresolved",
},
});
expect(result.success).toBe(false);
});
it("rejects update with invalid node kind in addedNodes", () => {
const invalid = graphUpdateSchema.safeParse({
addedNodes: [