From 7b2827c5049b90bf756303df43f07bb579f376ac Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 21 Aug 2025 18:40:40 +0100 Subject: [PATCH 01/12] hack: add scripts/aitest.sh --- scripts/aitest.sh | 166 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100755 scripts/aitest.sh diff --git a/scripts/aitest.sh b/scripts/aitest.sh new file mode 100755 index 0000000000000..c22afe028ca99 --- /dev/null +++ b/scripts/aitest.sh @@ -0,0 +1,166 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Default timeout in seconds (10 minutes) +TIMEOUT=${1:-600} +MAX_ITERATIONS=10 + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +log() { + echo -e "${BLUE}[aitest]${NC} $1" >&2 +} + +error() { + echo -e "${RED}[aitest ERROR]${NC} $1" >&2 +} + +success() { + echo -e "${GREEN}[aitest SUCCESS]${NC} $1" >&2 +} + +warn() { + echo -e "${YELLOW}[aitest WARN]${NC} $1" >&2 +} + +# Check if claude command is available +if ! command -v claude >/dev/null 2>&1; then + error "claude command not found. Please install Claude CLI." + exit 1 +fi + +# Read prompt from stdin +log "Reading prompt from stdin..." +prompt=$(cat) + +if [[ -z "$prompt" ]]; then + error "No prompt provided via stdin" + exit 1 +fi + +log "Received prompt (${#prompt} characters)" + +# Function to detect if changes affect Go or TypeScript +detect_test_type() { + local changed_files + # Get recently changed files (last 5 minutes or uncommitted changes) + if git status --porcelain | grep -q .; then + # Use uncommitted changes + changed_files=$(git status --porcelain | awk '{print $2}') + else + # Use recently changed files + changed_files=$(git diff --name-only HEAD~1 2>/dev/null || echo "") + fi + + local needs_go=false + local needs_ts=false + + while IFS= read -r file; do + if [[ "$file" == *.go ]]; then + needs_go=true + elif [[ "$file" == site/* && ("$file" == *.ts || "$file" == *.tsx || "$file" == *.js || "$file" == *.jsx) ]]; then + needs_ts=true + fi + done <<<"$changed_files" + + echo "go:$needs_go ts:$needs_ts" +} + +# Function to run tests and lint +run_tests() { + local test_type="$1" + local go_tests="${test_type#*:}" + go_tests="${go_tests%% *}" + local ts_tests="${test_type#* }" + ts_tests="${ts_tests#*:}" + + log "Running tests (Go: $go_tests, TS: $ts_tests)..." + + local failed=false + local output="" + + # Run Go tests if needed + if [[ "$go_tests" == "true" ]]; then + log "Running Go tests..." + if ! go_output=$(make test 2>&1); then + failed=true + output+="=== GO TEST FAILURES ===\n$go_output\n\n" + fi + fi + + # Run TypeScript tests if needed + if [[ "$ts_tests" == "true" ]]; then + log "Running TypeScript tests..." + if ! ts_output=$(cd site && pnpm test 2>&1); then + failed=true + output+="=== TYPESCRIPT TEST FAILURES ===\n$ts_output\n\n" + fi + fi + + # Always run lint + log "Running lint..." + if ! lint_output=$(make lint 2>&1); then + failed=true + output+="=== LINT FAILURES ===\n$lint_output\n\n" + fi + + if [[ "$failed" == "true" ]]; then + echo "$output" + return 1 + else + return 0 + fi +} + +# Main loop +log "Starting test-fix cycle (timeout: ${TIMEOUT}s, max iterations: $MAX_ITERATIONS)" +start_time=$(date +%s) +iteration=0 + +while ((iteration < MAX_ITERATIONS)); do + iteration=$((iteration + 1)) + current_time=$(date +%s) + elapsed=$((current_time - start_time)) + + if ((elapsed >= TIMEOUT)); then + error "Timeout reached after ${elapsed}s" + exit 1 + fi + + log "Iteration $iteration (elapsed: ${elapsed}s)" + + # Send prompt to Claude + log "Sending prompt to Claude..." + if ! echo "$prompt" | claude -p; then + error "Claude command failed" + exit 1 + fi + + # Detect what tests to run + test_type=$(detect_test_type) + log "Detected test requirements: $test_type" + + # Run tests + if test_output=$(run_tests "$test_type"); then + success "All tests passed! Completed in $iteration iteration(s)" + exit 0 + else + warn "Tests failed, providing feedback to Claude..." + + # Update prompt to include only the test failures + prompt="Fix these test failures: + +$test_output" + + log "Updated prompt with test failures for next iteration" + fi +done + +error "Maximum iterations ($MAX_ITERATIONS) reached without success" +exit 1 From d4a958c5b1c1cb266522dd68a808e887b1a6d07a Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 21 Aug 2025 19:07:09 +0100 Subject: [PATCH 02/12] log to file --- scripts/aitest.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index c22afe028ca99..b0a5ea8106397 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -6,6 +6,9 @@ set -euo pipefail TIMEOUT=${1:-600} MAX_ITERATIONS=10 +# Log file for Claude output +LOG_FILE="aitest-$(date +%Y%m%d-%H%M%S).log" + # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' @@ -45,6 +48,15 @@ if [[ -z "$prompt" ]]; then fi log "Received prompt (${#prompt} characters)" +log "Logging Claude output to: $LOG_FILE" + +# Initialize log file with header +{ + echo "=== AI Test Session Started at $(date) ===" + echo "Initial prompt:" + echo "$prompt" + echo "" +} >"$LOG_FILE" # Function to detect if changes affect Go or TypeScript detect_test_type() { @@ -130,6 +142,7 @@ while ((iteration < MAX_ITERATIONS)); do if ((elapsed >= TIMEOUT)); then error "Timeout reached after ${elapsed}s" + echo "=== FAILURE: Timeout reached after ${elapsed}s at $(date) ===" >>"$LOG_FILE" exit 1 fi @@ -137,11 +150,27 @@ while ((iteration < MAX_ITERATIONS)); do # Send prompt to Claude log "Sending prompt to Claude..." - if ! echo "$prompt" | claude -p; then + + # Log the prompt for this iteration + { + echo "=== Iteration $iteration at $(date) ===" + echo "Prompt:" + echo "$prompt" + echo "" + echo "Claude response:" + } >>"$LOG_FILE" + + # Send to Claude and capture output + if ! claude_output=$(echo "$prompt" | claude -p 2>&1); then error "Claude command failed" + echo "Claude command failed: $claude_output" >>"$LOG_FILE" exit 1 fi + # Log Claude's response + echo "$claude_output" >>"$LOG_FILE" + echo "" >>"$LOG_FILE" + # Detect what tests to run test_type=$(detect_test_type) log "Detected test requirements: $test_type" @@ -149,10 +178,18 @@ while ((iteration < MAX_ITERATIONS)); do # Run tests if test_output=$(run_tests "$test_type"); then success "All tests passed! Completed in $iteration iteration(s)" + echo "=== SUCCESS: All tests passed in $iteration iteration(s) at $(date) ===" >>"$LOG_FILE" exit 0 else warn "Tests failed, providing feedback to Claude..." + # Log the test failures + { + echo "Test failures:" + echo "$test_output" + echo "" + } >>"$LOG_FILE" + # Update prompt to include only the test failures prompt="Fix these test failures: @@ -163,4 +200,5 @@ $test_output" done error "Maximum iterations ($MAX_ITERATIONS) reached without success" +echo "=== FAILURE: Maximum iterations reached without success at $(date) ===" >>"$LOG_FILE" exit 1 From 751182310f2d03bdff6f410a80f69e6f3e3ae825 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 21 Aug 2025 19:11:05 +0100 Subject: [PATCH 03/12] bail early on no progress --- scripts/aitest.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index b0a5ea8106397..4a547bf9c690d 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -171,6 +171,17 @@ while ((iteration < MAX_ITERATIONS)); do echo "$claude_output" >>"$LOG_FILE" echo "" >>"$LOG_FILE" + # Check if Claude made any changes + if ! git status --porcelain | grep -q .; then + # No changes detected, check if this is the first iteration + if [[ $iteration -gt 1 ]]; then + error "No file changes detected after Claude's response. Bailing out." + echo "=== FAILURE: No changes made by Claude in iteration $iteration at $(date) ===" >>"$LOG_FILE" + exit 1 + fi + warn "No changes detected, but this is the first iteration. Continuing..." + fi + # Detect what tests to run test_type=$(detect_test_type) log "Detected test requirements: $test_type" From bfd83a92557268c1eeb0bec9a965a0e71dd197f4 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 21 Aug 2025 19:27:15 +0100 Subject: [PATCH 04/12] gitignore ai test logs --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5aa08b2512527..08a544955f07c 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,4 @@ result __debug_bin* **/.claude/settings.local.json +aitest-*.log From 336d7a313d07c05fba4134d467fcc7062f87a7bf Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 10:03:31 +0100 Subject: [PATCH 05/12] add --dangerously-skip-permissions --- scripts/aitest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index 4a547bf9c690d..f0275e9f7a10d 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -161,7 +161,7 @@ while ((iteration < MAX_ITERATIONS)); do } >>"$LOG_FILE" # Send to Claude and capture output - if ! claude_output=$(echo "$prompt" | claude -p 2>&1); then + if ! claude_output=$(echo "$prompt" | claude -p --dangerously-skip-permissions 2>&1); then error "Claude command failed" echo "Claude command failed: $claude_output" >>"$LOG_FILE" exit 1 From 8a117a0ae9c52f54583e5fc42e3802c39bd8a33e Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 11:39:25 +0100 Subject: [PATCH 06/12] focus on go tests for now --- scripts/aitest.sh | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index f0275e9f7a10d..2d183134631ea 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -89,10 +89,8 @@ run_tests() { local test_type="$1" local go_tests="${test_type#*:}" go_tests="${go_tests%% *}" - local ts_tests="${test_type#* }" - ts_tests="${ts_tests#*:}" - log "Running tests (Go: $go_tests, TS: $ts_tests)..." + log "Running tests..." local failed=false local output="" @@ -106,15 +104,6 @@ run_tests() { fi fi - # Run TypeScript tests if needed - if [[ "$ts_tests" == "true" ]]; then - log "Running TypeScript tests..." - if ! ts_output=$(cd site && pnpm test 2>&1); then - failed=true - output+="=== TYPESCRIPT TEST FAILURES ===\n$ts_output\n\n" - fi - fi - # Always run lint log "Running lint..." if ! lint_output=$(make lint 2>&1); then From ab4c21795712f692ebe29ecdf3c8469227b50d8e Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 11:49:55 +0100 Subject: [PATCH 07/12] check coverage --- scripts/aitest.sh | 113 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index 2d183134631ea..972d53a492cd5 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -9,6 +9,21 @@ MAX_ITERATIONS=10 # Log file for Claude output LOG_FILE="aitest-$(date +%Y%m%d-%H%M%S).log" +# Coverage tracking - use temporary directory +COVERAGE_DIR=$(mktemp -d) +BASELINE_COVERAGE="$COVERAGE_DIR/baseline.out" +CURRENT_COVERAGE="$COVERAGE_DIR/current.out" + +# Cleanup function +cleanup() { + if [[ -d "$COVERAGE_DIR" ]]; then + rm -rf "$COVERAGE_DIR" + fi +} + +# Set up cleanup on exit +trap cleanup EXIT + # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' @@ -50,6 +65,90 @@ fi log "Received prompt (${#prompt} characters)" log "Logging Claude output to: $LOG_FILE" +# Function to get coverage profile +get_coverage() { + local output_file="$1" + log "Getting test coverage profile..." + if ! gotestsum --packages="./..." --rerun-fails=1 -- --coverprofile="$output_file" >/dev/null 2>&1; then + return 1 + fi + return 0 +} + +# Function to extract coverage percentage from profile +get_coverage_percentage() { + local profile_file="$1" + if [[ ! -f "$profile_file" ]]; then + echo "0.0" + return + fi + + # Use go tool cover to get coverage percentage + go tool cover -func="$profile_file" | tail -n 1 | awk '{print $3}' | sed 's/%//' +} + +# Function to compare coverage and generate diff if decreased +check_coverage_change() { + local baseline_file="$1" + local current_file="$2" + + if [[ ! -f "$baseline_file" ]]; then + log "No baseline coverage file found, skipping coverage comparison" + return 0 + fi + + if [[ ! -f "$current_file" ]]; then + warn "No current coverage file found, skipping coverage comparison" + return 0 + fi + + local baseline_pct + baseline_pct=$(get_coverage_percentage "$baseline_file") + local current_pct + current_pct=$(get_coverage_percentage "$current_file") + + log "Coverage: baseline ${baseline_pct}%, current ${current_pct}%" + + # Compare coverage (using bc for floating point comparison) + if command -v bc >/dev/null 2>&1; then + local decreased + decreased=$(echo "$current_pct < $baseline_pct" | bc -l) + if [[ "$decreased" == "1" ]]; then + warn "Coverage decreased from ${baseline_pct}% to ${current_pct}%" + + # Generate coverage diff + local diff_output="" + if command -v go >/dev/null 2>&1; then + diff_output="Coverage decreased from ${baseline_pct}% to ${current_pct}% + +=== BASELINE COVERAGE === +$(go tool cover -func="$baseline_file") + +=== CURRENT COVERAGE === +$(go tool cover -func="$current_file") + +Please fix the code to maintain or improve test coverage." + else + diff_output="Coverage decreased from ${baseline_pct}% to ${current_pct}%. Please fix the code to maintain or improve test coverage." + fi + + echo "$diff_output" + return 1 + fi + else + warn "bc command not available, skipping precise coverage comparison" + fi + + return 0 +} + +# Get baseline coverage before starting +log "Getting baseline coverage profile..." +if ! get_coverage "$BASELINE_COVERAGE"; then + error "Failed to get baseline coverage profile" + exit 1 +fi + # Initialize log file with header { echo "=== AI Test Session Started at $(date) ===" @@ -101,6 +200,20 @@ run_tests() { if ! go_output=$(make test 2>&1); then failed=true output+="=== GO TEST FAILURES ===\n$go_output\n\n" + else + # Get updated coverage profile after tests pass + log "Getting updated coverage profile..." + if get_coverage "$CURRENT_COVERAGE"; then + # Check for coverage decrease + if coverage_diff=$(check_coverage_change "$BASELINE_COVERAGE" "$CURRENT_COVERAGE"); then + log "Coverage maintained or improved" + else + failed=true + output+="=== COVERAGE DECREASED ===\n$coverage_diff\n\n" + fi + else + warn "Failed to get updated coverage profile, but continuing..." + fi fi fi From b037cd39357fa73dd74b817e006a90710437ca7d Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 11:52:30 +0100 Subject: [PATCH 08/12] gomaxprocs gotestsum --- scripts/aitest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index 972d53a492cd5..1900a65dcbd25 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -69,7 +69,7 @@ log "Logging Claude output to: $LOG_FILE" get_coverage() { local output_file="$1" log "Getting test coverage profile..." - if ! gotestsum --packages="./..." --rerun-fails=1 -- --coverprofile="$output_file" >/dev/null 2>&1; then + if ! GOMAXPROCS=4 gotestsum --packages="./..." --rerun-fails=1 -- --coverprofile="$output_file" >/dev/null 2>&1; then return 1 fi return 0 From 4edbd476b417dd39c8d89301f8c1938d2ea2f1d4 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 12:08:07 +0100 Subject: [PATCH 09/12] dedupe test run --- scripts/aitest.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index 1900a65dcbd25..685117bffdf14 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -196,24 +196,18 @@ run_tests() { # Run Go tests if needed if [[ "$go_tests" == "true" ]]; then - log "Running Go tests..." - if ! go_output=$(make test 2>&1); then - failed=true - output+="=== GO TEST FAILURES ===\n$go_output\n\n" - else - # Get updated coverage profile after tests pass - log "Getting updated coverage profile..." - if get_coverage "$CURRENT_COVERAGE"; then - # Check for coverage decrease - if coverage_diff=$(check_coverage_change "$BASELINE_COVERAGE" "$CURRENT_COVERAGE"); then - log "Coverage maintained or improved" - else - failed=true - output+="=== COVERAGE DECREASED ===\n$coverage_diff\n\n" - fi + log "Running Go tests with coverage..." + if get_coverage "$CURRENT_COVERAGE"; then + # Check for coverage decrease + if coverage_diff=$(check_coverage_change "$BASELINE_COVERAGE" "$CURRENT_COVERAGE"); then + log "Coverage maintained or improved" else - warn "Failed to get updated coverage profile, but continuing..." + failed=true + output+="=== COVERAGE DECREASED ===\n$coverage_diff\n\n" fi + else + failed=true + output+="=== GO TEST FAILURES ===\nTests failed during coverage collection\n\n" fi fi From 33ef870edef1b1244d4151c8b17cc62b09b86d96 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 12:25:53 +0100 Subject: [PATCH 10/12] use awk instead of bc --- scripts/aitest.sh | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index 685117bffdf14..42b682984d47d 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -2,6 +2,12 @@ set -euo pipefail +# shellcheck source=scripts/lib.sh +source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" + +# Check required dependencies +dependencies claude gotestsum awk go + # Default timeout in seconds (10 minutes) TIMEOUT=${1:-600} MAX_ITERATIONS=10 @@ -47,12 +53,6 @@ warn() { echo -e "${YELLOW}[aitest WARN]${NC} $1" >&2 } -# Check if claude command is available -if ! command -v claude >/dev/null 2>&1; then - error "claude command not found. Please install Claude CLI." - exit 1 -fi - # Read prompt from stdin log "Reading prompt from stdin..." prompt=$(cat) @@ -69,7 +69,7 @@ log "Logging Claude output to: $LOG_FILE" get_coverage() { local output_file="$1" log "Getting test coverage profile..." - if ! GOMAXPROCS=4 gotestsum --packages="./..." --rerun-fails=1 -- --coverprofile="$output_file" >/dev/null 2>&1; then + if ! GOMAXPROCS=4 gotestsum --packages="./..." --rerun-fails=1 -- --covermode=atomic --coverprofile="$output_file" >/dev/null 2>&1; then return 1 fi return 0 @@ -109,17 +109,15 @@ check_coverage_change() { log "Coverage: baseline ${baseline_pct}%, current ${current_pct}%" - # Compare coverage (using bc for floating point comparison) - if command -v bc >/dev/null 2>&1; then - local decreased - decreased=$(echo "$current_pct < $baseline_pct" | bc -l) - if [[ "$decreased" == "1" ]]; then - warn "Coverage decreased from ${baseline_pct}% to ${current_pct}%" + # Compare coverage using awk for floating point comparison + local decreased + decreased=$(awk -v current="$current_pct" -v baseline="$baseline_pct" 'BEGIN { print (current < baseline) ? 1 : 0 }') + if [[ "$decreased" == "1" ]]; then + warn "Coverage decreased from ${baseline_pct}% to ${current_pct}%" - # Generate coverage diff - local diff_output="" - if command -v go >/dev/null 2>&1; then - diff_output="Coverage decreased from ${baseline_pct}% to ${current_pct}% + # Generate coverage diff + local diff_output + diff_output="Coverage decreased from ${baseline_pct}% to ${current_pct}% === BASELINE COVERAGE === $(go tool cover -func="$baseline_file") @@ -128,15 +126,9 @@ $(go tool cover -func="$baseline_file") $(go tool cover -func="$current_file") Please fix the code to maintain or improve test coverage." - else - diff_output="Coverage decreased from ${baseline_pct}% to ${current_pct}%. Please fix the code to maintain or improve test coverage." - fi - echo "$diff_output" - return 1 - fi - else - warn "bc command not available, skipping precise coverage comparison" + echo "$diff_output" + return 1 fi return 0 From e03cdbdbbcb06033c5b5da50e6ec1978210efd43 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 12:27:27 +0100 Subject: [PATCH 11/12] use more lib.sh --- scripts/aitest.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index 42b682984d47d..2c762359d9b52 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -8,6 +8,9 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" # Check required dependencies dependencies claude gotestsum awk go +# Ensure we're in the project root +cdroot + # Default timeout in seconds (10 minutes) TIMEOUT=${1:-600} MAX_ITERATIONS=10 @@ -30,21 +33,11 @@ cleanup() { # Set up cleanup on exit trap cleanup EXIT -# Colors for output -RED='\033[0;31m' +# Colors for output (keeping these for success/warn which lib.sh doesn't have) GREEN='\033[0;32m' YELLOW='\033[1;33m' -BLUE='\033[0;34m' NC='\033[0m' # No Color -log() { - echo -e "${BLUE}[aitest]${NC} $1" >&2 -} - -error() { - echo -e "${RED}[aitest ERROR]${NC} $1" >&2 -} - success() { echo -e "${GREEN}[aitest SUCCESS]${NC} $1" >&2 } From 3d67816c69580f3a27fb08e032693567ceb1e8bc Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 25 Aug 2025 13:03:31 +0100 Subject: [PATCH 12/12] only lint on test success --- scripts/aitest.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/aitest.sh b/scripts/aitest.sh index 2c762359d9b52..d2fd8b20210fc 100755 --- a/scripts/aitest.sh +++ b/scripts/aitest.sh @@ -196,11 +196,13 @@ run_tests() { fi fi - # Always run lint - log "Running lint..." - if ! lint_output=$(make lint 2>&1); then - failed=true - output+="=== LINT FAILURES ===\n$lint_output\n\n" + # Only run lint if tests succeeded to avoid overwhelming context + if [[ "$failed" == "false" ]]; then + log "Running lint..." + if ! lint_output=$(make lint 2>&1); then + failed=true + output+="=== LINT FAILURES ===\n$lint_output\n\n" + fi fi if [[ "$failed" == "true" ]]; then