refine raw-answer boundary for answer meaning
This commit is contained in:
@@ -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),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user