committeeShadowResultProjection function
receipt's evidence packet as the RESERVED committeeShadow* step-result
entries a shadowed advance carries — the durable half of the receipt the
worktree file is reaped with.
The committeeShadow prefix is the reservation: a conforming authoritative
route payload carries no such key, so spreading these entries LAST can only
win a collision against a payload that broke that reservation.
Same bound as committeeSelectionResultProjection, applied to the receipt's wider surface: the omitted lanes cross as their rubric ids mapped to a grade, a transport and a gate disposition; the accounting crosses as contributor ids and totals. A lane's rationale, finding, owner, refinement and model, the route's own reason and payload, and every raw evidence lane are all excluded.
Implementation
Map<String, String> committeeShadowResultProjection(
CommitteeShadowReceipt receipt,
) {
final run = receipt.run;
final selection = run.selection;
final lanes = {for (final lane in receipt.lanes) lane.rubricId: lane};
/// One `omitted rubric id -> column` map, over EVERY omitted lane: a lane the
/// committee never observed maps to null rather than dropping out, so the
/// omission set and the observation set always have the same members.
String omittedColumn(Object? Function(CommitteeLaneReceipt lane) column) =>
canonicalCommitteeJson({
for (final id in receipt.omittedRubricIds)
id: switch (lanes[id]) {
final CommitteeLaneReceipt lane => column(lane),
null => null,
},
});
return {
'committeeShadowSampleId': receipt.sampleId,
'committeeShadowJoinId': receipt.joinId,
'committeeShadowPolicyVersion': run.policyVersion,
'committeeShadowWorkBeadId': run.workBeadId,
'committeeShadowRound': canonicalCommitteeJson(run.round),
'committeeShadowNodePath': run.nodePath,
'committeeShadowRouteNodePath': receipt.route.nodePath,
'committeeShadowStage': run.stage.wire,
'committeeShadowSource': selection.source.wire,
'committeeShadowSelected': receipt.selectedRubricIds.join(','),
'committeeShadowOmitted': receipt.omittedRubricIds.join(','),
'committeeShadowMatchedRules': selection.matchedRuleIds.join(','),
'committeeShadowEvidenceDigest': selection.evidenceDigest,
'committeeShadowMissingEvidenceIds': run.evidence.missingEvidenceIds.join(
',',
),
'committeeShadowLaneInputDigests': canonicalCommitteeJson(
selection.laneInputDigests,
),
'committeeShadowClassifierAttemptKinds': [
for (final attempt in run.attempts) attempt.kind.wire,
].join(','),
'committeeShadowActionLaneIds': receipt.actionLaneIds.join(','),
'committeeShadowGateDisposition': switch (receipt.gateDisposition) {
final GateDisposition disposition => _gateDispositionWire(disposition),
null => canonicalCommitteeJson(null),
},
'committeeShadowDownstreamJoinKeys': canonicalCommitteeJson(
receipt.downstreamJoinKeys,
),
'committeeShadowOmittedLaneGrades': omittedColumn((lane) => lane.grade),
'committeeShadowOmittedLaneTransports': omittedColumn(
(lane) => lane.transport,
),
'committeeShadowOmittedLaneDispositions': omittedColumn(
(lane) => switch (lane.gateDisposition) {
final GateDisposition disposition => _gateDispositionWire(disposition),
null => null,
},
),
'committeeShadowActualContributingRunIds': receipt.actual.contributingRunIds
.join(','),
'committeeShadowActualMissingLaneIds': receipt.actual.missingLaneIds.join(
',',
),
'committeeShadowActualTokensIn': canonicalCommitteeJson(
receipt.actual.tokensIn,
),
'committeeShadowActualTokensOut': canonicalCommitteeJson(
receipt.actual.tokensOut,
),
'committeeShadowActualCostUsd': canonicalCommitteeJson(
receipt.actual.costUsd,
),
'committeeShadowCounterfactualContributingRunIds': receipt
.counterfactual
.contributingRunIds
.join(','),
'committeeShadowCounterfactualMissingLaneIds': receipt
.counterfactual
.missingLaneIds
.join(','),
'committeeShadowCounterfactualTokensIn': canonicalCommitteeJson(
receipt.counterfactual.tokensIn,
),
'committeeShadowCounterfactualTokensOut': canonicalCommitteeJson(
receipt.counterfactual.tokensOut,
),
'committeeShadowCounterfactualCostUsd': canonicalCommitteeJson(
receipt.counterfactual.costUsd,
),
'committeeShadowTruncated': canonicalCommitteeJson(receipt.truncated),
'committeeShadowMissingFields': receipt.missingFields.join(','),
};
}