stemedb/applications/aphoria/dogfood/dbpool/scripts/verify-reset.sh
jml 3dac3dc914 feat(aphoria): implement Day 3 debugging features and comprehensive documentation
Implements all product gaps identified in msgqueue Day 3 evaluation (VG-DAY3-001/003/004)
and adds comprehensive documentation to prevent dogfooding failures.

## Product Features (VG-DAY3-XXX)

### VG-DAY3-001: --show-observations flag (P0)
- Shows all observations with concept paths for debugging extractor alignment
- Includes claim matching analysis (/ visual feedback)
- Explains tail-path matching and why observations don't match claims
- 8 unit tests in src/report/observations.rs
- 5 integration tests in src/tests/day3_debugging.rs

### VG-DAY3-003: aphoria extractors validate (P2)
- Validates extractor subject fields match claim concept_paths
- Smart fuzzy matching suggests corrections for typos
- Clear error messages with actionable hints
- Proper exit codes (0=success, 1=validation failed)

### VG-DAY3-004: aphoria extractors test NAME --file (P2)
- Tests single extractor pattern against one file (no full scan needed)
- Shows line numbers and matched text
- Previews what observation would be created
- Helpful troubleshooting when pattern doesn't match

## Documentation (P0-P1)

### New Docs Created
- docs/extractors/declarative-extractors.md (800 lines)
  - Complete field reference with emphasis on subject field format
  - 3 worked examples (timeout=0, unbounded queue, TLS disabled)
  - Common mistakes with fixes
  - Validation workflow
  - Debugging 0% detection rate

- docs/examples/extractors/timeout-zero-example.md (500 lines)
  - End-to-end flow: code → extractor → claim → conflict → fix
  - Visual diagrams showing path alignment
  - Troubleshooting guide
  - Validation checklist

- docs/dogfooding-common-mistakes.md (560 lines)
  - Mistake #1: Skipping Day 3 extractor creation (CRITICAL)
  - Mistake #2: Creating extractors with wrong subject format (NEW)
  - Evidence from msgqueue failures
  - Recovery procedures

### Docs Updated
- dogfood/msgqueue/plan.md (Day 3 Steps 3-4)
  - Added complete manual declarative extractor TOML format
  - Added validation workflow BEFORE scanning
  - Added debug workflow for 0% detection after creating extractors

- dogfood/msgqueue/eval/ (evaluation artifacts)
  - EVALUATION-REPORT-2026-02-10.md (600 lines)
  - DOC-FIXES-2026-02-10.md (summary of fixes)
  - IMPLEMENTATION-REVIEW-2026-02-10.md (feature review)

## New Extractors
- src/extractors/ack_mode_config.rs - Detects AckMode::AutoAck violations
- src/extractors/async_blocking.rs - Detects blocking calls in async functions
- src/extractors/unbounded_resources.rs - Detects unbounded queues/connections

## Code Changes
- src/cli/mod.rs: Add --show-observations flag to scan command
- src/cli/extractors.rs: Add Validate and Test subcommands
- src/handlers/scan.rs: Call format_observations when flag enabled
- src/handlers/extractors.rs: Implement handle_validate() and handle_test()
- src/report/observations.rs: Observation formatting with claim matching analysis
- src/tests/day3_debugging.rs: Integration tests for new features

## Dogfood Artifacts
- dogfood/msgqueue/ - Complete msgqueue Day 3 evaluation with findings
- dogfood/dbpool/ - Database pool dogfooding exercise

## Impact
- Time savings: 30 min per Day 3 debugging (67% faster)
- User experience: Transparent debugging (no blind trial-and-error)
- Documentation: 1,860 new lines covering all P0-P1 gaps

## Related Issues
- Closes VG-DAY3-001 (--show-observations)
- Closes VG-DAY3-002 (concept path alignment docs)
- Closes VG-DAY3-003 (extractors validate)
- Closes VG-DAY3-004 (extractors test)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 03:31:06 +00:00

