refine raw-answer boundary for answer meaning

This commit is contained in:
2026-08-09 11:31:27 +01:00
parent c06aecc3f7
commit 4aa1492c8d
2 changed files with 228 additions and 0 deletions
+59
View File
@@ -2843,6 +2843,59 @@ function deriveAnswerMeaningProfile(userSupportedMeaning) {
};
}
function validateAnswerMeaningCompatibilityWithRawAnswer({ answer, proposal }) {
if (!answer || !proposal.answerMeaning) return [];
const errors = [];
const rawAnswerProfile = deriveAnswerMeaningProfile(answer);
const supportedMeaningProfile = deriveAnswerMeaningProfile(
proposal.answerMeaning.userSupportedMeaning,
);
const supportedMeaningText = normaliseSemanticText(
proposal.answerMeaning.userSupportedMeaning,
);
if (rawAnswerProfile.category === "relative_priority_only") {
if (supportedMeaningProfile.category !== "relative_priority_only") {
errors.push(
"answerMeaning.userSupportedMeaning introduces a stronger reasoning category than the raw answer establishes.",
);
}
if (containsConstraintBoundaryLanguage(supportedMeaningText)) {
errors.push(
"answerMeaning.userSupportedMeaning introduces an unsupported constraint or preference/trade-off distinction not present in the raw answer.",
);
}
}
if (rawAnswerProfile.category === "conditional_tradeoff") {
if (supportedMeaningProfile.category !== "conditional_tradeoff") {
errors.push(
"answerMeaning.userSupportedMeaning loses the raw answer's conditional trade-off structure.",
);
}
}
if (rawAnswerProfile.category === "uncertain") {
if (supportedMeaningProfile.category !== "uncertain") {
errors.push(
"answerMeaning.userSupportedMeaning overstates a raw answer that remains uncertain.",
);
}
}
if (rawAnswerProfile.category === "explicit_hard_constraint") {
if (supportedMeaningProfile.category !== "explicit_hard_constraint") {
errors.push(
"answerMeaning.userSupportedMeaning weakens a raw answer that explicitly states a hard constraint.",
);
}
}
return errors;
}
function validateAnswerMeaningAlignment(proposal) {
if (!proposal.answerMeaning) return [];
@@ -3092,6 +3145,12 @@ export function applyValidatedProposal({
validatedProposal,
);
proposalCompatibilityErrors.push(...selectedQuestionValidation.errors);
proposalCompatibilityErrors.push(
...validateAnswerMeaningCompatibilityWithRawAnswer({
answer,
proposal: validatedProposal,
}),
);
proposalCompatibilityErrors.push(
...validateAnswerMeaningAlignment(validatedProposal),
);