#!/usr/bin/env bash # scripts/skip-inventory.sh # # Phase 3 TEST-M4 + ARCH-L2 closure (2026-05-13): generate # docs/testing/skip-inventory.md from every t.Skip() site under # cmd/, internal/, and deploy/test/. Re-run after adding or removing # any t.Skip; CI guard at scripts/ci-guards/skip-inventory-drift.sh # fails the build on undetected drift. # # Each entry is grouped by package and shows file:line:expression. # The Phase 3 audit found ~142 skip sites; the inventory makes the # pattern transparent (testcontainers-gated under -short, platform- # gated under Linux/Darwin/Windows, demo-Compose-gated, etc.) so # acquisition-diligence reviewers can audit the skip surface. set -e OUTPUT="${1:-docs/testing/skip-inventory.md}" mkdir -p "$(dirname "$OUTPUT")" { echo "# Test Skip Inventory" echo echo "" echo "" echo "" echo echo "> Last reviewed: $(date +%Y-%m-%d)" echo echo "## Summary" echo total=$(grep -rcE "t\.Skip\b" --include='*_test.go' cmd/ internal/ deploy/test/ 2>/dev/null \ | awk -F: '$2>0 {s+=$2} END {print s}') short=$(grep -rE "testing\.Short\(\)" --include='*_test.go' cmd/ internal/ deploy/test/ 2>/dev/null \ | wc -l | tr -d ' ') echo "- Total t.Skip sites: **$total**" echo "- testing.Short() guards: **$short** (these gate behind \`go test -short\`)" echo echo "Re-run inventory with: \`./scripts/skip-inventory.sh\`." echo echo "## Sites (grouped by package)" echo grep -rnE "t\.Skip" --include='*_test.go' cmd/ internal/ deploy/test/ 2>/dev/null \ | awk -F: ' { # Extract directory (package) n = split($1, parts, "/") pkg = parts[1] for (i = 2; i < n; i++) pkg = pkg "/" parts[i] # Print pkg | file:line | expression rest = "" for (i = 3; i <= NF; i++) rest = (rest == "" ? $i : rest ":" $i) gsub(/^[ \t]+|[ \t]+$/, "", rest) print pkg "|" $1 ":" $2 "|" rest } ' \ | sort \ | awk -F'|' ' { if ($1 != cur) { if (cur != "") print "" print "### `" $1 "`" print "" cur = $1 } print "- `" $2 "` — " $3 } END { print "" } ' } > "$OUTPUT" echo "Wrote skip inventory to: $OUTPUT"