Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Enforce root-cause investigation before any fix—structured debugging protocol for bugs and test failures
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
find-polluter.sh
1#!/usr/bin/env bash2# Bisection script to find which test creates unwanted files/state3# Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>4# Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'56set -e78if [ $# -ne 2 ]; then9echo "Usage: $0 <file_to_check> <test_pattern>"10echo "Example: $0 '.git' 'src/**/*.test.ts'"11exit 112fi1314POLLUTION_CHECK="$1"15TEST_PATTERN="$2"1617echo "🔍 Searching for test that creates: $POLLUTION_CHECK"18echo "Test pattern: $TEST_PATTERN"19echo ""2021# Get list of test files22TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)23TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')2425echo "Found $TOTAL test files"26echo ""2728COUNT=029for TEST_FILE in $TEST_FILES; do30COUNT=$((COUNT + 1))3132# Skip if pollution already exists33if [ -e "$POLLUTION_CHECK" ]; then34echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"35echo " Skipping: $TEST_FILE"36continue37fi3839echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"4041# Run the test42npm test "$TEST_FILE" > /dev/null 2>&1 || true4344# Check if pollution appeared45if [ -e "$POLLUTION_CHECK" ]; then46echo ""47echo "🎯 FOUND POLLUTER!"48echo " Test: $TEST_FILE"49echo " Created: $POLLUTION_CHECK"50echo ""51echo "Pollution details:"52ls -la "$POLLUTION_CHECK"53echo ""54echo "To investigate:"55echo " npm test $TEST_FILE # Run just this test"56echo " cat $TEST_FILE # Review test code"57exit 158fi59done6061echo ""62echo "✅ No polluter found - all tests clean!"63exit 064