From 6dec3647bf859d037bb2566d76ca7249e95cd7a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 8 May 2026 01:33:21 +0200 Subject: [PATCH] refactor(sandcastle): remove redundant lastFindings from LoopResult Derive last-round findings from roundHistory.at(-1)?.findings in finalizer.ts instead of maintaining a separate field. The PR body now shows all critic findings from the final round (including LOW confidence) for full transparency. --- .sandcastle/finalizer.ts | 5 +++-- .sandcastle/refinement-loop.ts | 1 - .sandcastle/types.ts | 7 +------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.sandcastle/finalizer.ts b/.sandcastle/finalizer.ts index 665ae825..f4518239 100644 --- a/.sandcastle/finalizer.ts +++ b/.sandcastle/finalizer.ts @@ -51,9 +51,10 @@ export function buildPrArgs ( ): { isDraft: boolean; prArgs: string[] } { const converged = loopResult.status === 'converged' const isDraft = !converged || !validationPassed + const lastFindings = loopResult.roundHistory.at(-1)?.findings ?? [] const outstandingNote = - loopResult.lastFindings.length > 0 - ? `\n\n${converged ? 'ℹ️ Known findings (not addressed):' : '⚠️ Outstanding findings:'}\n${loopResult.lastFindings.map(f => `- [${f.severity}] ${f.file}: ${f.title}`).join('\n')}` + lastFindings.length > 0 + ? `\n\n${converged ? 'ℹ️ Known findings (not addressed):' : '⚠️ Outstanding findings:'}\n${lastFindings.map(f => `- [${f.severity}] ${f.file}: ${f.title}`).join('\n')}` : '' const validationNote = !validationPassed ? '\n\n⚠️ Validation did not pass. Manual review required.' diff --git a/.sandcastle/refinement-loop.ts b/.sandcastle/refinement-loop.ts index dcb2c89a..98c6fea3 100644 --- a/.sandcastle/refinement-loop.ts +++ b/.sandcastle/refinement-loop.ts @@ -231,7 +231,6 @@ export async function runRefinementLoop ( return { baseBranch, failureReason, - lastFindings, roundHistory, roundsCompleted, status, diff --git a/.sandcastle/types.ts b/.sandcastle/types.ts index 950660f7..9fe1d737 100644 --- a/.sandcastle/types.ts +++ b/.sandcastle/types.ts @@ -47,12 +47,7 @@ export interface LoopResult { baseBranch: string /** Reason for non-converged termination, if applicable. */ failureReason?: string - /** Outstanding findings from the last round. */ - lastFindings: Finding[] - /** - * Complete findings history across all rounds. - * Authoritative source — `lastFindings` is kept for backward compatibility. - */ + /** Complete findings history across all rounds. */ roundHistory: RoundSnapshot[] /** Number of main-loop rounds completed (excludes post-loop validation retry). */ roundsCompleted: number -- 2.53.0