209 lines
5.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Verify dbpool directory is reset and ready for next team run
set -e
echo "=== Dogfood Directory Reset Verification ==="
echo
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
PASS_COUNT=0
FAIL_COUNT=0
check_pass() {
echo -e "${GREEN}${NC} $1"
PASS_COUNT=$((PASS_COUNT + 1))
}
check_fail() {
echo -e "${RED}${NC} $1"
FAIL_COUNT=$((FAIL_COUNT + 1))
}
check_info() {
echo -e "${YELLOW}${NC} $1"
}
echo "=== Documentation Files ==="
# Check CHECKLIST.md has updated Day 1
if grep -q "## Day 1: Create 25-30 Corpus Claims" CHECKLIST.md; then
check_pass "CHECKLIST.md Day 1 heading updated"
else
check_fail "CHECKLIST.md Day 1 heading not updated"
fi
# Check for 27 claim checkboxes
CHECKBOX_COUNT=$(grep -c "\- \[ \].*dbpool/" CHECKLIST.md || echo "0")
if [ "$CHECKBOX_COUNT" -ge 27 ]; then
check_pass "CHECKLIST.md has $CHECKBOX_COUNT claim checkboxes (≥27 expected)"
else
check_fail "CHECKLIST.md has only $CHECKBOX_COUNT claim checkboxes (27 expected)"
fi
# Check practice bridge exists
if grep -q "Practice Claim 1" CHECKLIST.md; then
check_pass "Practice bridge added to CHECKLIST.md"
else
check_fail "Practice bridge missing from CHECKLIST.md"
fi
# Check flywheel setup doc exists
if [ -f "docs/flywheel-setup.md" ]; then
check_pass "docs/flywheel-setup.md exists"
else
check_fail "docs/flywheel-setup.md missing"
fi
# Check README exists
if [ -f "README.md" ]; then
check_pass "README.md exists"
else
check_fail "README.md missing"
fi
# Check reset documentation
if [ -f "RESET-2026-02-09.md" ]; then
check_pass "RESET-2026-02-09.md exists"
else
check_fail "RESET-2026-02-09.md missing"
fi
echo
echo "=== Source Documents ==="
# Check all 3 source documents exist
if [ -f "docs/sources/hikaricp-config.md" ]; then
check_pass "HikariCP source document preserved"
else
check_fail "HikariCP source document missing"
fi
if [ -f "docs/sources/owasp-credentials.md" ]; then
check_pass "OWASP source document preserved"
else
check_fail "OWASP source document missing"
fi
if [ -f "docs/sources/postgresql-pooling.md" ]; then
check_pass "PostgreSQL source document preserved"
else
check_fail "PostgreSQL source document missing"
fi
echo
echo "=== Configuration ==="
# Check .aphoria/config.toml exists
if [ -f ".aphoria/config.toml" ]; then
check_pass ".aphoria/config.toml exists"
# Check for persistent mode
if grep -q 'mode = "persistent"' .aphoria/config.toml; then
check_pass "Episteme mode set to persistent"
else
check_fail "Episteme mode not set to persistent"
fi
# Check for aggregation enabled
if grep -q "aggregation_enabled = true" .aphoria/config.toml; then
check_pass "Corpus aggregation enabled"
else
check_fail "Corpus aggregation not enabled"
fi
else
check_fail ".aphoria/config.toml missing"
fi
echo
echo "=== Clean State ==="
# Verify src/ does not exist
if [ ! -d "src" ]; then
check_pass "src/ directory removed (clean state)"
else
check_fail "src/ directory still exists (should be removed)"
fi
# Verify tests/ does not exist
if [ ! -d "tests" ]; then
check_pass "tests/ directory removed (clean state)"
else
check_fail "tests/ directory still exists (should be removed)"
fi
# Verify Cargo.toml does not exist
if [ ! -f "Cargo.toml" ]; then
check_pass "Cargo.toml removed (clean state)"
else
check_fail "Cargo.toml still exists (should be removed)"
fi
# Verify no scan results
SCAN_FILES=$(ls scan-results-*.json 2>/dev/null | wc -l)
if [ "$SCAN_FILES" -eq 0 ]; then
check_pass "No scan result files (clean state)"
else
check_fail "Found $SCAN_FILES scan result files (should be removed)"
fi
echo
echo "=== Evaluation Records ==="
# Check eval directory exists
if [ -d "eval" ]; then
check_pass "eval/ directory preserved"
# Check key evaluation files
if [ -f "eval/EVALUATION-REPORT-2026-02-09.md" ]; then
check_pass "Evaluation report preserved"
fi
if [ -f "eval/IMPLEMENTATION-SUMMARY.md" ]; then
check_pass "Implementation summary moved to eval/"
fi
else
check_fail "eval/ directory missing"
fi
echo
echo "=== Scripts ==="
# Check validate-setup.sh exists
if [ -f "scripts/validate-setup.sh" ]; then
check_pass "Pre-flight validator exists"
# Check if executable
if [ -x "scripts/validate-setup.sh" ]; then
check_pass "Pre-flight validator is executable"
else
check_info "Pre-flight validator not executable (run: chmod +x scripts/validate-setup.sh)"
fi
else
check_fail "Pre-flight validator missing"
fi
echo
echo "=== Summary ==="
echo "Passed: $PASS_COUNT"
echo "Failed: $FAIL_COUNT"
echo
if [ "$FAIL_COUNT" -eq 0 ]; then
echo -e "${GREEN}✓ All checks passed. Directory is ready for next team run!${NC}"
echo
echo "Next steps:"
echo " 1. Run: ./scripts/validate-setup.sh (pre-flight check)"
echo " 2. Read: cat README.md"
echo " 3. Start: cat CHECKLIST.md | head -300"
exit 0
else
echo -e "${RED}$FAIL_COUNT check(s) failed. Please review above.${NC}"
exit 1
fi