]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(sandcastle): remove redundant lastFindings from LoopResult
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 7 May 2026 23:33:21 +0000 (01:33 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 7 May 2026 23:33:21 +0000 (01:33 +0200)
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
.sandcastle/refinement-loop.ts
.sandcastle/types.ts

index 665ae825696baa47972be7cf739c0ae1b88319f4..f4518239e66340126c57348d88a1bdf56d9f4cdd 100644 (file)
@@ -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.'
index dcb2c89a03c0c54d50ced74800607194592baea2..98c6fea3d550b01819d9d87707a2ce929119b657 100644 (file)
@@ -231,7 +231,6 @@ export async function runRefinementLoop (
   return {
     baseBranch,
     failureReason,
-    lastFindings,
     roundHistory,
     roundsCompleted,
     status,
index 950660f761008dda186732e4c38a0bfc10588ec3..9fe1d737abb4e45e290ba0bebd0fb69f765b9c9a 100644 (file)
@@ -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