47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
package cli
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitea.maximumdirect.net/eric/audita/internal/framework/proposals"
|
|
"gitea.maximumdirect.net/eric/audita/internal/framework/runner"
|
|
)
|
|
|
|
func TestBuildCorrectionLedgerClassifiesValidatorDecisionsFromCanonicalMetadata(t *testing.T) {
|
|
output := &runner.RunOutput{
|
|
ModuleResults: []runner.ModuleResult{
|
|
{
|
|
ModuleKey: "glossary",
|
|
ModuleInstance: "glossary",
|
|
ReplacementPolicy: proposals.ReplacementPolicyReplaceAll,
|
|
ValidatorDecisions: []runner.ValidatorDecisionRecord{
|
|
{ValidatorName: "proposal_shape", ProposalIndex: 3, Approved: true, ReasonCode: "approved"},
|
|
{ValidatorName: "spoken_form_plausibility", ProposalIndex: 3, Approved: true, ReasonCode: "approved"},
|
|
},
|
|
AppliedChanges: []proposals.AppliedChange{
|
|
{
|
|
ProposalIndex: 3,
|
|
ModuleKey: "glossary",
|
|
ModuleInstance: "glossary",
|
|
TargetSegmentID: 1,
|
|
OriginalText: "gestures",
|
|
CorrectedText: "Jesters",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
ledger := buildCorrectionLedger("/tmp/audita-run-id", output)
|
|
if len(ledger) != 1 {
|
|
t.Fatalf("expected one ledger entry, got %d", len(ledger))
|
|
}
|
|
entry := ledger[0]
|
|
if len(entry.DeterministicValidatorResults) != 1 || entry.DeterministicValidatorResults[0].ValidatorKey != "proposal_shape" {
|
|
t.Fatalf("unexpected deterministic decision split: %+v", entry.DeterministicValidatorResults)
|
|
}
|
|
if len(entry.LLMValidatorResults) != 1 || entry.LLMValidatorResults[0].ValidatorKey != "spoken_form_plausibility" {
|
|
t.Fatalf("unexpected llm-backed decision split: %+v", entry.LLMValidatorResults)
|
|
}
|
|
}
|