feat(serve): add recurring pattern detection endpoint (GH-318)#371
feat(serve): add recurring pattern detection endpoint (GH-318)#371
Conversation
b72a0a0 to
46defcb
Compare
Code Review: PR #371 (Round 1)SummaryAdds Key FindingsCritical Issues (P0)None. High Priority (P1)
Testing ReviewCoverage
Convention Compliance
Testing Verdict: AdequateVerdict: Changes RequestedFixing P1 issues and will re-review. Round 1 of automated review-fix loop |
Code Review: PR #371 (Round 2) — LGTM 🎉All P0 and P1 issues have been resolved. SummaryThe pattern detection endpoint is well-implemented with clean SQL queries, proper error handling, and good test coverage (5 ledger + 2 HTTP = 7 tests). Fixes applied in round 2:
All 256 tests pass (159 ledger + 97 serve), clippy clean, fmt clean. Verdict: LGTM ✅No critical or high-priority issues remaining. This PR is ready for merge. Completed after 2 round(s) of automated review-fix loop |
Add GET /api/patterns endpoint to detect recurring governance patterns within a village's decisions. Three pattern types are detected: - recurring_decision: same key changed >= N times in window - chief_repeated_action: same authority+key >= N times - rollback_trend: supersession chains with trend direction Query params: village_id (required), lookback_days (default 7, max 90), min_occurrences (default 3, min 2). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rn types - Remove dead code (unused after_date/last_date and unreachable else branch) - Return false for duplicate dates (burst != trend) - Re-export DetectedPattern, PatternType, PatternDetectionResult from lib.rs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b6f05f0 to
768df4b
Compare
Summary
GET /api/patternsendpoint for detecting recurring governance patterns in village decisionsdetect_village_patterns()inedda-ledgerwith three SQL-based pattern types: recurring decisions, chief repeated actions, and rollback trendsAPI
Returns
PatternDetectionResultwith detected patterns array.Files Changed
crates/edda-ledger/src/sqlite_store.rsdetect_village_patterns()+ 5 testscrates/edda-ledger/src/ledger.rscrates/edda-serve/src/lib.rsTest plan
cargo fmt --checkpassescargo clippy -p edda-ledger -p edda-serve --all-targetspassesCloses #318
🤖 Generated with Claude Code