Skip to content

Commit dfa7d7f

Browse files
committed
fix: Add debugging output for AI validation in CI
- Print Python validation script output on failure - Add verbose mode to show Claude CLI availability check - Redirect stderr to stdout for better error capture
1 parent 7fa56c0 commit dfa7d7f

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

integration-testing/ai-validator/validate_example.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,18 @@ def main():
341341
# Create validator and run validation
342342
try:
343343
validator = SpringAIExampleValidator()
344+
345+
# Debug: Check if Claude CLI is available
346+
if args.verbose:
347+
import subprocess
348+
try:
349+
which_result = subprocess.run(['which', 'claude'], capture_output=True, text=True)
350+
print(f"DEBUG: which claude: {which_result.stdout.strip() or which_result.stderr.strip()}", file=sys.stderr)
351+
version_result = subprocess.run(['claude', '--version'], capture_output=True, text=True, timeout=10)
352+
print(f"DEBUG: claude version: {version_result.stdout.strip() or version_result.stderr.strip()}", file=sys.stderr)
353+
except Exception as e:
354+
print(f"DEBUG: Claude CLI check failed: {e}", file=sys.stderr)
355+
344356
result = validator.validate_example(request)
345357

346358
if args.output_format == "json":

integration-testing/jbang-lib/IntegrationTestUtils.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,12 @@ public static boolean performAIValidation(String output, Path logFile, ExampleIn
168168
Path validatorScript = repoRoot.resolve("integration-testing/ai-validator/validate_example.py");
169169

170170
String[] baseCmd = {
171-
"python3",
171+
"python3",
172172
validatorScript.toString(),
173173
"--log-path", logFile.toAbsolutePath().toString(),
174174
"--example-name", moduleName,
175-
"--output-format", "json"
175+
"--output-format", "json",
176+
"--verbose" // Enable verbose output for debugging in CI
176177
};
177178

178179
// Build dynamic command with optional parameters
@@ -208,14 +209,15 @@ public static boolean performAIValidation(String output, Path logFile, ExampleIn
208209
.command(fullCmd)
209210
.timeout(180, TimeUnit.SECONDS) // 3 minutes timeout for AI validation
210211
.readOutput(true)
212+
.redirectErrorStream(true) // Merge stderr into stdout for better error visibility
211213
.execute();
212-
214+
213215
String aiOutput = result.outputUTF8();
214-
String aiError = ""; // Error capture not available with readOutput(true)
215216
int aiExitCode = result.getExitValue();
216-
217+
217218
// Check exit code
218219
if (aiExitCode != 0) {
220+
err.println("AI validation output: " + aiOutput);
219221
throw new Exception("AI validation script failed with exit code: " + aiExitCode);
220222
}
221223

0 commit comments

Comments
 (0)