experiment: add rejected proposal diagnostics to failure path

Adds rejectedProposalSnapshot to orchestrator diagnostics for
proposal_compatibility rejections — exposing answerMeaning (userSupportedMeaning,
possibleInference), addedNodes structural fields, addedEdges structural fields,
updatedNodes summaries, and resolvedUnknownNodeIds. Diagnostic evidence only;
does not alter validation, mutation, or error messages. Stage-gated to
proposal_compatibility only.
This commit is contained in:
2026-08-11 08:33:36 +01:00
parent 79377670e2
commit 0348921542
4 changed files with 444 additions and 0 deletions
+37
View File
@@ -688,6 +688,42 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
});
if (!applicationResult.success) {
// Compact rejected-proposal snapshot for proposal_compatibility diagnostics.
// Diagnostic evidence only — does not alter validation or mutation.
const rejectedProposalSnapshot =
applicationResult.stage === "proposal_compatibility" && parsedProposal.proposal
? {
answerMeaning: parsedProposal.proposal.answerMeaning
? {
userSupportedMeaning:
parsedProposal.proposal.answerMeaning.userSupportedMeaning ?? null,
possibleInference:
parsedProposal.proposal.answerMeaning.possibleInference ?? null,
}
: null,
updatedNodes: (parsedProposal.proposal.updatedNodes ?? []).map((n) => ({
nodeId: n.nodeId,
newValue: n.newValue,
})),
resolvedUnknownNodeIds: parsedProposal.proposal.resolvedUnknownNodeIds ?? [],
addedNodes: (parsedProposal.proposal.addedNodes ?? []).map((n) => ({
id: n.id,
kind: n.kind,
label: n.label,
description: n.description,
parentId: n.parentId ?? null,
dependsOn: n.dependsOn ?? [],
affects: n.affects ?? [],
childIds: n.childIds ?? [],
})),
addedEdges: (parsedProposal.proposal.addedEdges ?? []).map((e) => ({
fromNodeId: e.fromNodeId,
toNodeId: e.toNodeId,
relationship: e.relationship,
})),
}
: null;
return {
success: false,
stage: applicationResult.stage,
@@ -774,6 +810,7 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
situationGraph.resolvedNodeIds || [],
),
}),
...(rejectedProposalSnapshot && { rejectedProposalSnapshot }),
},
statusCode:
applicationResult.stage === "application" ||