chore(scripts): remove three broken, orphaned traceability scripts
All three shared one root cause: an unscoped `grep -r src-tauri/`, which walks ~40GB of target/ build artifacts. - check-req-coverage.sh: also read README.md, which has held zero requirement rows since they moved to docs/requirements.md. Reported "Total Requirements: 1", zeros in every category, then printed "All requirements have implementations!" — the opposite of a warning, from an empty result set. - check-test-coverage.sh: hung indefinitely, no output at all. - find-req-implementations.sh: same hang. None was referenced by CI, package.json, or the docs. They were salvageable — the greps just needed scoping — but they read an undocumented `@req:` / `@req-test:` tag convention parallel to `TRACES:` (146 and 76 occurrences, described in no doc; CLAUDE.md documents only TRACES). Repairing them would re-establish the second source of truth that let "1 requirement" and "211 requirements" coexist unnoticed. extract-traces.ts is now the single owner of coverage reporting. The existing @req:/@req-test: comments are left in place: harmless as prose, several encode useful test intent, and stripping 222 comments is a large diff with no functional gain. They are simply no longer read.
This commit is contained in:
+17
-1
@@ -69,13 +69,29 @@ Extract requirement IDs (TRACES) from source code and generate a traceability ma
|
|||||||
bun run traces # Generate markdown report
|
bun run traces # Generate markdown report
|
||||||
bun run traces:json # Generate JSON report
|
bun run traces:json # Generate JSON report
|
||||||
bun run traces:markdown # Save to docs/traceability.md
|
bun run traces:markdown # Save to docs/traceability.md
|
||||||
|
bun run traces:coverage # Coverage gate — exits non-zero below 50%
|
||||||
```
|
```
|
||||||
|
|
||||||
The script scans all TypeScript, Svelte, and Rust files looking for `TRACES:` comments and generates a comprehensive mapping of:
|
The script scans all TypeScript, Svelte, and Rust files (plus `scripts/`)
|
||||||
|
looking for `TRACES:` comments and generates a comprehensive mapping of:
|
||||||
- Which code files implement which requirements
|
- Which code files implement which requirements
|
||||||
- Line numbers and code context
|
- Line numbers and code context
|
||||||
- Coverage summary by requirement type (UR, IR, DR, JA)
|
- Coverage summary by requirement type (UR, IR, DR, JA)
|
||||||
|
|
||||||
|
**`bun run traces:coverage` is the supported way to check requirement coverage
|
||||||
|
locally** — it runs the same computation CI does. Coverage denominators are
|
||||||
|
derived from `docs/requirements.md` at run time; they are never hardcoded. An ID
|
||||||
|
that appears in a `TRACES:` comment but is not defined in `requirements.md` is
|
||||||
|
reported as *orphaned* and does not count toward coverage (see DR-093).
|
||||||
|
|
||||||
|
> **Removed:** `check-req-coverage.sh`, `check-test-coverage.sh`, and
|
||||||
|
> `find-req-implementations.sh` were deleted in July 2026. They read an
|
||||||
|
> undocumented `@req:` tag convention parallel to `TRACES:`, grepped `src-tauri/`
|
||||||
|
> unscoped (hanging on ~40 GB of `target/` artifacts), and in one case reported
|
||||||
|
> "all requirements implemented" from an empty result set. `extract-traces.ts` is
|
||||||
|
> the single source of truth for requirement coverage. See
|
||||||
|
> [docs/specs/req-coverage-script-removal.md](../docs/specs/req-coverage-script-removal.md).
|
||||||
|
|
||||||
Example TRACES comment in code:
|
Example TRACES comment in code:
|
||||||
```typescript
|
```typescript
|
||||||
// TRACES: UR-005, UR-026 | DR-029
|
// TRACES: UR-005, UR-026 | DR-029
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Requirements Coverage Checker
|
|
||||||
# Extracts @req tags from codebase and compares with README.md
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
REQUIREMENTS_FILE="README.md"
|
|
||||||
SOURCE_DIRS="src-tauri/ src/"
|
|
||||||
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo " Requirements Coverage Report"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Extract requirement IDs from README.md (UR-, IR-, DR-, JA-)
|
|
||||||
echo "📊 Scanning requirements from $REQUIREMENTS_FILE..."
|
|
||||||
requirements=$(grep -E "^\| (UR|IR|DR|JA)-[0-9]+" "$REQUIREMENTS_FILE" | \
|
|
||||||
sed -E 's/^\| ([A-Z]+-[0-9]+).*/\1/' | \
|
|
||||||
sort -u)
|
|
||||||
|
|
||||||
total_reqs=$(echo "$requirements" | wc -l)
|
|
||||||
implemented=0
|
|
||||||
partial=0
|
|
||||||
planned=0
|
|
||||||
missing=0
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Category Breakdown:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
|
|
||||||
for category in UR IR DR JA; do
|
|
||||||
cat_count=$(echo "$requirements" | grep "^$category-" | wc -l)
|
|
||||||
printf "%-4s %3d requirements\n" "$category:" "$cat_count"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Implementation Status:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
|
|
||||||
for req in $requirements; do
|
|
||||||
# Count full implementations
|
|
||||||
full_count=$(grep -r "@req: $req" $SOURCE_DIRS 2>/dev/null | grep -v "@req-partial" | grep -v "@req-planned" | wc -l)
|
|
||||||
|
|
||||||
# Count partial implementations
|
|
||||||
partial_count=$(grep -r "@req-partial: $req" $SOURCE_DIRS 2>/dev/null | wc -l)
|
|
||||||
|
|
||||||
# Count planned
|
|
||||||
planned_count=$(grep -r "@req-planned: $req" $SOURCE_DIRS 2>/dev/null | wc -l)
|
|
||||||
|
|
||||||
if [ "$full_count" -gt 0 ]; then
|
|
||||||
echo "✅ $req: $full_count implementation(s)"
|
|
||||||
((implemented++))
|
|
||||||
elif [ "$partial_count" -gt 0 ]; then
|
|
||||||
echo "🔶 $req: $partial_count partial implementation(s)"
|
|
||||||
((partial++))
|
|
||||||
elif [ "$planned_count" -gt 0 ]; then
|
|
||||||
echo "📋 $req: Planned (not yet implemented)"
|
|
||||||
((planned++))
|
|
||||||
else
|
|
||||||
echo "❌ $req: No implementation found"
|
|
||||||
((missing++))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Summary:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
printf "Total Requirements: %3d\n" "$total_reqs"
|
|
||||||
printf "✅ Fully Implemented: %3d (%.0f%%)\n" "$implemented" "$(echo "scale=0; $implemented * 100 / $total_reqs" | bc)"
|
|
||||||
printf "🔶 Partially Implemented: %3d (%.0f%%)\n" "$partial" "$(echo "scale=0; $partial * 100 / $total_reqs" | bc)"
|
|
||||||
printf "📋 Planned: %3d (%.0f%%)\n" "$planned" "$(echo "scale=0; $planned * 100 / $total_reqs" | bc)"
|
|
||||||
printf "❌ Missing: %3d (%.0f%%)\n" "$missing" "$(echo "scale=0; $missing * 100 / $total_reqs" | bc)"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Exit code based on missing critical requirements
|
|
||||||
if [ "$missing" -gt 0 ]; then
|
|
||||||
echo "⚠️ Warning: $missing requirements have no implementation"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "✨ All requirements have implementations!"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Test Coverage Report
|
|
||||||
# Links test requirements to implementations
|
|
||||||
#
|
|
||||||
|
|
||||||
echo "Test Coverage Report"
|
|
||||||
echo "===================="
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
test_reqs=$(grep -rh "@req-test:" src-tauri/ 2>/dev/null | \
|
|
||||||
sed 's/.*@req-test: \([A-Z][A-Z]-[0-9]*\).*/\1/' | \
|
|
||||||
sort -u)
|
|
||||||
|
|
||||||
total_tests=0
|
|
||||||
covered=0
|
|
||||||
uncovered=0
|
|
||||||
|
|
||||||
for req in $test_reqs; do
|
|
||||||
test_count=$(grep -r "@req-test: $req" src-tauri/ 2>/dev/null | wc -l)
|
|
||||||
impl_count=$(grep -r "@req: $req" src-tauri/ src/ 2>/dev/null | wc -l)
|
|
||||||
|
|
||||||
((total_tests++))
|
|
||||||
|
|
||||||
if [ "$test_count" -gt 0 ] && [ "$impl_count" -gt 0 ]; then
|
|
||||||
echo "✅ $req: $test_count test(s), $impl_count implementation(s)"
|
|
||||||
((covered++))
|
|
||||||
elif [ "$impl_count" -eq 0 ]; then
|
|
||||||
echo "⚠️ $req: $test_count test(s) but no implementation"
|
|
||||||
((uncovered++))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Summary:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
printf "Total Test Requirements: %3d\n" "$total_tests"
|
|
||||||
printf "✅ With Implementation: %3d (%.0f%%)\n" "$covered" "$(echo "scale=0; $covered * 100 / $total_tests" | bc)"
|
|
||||||
printf "⚠️ No Implementation: %3d (%.0f%%)\n" "$uncovered" "$(echo "scale=0; $uncovered * 100 / $total_tests" | bc)"
|
|
||||||
echo ""
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Find all files implementing a specific requirement
|
|
||||||
#
|
|
||||||
# Usage: ./find-req-implementations.sh UR-004
|
|
||||||
#
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "Usage: $0 <REQUIREMENT_ID>"
|
|
||||||
echo "Example: $0 UR-004"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
REQ_ID=$1
|
|
||||||
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo " Implementations of $REQ_ID"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Full implementations
|
|
||||||
echo "Full Implementations:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
grep -rn "@req: $REQ_ID" src-tauri/ src/ 2>/dev/null | \
|
|
||||||
grep -v "@req-partial" | \
|
|
||||||
grep -v "@req-planned" | \
|
|
||||||
sed 's/src-tauri\/src\///' | \
|
|
||||||
sed 's/src\///' || echo " (none)"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Partial implementations
|
|
||||||
echo "Partial Implementations:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
grep -rn "@req-partial: $REQ_ID" src-tauri/ src/ 2>/dev/null | \
|
|
||||||
sed 's/src-tauri\/src\///' | \
|
|
||||||
sed 's/src\///' || echo " (none)"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Planned
|
|
||||||
echo "Planned Implementations:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
grep -rn "@req-planned: $REQ_ID" src-tauri/ src/ 2>/dev/null | \
|
|
||||||
sed 's/src-tauri\/src\///' | \
|
|
||||||
sed 's/src\///' || echo " (none)"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
echo "Test Cases:"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
grep -rn "@req-test: $REQ_ID" src-tauri/ 2>/dev/null | \
|
|
||||||
sed 's/src-tauri\/src\///' || echo " (none)"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
Reference in New Issue
Block a user