Index applied changes for repair outcomes

This commit is contained in:
2026-11-11 12:29:42 +00:00
parent 8c93f728c0
commit 6b724fd3cc
3 changed files with 28 additions and 15 deletions

View File

@@ -241,6 +241,7 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
unit.State = outcomes.WorkCompleted
unit.CorrectionsApplied = appliedBySection[sectionPos]
}
var appliedIndices map[int]struct{}
for i := range workUnits[moduleIndex*len(sections) : (moduleIndex+1)*len(sections)] {
unit := &workUnits[moduleIndex*len(sections)+i]
for j := range unit.Repairs {
@@ -248,13 +249,16 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
if branch.Outcome != "approved" {
continue
}
branch.Outcome = "approved_skipped"
for _, change := range applied {
if change.ProposalIndex == branch.ProposalIndex {
branch.Outcome = "applied"
break
if appliedIndices == nil {
appliedIndices = make(map[int]struct{}, len(applied))
for _, change := range applied {
appliedIndices[change.ProposalIndex] = struct{}{}
}
}
branch.Outcome = "approved_skipped"
if _, ok := appliedIndices[branch.ProposalIndex]; ok {
branch.Outcome = "applied"
}
}
}
attributeApplyFiltering(sections, pipelineResult.Approved, skipped, policy, workUnits[moduleIndex*len(sections):(moduleIndex+1)*len(sections)])