* Build the ablation edit for a candidate: { lineNo, action, trimmed_line }. * Priority: explicit --action override, else the judge verdict, else default * 'delete' (test whether the whole line is inert).
(candidate, verdicts)
| 76 | * 'delete' (test whether the whole line is inert). |
| 77 | */ |
| 78 | function resolveEdit(candidate, verdicts) { |
| 79 | if (actionOverride === 'delete') return { ...candidate, action: 'delete' }; |
| 80 | if (actionOverride === 'trim') return { ...candidate, action: 'trim' }; |
| 81 | |
| 82 | const v = verdicts.find(m => m.skill === candidate.skill && m.lineNo === candidate.lineNo); |
| 83 | const verdict = v && v.verdict ? v.verdict : null; |
| 84 | if (verdict) { |
| 85 | if (verdict.verdict === 'keep') return { ...candidate, action: 'keep' }; |
| 86 | if (verdict.verdict === 'trim') return { ...candidate, action: 'trim', trimmed_line: verdict.trimmed_line }; |
| 87 | if (verdict.verdict === 'delete') return { ...candidate, action: 'delete' }; |
| 88 | } |
| 89 | return { ...candidate, action: 'delete' }; // default hypothesis |
| 90 | } |
| 91 | |
| 92 | // ── Ablation edits ──────────────────────────────────────────────────────────── |
| 93 |