Skip to content

Commit 51dc7dc

Browse files
jeremyedergithub-actions[bot]claude
authored
feat: Add all 11 pattern implementations with E2E tests (#20)
- AQE: Added check.sh, auto-fix.sh, validate.yml workflow - CBA: Updated codebase-agent.md with self-review protocol - Dependabot: Added dependabot-auto-merge.yml workflow - GHA: Added e2e-pattern-tests.yml with parallel execution - Issue-to-PR: Added issue-to-pr.yml workflow - Multi-Agent: Added multi-agent review support in pr-review.yml - PR Review: Added pr-review.yml auto-review workflow - Security: Added src/core/security.py with sanitization functions - Self-Review: Added self-review checklist to codebase-agent.md - Stale: Added stale.yml workflow for issue management - Testing: Added pytest test pyramid (unit, integration, e2e) All 11 E2E pattern tests pass locally. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e2021e2 commit 51dc7dc

34 files changed

+1943
-1
lines changed

.claude/agents/codebase-agent.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,50 @@ Testing strategies:
255255
- All tests pass
256256
```
257257

258+
## Self-Review Protocol
259+
260+
Before presenting work, perform a self-review by switching perspective to act as a reviewer:
261+
262+
### Self-Review Checklist
263+
264+
1. **Edge Cases Considered?**
265+
- Null/empty inputs
266+
- Boundary conditions
267+
- Error states
268+
269+
2. **Security Issues Addressed?**
270+
- Input validation at boundaries
271+
- Sanitization applied
272+
- No hardcoded secrets
273+
274+
3. **Error Handling Complete?**
275+
- Exceptions caught appropriately
276+
- User-friendly error messages
277+
- Rollback on failure
278+
279+
4. **Assumptions Clearly Stated?**
280+
- Document non-obvious decisions
281+
- Note limitations
282+
283+
### Self-Review Process
284+
285+
```text
286+
1. Complete implementation
287+
2. Switch perspective: "As a reviewer, what would I flag?"
288+
3. Check each item in checklist above
289+
4. Fix any issues found
290+
5. If significant fix made, note: "Self-review: Fixed [issue]"
291+
6. Maximum 2 self-review iterations to prevent infinite loops
292+
```
293+
294+
### Example Self-Review Note
295+
296+
```markdown
297+
Self-review: Fixed edge case for null input in validate_slug()
298+
- Original code would throw NullPointerException
299+
- Added early return for null/empty values
300+
```
301+
258302
## Error Handling
259303

260304
When errors occur:

.github/scripts/auto-fix.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Auto-fix script for Autonomous Quality Enforcement (AQE) pattern
3+
# This script automatically fixes common issues
4+
5+
set -e
6+
7+
echo "=== Running AQE Auto-Fix ==="
8+
9+
# Fix markdown linting issues
10+
if command -v markdownlint &> /dev/null; then
11+
echo "Running markdownlint --fix..."
12+
markdownlint docs/**/*.md README.md CLAUDE.md CONTRIBUTING.md --fix 2>/dev/null || true
13+
echo "✅ Markdown auto-fix complete"
14+
else
15+
echo "⚠️ markdownlint not installed, skipping markdown fixes"
16+
fi
17+
18+
# Fix trailing whitespace
19+
echo "Removing trailing whitespace..."
20+
find docs -name "*.md" -exec sed -i 's/[[:space:]]*$//' {} \; 2>/dev/null || true
21+
echo "✅ Trailing whitespace removed"
22+
23+
# Ensure files end with newline
24+
echo "Ensuring files end with newline..."
25+
find docs -name "*.md" -exec sh -c 'tail -c1 "$1" | read -r _ || echo >> "$1"' _ {} \; 2>/dev/null || true
26+
echo "✅ Newlines added"
27+
28+
echo ""
29+
echo "=== AQE Auto-Fix Complete ✅ ==="
30+
echo "Run check.sh to verify all issues are resolved"

.github/scripts/check.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Validation script for Autonomous Quality Enforcement (AQE) pattern
3+
# This script runs all quality checks and returns non-zero on failure
4+
5+
set -e
6+
7+
echo "=== Running AQE Validation Checks ==="
8+
9+
# Check if markdownlint is available
10+
if command -v markdownlint &> /dev/null; then
11+
echo "Running markdownlint..."
12+
markdownlint docs/**/*.md README.md CLAUDE.md CONTRIBUTING.md 2>/dev/null || {
13+
echo "❌ Markdown linting failed"
14+
exit 1
15+
}
16+
echo "✅ Markdown linting passed"
17+
else
18+
echo "⚠️ markdownlint not installed, skipping markdown checks"
19+
fi
20+
21+
# Validate documentation structure
22+
echo "Checking documentation structure..."
23+
test -d docs/patterns || { echo "❌ docs/patterns/ missing"; exit 1; }
24+
test -f docs/README.md || { echo "❌ docs/README.md missing"; exit 1; }
25+
test -d docs/adr || { echo "❌ docs/adr/ missing"; exit 1; }
26+
echo "✅ Documentation structure valid"
27+
28+
# Check for required CLAUDE.md
29+
test -f CLAUDE.md || { echo "❌ CLAUDE.md missing"; exit 1; }
30+
echo "✅ CLAUDE.md exists"
31+
32+
# Check for required agent configuration
33+
test -f .claude/agents/codebase-agent.md || { echo "❌ .claude/agents/codebase-agent.md missing"; exit 1; }
34+
echo "✅ Codebase agent configuration exists"
35+
36+
# Check for context files
37+
test -d .claude/context || { echo "❌ .claude/context/ missing"; exit 1; }
38+
echo "✅ Context directory exists"
39+
40+
echo ""
41+
echo "=== All AQE Validation Checks Passed ✅ ==="
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# Run all E2E pattern tests and report results
3+
4+
set -e
5+
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
FAILED=0
8+
PASSED=0
9+
RESULTS=""
10+
11+
echo "=========================================="
12+
echo " Pattern Validation E2E Test Suite"
13+
echo "=========================================="
14+
echo ""
15+
16+
run_test() {
17+
local test_name=$1
18+
local test_script=$2
19+
20+
echo "Running: $test_name"
21+
echo "---"
22+
23+
if bash "$SCRIPT_DIR/$test_script"; then
24+
PASSED=$((PASSED + 1))
25+
RESULTS="$RESULTS\n✅ $test_name"
26+
else
27+
FAILED=$((FAILED + 1))
28+
RESULTS="$RESULTS\n❌ $test_name"
29+
fi
30+
echo ""
31+
}
32+
33+
# Run all pattern tests
34+
run_test "Pattern 1: AQE" "test-pattern-1-aqe.sh"
35+
run_test "Pattern 2: CBA" "test-pattern-2-cba.sh"
36+
run_test "Pattern 3: Dependabot" "test-pattern-3-dependabot.sh"
37+
run_test "Pattern 4: GHA" "test-pattern-4-gha.sh"
38+
run_test "Pattern 5: Issue-to-PR" "test-pattern-5-issue-to-pr.sh"
39+
run_test "Pattern 6: Multi-Agent" "test-pattern-6-multi-agent.sh"
40+
run_test "Pattern 7: PR Review" "test-pattern-7-pr-review.sh"
41+
run_test "Pattern 8: Security" "test-pattern-8-security.sh"
42+
run_test "Pattern 9: Self-Review" "test-pattern-9-self-review.sh"
43+
run_test "Pattern 10: Stale" "test-pattern-10-stale.sh"
44+
run_test "Pattern 11: Testing" "test-pattern-11-testing.sh"
45+
46+
# Summary
47+
echo "=========================================="
48+
echo " Test Results Summary"
49+
echo "=========================================="
50+
echo -e "$RESULTS"
51+
echo ""
52+
echo "Passed: $PASSED / $((PASSED + FAILED))"
53+
echo "Failed: $FAILED / $((PASSED + FAILED))"
54+
echo ""
55+
56+
if [[ $FAILED -gt 0 ]]; then
57+
echo "❌ SOME TESTS FAILED"
58+
exit 1
59+
else
60+
echo "✅ ALL TESTS PASSED"
61+
exit 0
62+
fi
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# E2E Test: Pattern 1 - Autonomous Quality Enforcement (AQE)
3+
# Tests that check.sh and auto-fix.sh work correctly
4+
5+
set -e
6+
7+
echo "=== E2E Test: Pattern 1 - AQE ==="
8+
9+
# Test 1: Verify check.sh exists and is executable
10+
echo "Test 1: Verify check.sh exists..."
11+
if [[ -x ".github/scripts/check.sh" ]]; then
12+
echo "✅ check.sh exists and is executable"
13+
else
14+
echo "❌ check.sh missing or not executable"
15+
exit 1
16+
fi
17+
18+
# Test 2: Verify auto-fix.sh exists and is executable
19+
echo "Test 2: Verify auto-fix.sh exists..."
20+
if [[ -x ".github/scripts/auto-fix.sh" ]]; then
21+
echo "✅ auto-fix.sh exists and is executable"
22+
else
23+
echo "❌ auto-fix.sh missing or not executable"
24+
exit 1
25+
fi
26+
27+
# Test 3: Verify validate.yml workflow exists
28+
echo "Test 3: Verify validate.yml workflow exists..."
29+
if [[ -f ".github/workflows/validate.yml" ]]; then
30+
echo "✅ validate.yml workflow exists"
31+
else
32+
echo "❌ validate.yml workflow missing"
33+
exit 1
34+
fi
35+
36+
# Test 4: Run check.sh and verify it executes
37+
echo "Test 4: Run check.sh..."
38+
if .github/scripts/check.sh; then
39+
echo "✅ check.sh executed successfully"
40+
else
41+
echo "❌ check.sh failed"
42+
exit 1
43+
fi
44+
45+
# Test 5: Verify CLAUDE.md has AQE process rule
46+
echo "Test 5: Verify AQE process rule in CLAUDE.md..."
47+
if grep -q "Autonomous Quality Enforcement" CLAUDE.md; then
48+
echo "✅ AQE process rule found in CLAUDE.md"
49+
else
50+
echo "❌ AQE process rule missing from CLAUDE.md"
51+
exit 1
52+
fi
53+
54+
echo ""
55+
echo "=== Pattern 1 (AQE): ALL TESTS PASSED ✅ ==="
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
# E2E Test: Pattern 10 - Stale Issue Management
3+
# Tests that stale workflow is properly configured
4+
5+
set -e
6+
7+
echo "=== E2E Test: Pattern 10 - Stale Issue Management ==="
8+
9+
WORKFLOW=".github/workflows/stale.yml"
10+
11+
# Test 1: Verify workflow exists
12+
echo "Test 1: Verify stale.yml exists..."
13+
if [[ -f "$WORKFLOW" ]]; then
14+
echo "✅ stale.yml exists"
15+
else
16+
echo "❌ stale.yml missing"
17+
exit 1
18+
fi
19+
20+
# Test 2: Verify uses actions/stale
21+
echo "Test 2: Verify uses actions/stale..."
22+
if grep -q "actions/stale" "$WORKFLOW"; then
23+
echo "✅ Uses actions/stale"
24+
else
25+
echo "❌ Does not use actions/stale"
26+
exit 1
27+
fi
28+
29+
# Test 3: Verify schedule trigger configured
30+
echo "Test 3: Verify schedule trigger..."
31+
if grep -q "schedule" "$WORKFLOW"; then
32+
echo "✅ Schedule trigger configured"
33+
else
34+
echo "❌ Schedule trigger not configured"
35+
exit 1
36+
fi
37+
38+
# Test 4: Verify days-before-stale configured
39+
echo "Test 4: Verify stale timing configured..."
40+
if grep -q "days-before-stale" "$WORKFLOW"; then
41+
echo "✅ Stale timing configured"
42+
else
43+
echo "❌ Stale timing not configured"
44+
exit 1
45+
fi
46+
47+
# Test 5: Verify exempt labels configured
48+
echo "Test 5: Verify exempt labels..."
49+
if grep -q "exempt" "$WORKFLOW"; then
50+
echo "✅ Exempt labels configured"
51+
else
52+
echo "❌ Exempt labels not configured"
53+
exit 1
54+
fi
55+
56+
# Test 6: Verify stale message configured
57+
echo "Test 6: Verify stale message..."
58+
if grep -q "stale-issue-message\|stale-pr-message" "$WORKFLOW"; then
59+
echo "✅ Stale message configured"
60+
else
61+
echo "❌ Stale message not configured"
62+
exit 1
63+
fi
64+
65+
echo ""
66+
echo "=== Pattern 10 (Stale): ALL TESTS PASSED ✅ ==="
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
# E2E Test: Pattern 11 - Testing Patterns
3+
# Tests that test pyramid structure exists and tests pass
4+
5+
set -e
6+
7+
echo "=== E2E Test: Pattern 11 - Testing Patterns ==="
8+
9+
# Test 1: Verify tests directory exists
10+
echo "Test 1: Verify tests directory exists..."
11+
if [[ -d "tests" ]]; then
12+
echo "✅ tests directory exists"
13+
else
14+
echo "❌ tests directory missing"
15+
exit 1
16+
fi
17+
18+
# Test 2: Verify unit tests directory exists
19+
echo "Test 2: Verify unit tests directory..."
20+
if [[ -d "tests/unit" ]]; then
21+
echo "✅ tests/unit exists"
22+
else
23+
echo "❌ tests/unit missing"
24+
exit 1
25+
fi
26+
27+
# Test 3: Verify integration tests directory exists
28+
echo "Test 3: Verify integration tests directory..."
29+
if [[ -d "tests/integration" ]]; then
30+
echo "✅ tests/integration exists"
31+
else
32+
echo "❌ tests/integration missing"
33+
exit 1
34+
fi
35+
36+
# Test 4: Verify e2e tests directory exists
37+
echo "Test 4: Verify e2e tests directory..."
38+
if [[ -d "tests/e2e" ]]; then
39+
echo "✅ tests/e2e exists"
40+
else
41+
echo "❌ tests/e2e missing"
42+
exit 1
43+
fi
44+
45+
# Test 5: Verify pytest.ini exists
46+
echo "Test 5: Verify pytest.ini exists..."
47+
if [[ -f "pytest.ini" ]]; then
48+
echo "✅ pytest.ini exists"
49+
else
50+
echo "❌ pytest.ini missing"
51+
exit 1
52+
fi
53+
54+
# Test 6: Verify conftest.py exists
55+
echo "Test 6: Verify conftest.py exists..."
56+
if [[ -f "tests/conftest.py" ]]; then
57+
echo "✅ conftest.py exists"
58+
else
59+
echo "❌ conftest.py missing"
60+
exit 1
61+
fi
62+
63+
# Test 7: Run all tests
64+
echo "Test 7: Run full test suite..."
65+
if python -m pytest tests/ -v --tb=short 2>&1; then
66+
echo "✅ All tests passed"
67+
else
68+
echo "❌ Some tests failed"
69+
exit 1
70+
fi
71+
72+
echo ""
73+
echo "=== Pattern 11 (Testing): ALL TESTS PASSED ✅ ==="

0 commit comments

Comments
 (0)