diff --git a/backend/scripts/promote_grade10_candidate.php b/backend/scripts/promote_grade10_candidate.php index f3056bb..861c368 100644 --- a/backend/scripts/promote_grade10_candidate.php +++ b/backend/scripts/promote_grade10_candidate.php @@ -48,6 +48,20 @@ $gateJson = shell_exec( $gate = json_decode((string) $gateJson, true); if (!is_array($gate) || ($gate['status'] ?? null) !== 'passed') { fwrite(STDERR, "Promotion refused: intake gate did not pass for {$manifestName}.\n"); + if (is_array($gate) && !empty($gate['errors'])) { + fwrite(STDERR, sprintf("Gate reported %d blocking error(s):\n", count($gate['errors']))); + foreach (array_slice($gate['errors'], 0, 10) as $err) { + $contextFile = $err['context']['file'] ?? ($err['context']['path'] ?? ''); + fwrite(STDERR, sprintf(" - [%s] %s%s\n", $err['code'] ?? 'error', $err['message'] ?? '', $contextFile ? " ({$contextFile})" : '')); + } + if (count($gate['errors']) > 10) { + fwrite(STDERR, sprintf(" ... and %d more error(s). Run: php backend/scripts/validate_grade10_candidate.php --manifest=%s\n", count($gate['errors']) - 10, basename($manifestName))); + } + } elseif (empty($gateJson)) { + fwrite(STDERR, "Preflight gate failed to execute or returned empty output.\n"); + fwrite(STDERR, "Run the gate directly to see the exact issue:\n"); + fwrite(STDERR, " php backend/scripts/validate_grade10_candidate.php --manifest=" . basename($manifestName) . "\n"); + } fwrite(STDERR, "Resolve review-queue.json items first; quarantined files stay unpublished.\n"); exit(1); }