docs: update documentation with matching runs audit and complete test coverage

- Update README.md with current test statistics (342/342 tests passing)
- Add detailed breakdown of all matching/ratings test suites
- Create comprehensive TESTING_MATCHING_RATINGS.md guide covering all 45 tests
- Document matching runs audit, incremental matching, and scheduler features
- Add code coverage highlights and test scenarios
This commit is contained in:
Radosław Gierwiało
2025-11-30 20:10:25 +01:00
parent bd7212a599
commit 9af4447e1d
2 changed files with 600 additions and 6 deletions

View File

@@ -36,12 +36,16 @@ Web application (PWA) for the dance community enabling matchmaking, chat, and vi
-**Private 1:1 Chat** - private chat for matched users with Socket.IO and message history
-**Match Slugs** - secure random slugs (CUID) preventing ID enumeration
**Ratings & Reviews:**
**Ratings & Stats System:**
-**Partner Ratings** - rate collaboration partners (1-5 stars, comments)
-**Collaboration Preferences** - "would collaborate again" indicator
-**Public Rating Display** - ratings visible on public user profiles
-**Duplicate Prevention** - users can only rate each match once
-**Auto-completion** - matches auto-complete when both partners have rated
-**Stats Updates** - atomic recording stats updates (recordingsDone, recordingsReceived)
-**Source Filtering** - only auto-matches update fairness stats (manual matches excluded)
-**Race Condition Prevention** - statsApplied flag with atomic check-and-set
-**Idempotency** - double-rating prevention ensures stats update exactly once
**WebRTC P2P File Transfer:**
-**WebRTC Signaling** - SDP/ICE exchange via Socket.IO
@@ -80,6 +84,10 @@ Web application (PWA) for the dance community enabling matchmaking, chat, and vi
-**Event-specific Upgrades** - accountTierOverride for temporary tier boosts (e.g., Comfort Pass)
-**Multi-criteria Sorting** - Location > Fairness > Load balancing priority
-**Competitor Numbers** - bib number support for events
-**Matching Runs Audit** - complete audit trail with origin_run_id tracking
-**Incremental Matching** - preserves accepted/completed suggestions across re-runs
-**Scheduler Integration** - automated matching with cron-based scheduling
-**Admin Endpoints** - per-run statistics and suggestion filtering
**Security & PWA (All Implemented):**
-**Security Hardening** - CORS, CSRF, Helmet.js, account lockout, rate limiting
@@ -111,7 +119,7 @@ Web application (PWA) for the dance community enabling matchmaking, chat, and vi
- **bcrypt** - password hashing
- **JWT** - token-based authentication
- **AWS SES** - email service
- **Jest + Supertest** - testing (286 tests, 73% coverage)
- **Jest + Supertest** - testing (342 tests, 72.5% coverage, 100% passing)
### Infrastructure
- **Docker Compose** - container orchestration (dev + prod profiles)
@@ -481,15 +489,38 @@ REPL specifics:
## 📊 Test Coverage
**Backend: 73% overall coverage** (285/286 tests passing - 99.7%)
- **Matching Algorithm**: 30/30 tests passing (unit tests for collision detection, buffers, tier system)
- **WebRTC Signaling**: 7/7 tests passing (offer/answer/ICE relay, authorization)
**Backend: 72.5% overall coverage** (342/342 tests passing - 100% ✅)
- **Matching Algorithm**: 19/19 integration tests passing
- Phase 1: Fundamentals (TC1-3) - basic flow, NOT_FOUND scenarios
- Phase 2: Collision Detection (TC4-9) - buffers, slot mapping, schedule conflicts
- Phase 3: Limits & Workload (TC10-11) - MAX_RECORDINGS, recording-recording collisions
- Phase 4: Fairness & Tiers (TC12-16) - debt calculation, tier penalties
- Phase 5: Edge Cases (TC17-19) - multiple heats, incremental matching
- **Ratings & Stats Flow**: 9/9 E2E tests passing
- Double-rating completion flow
- Atomic stats updates (recordingsDone, recordingsReceived)
- Race condition prevention (statsApplied flag)
- Manual vs auto match differentiation
- Idempotency testing
- **Matching Runs Audit**: 6/6 tests passing
- origin_run_id assignment and tracking
- Sequential runs with separate IDs
- Accepted suggestions preservation
- Filter parameters (onlyAssigned, includeNotFound)
- Manual vs scheduler trigger differentiation
- **Incremental Matching**: 5/5 tests passing
- **Recording Stats Integration**: 6/6 tests passing
- **WebRTC Signaling**: 12/12 tests passing (offer/answer/ICE relay, authorization)
- **Auth Controllers**: Comprehensive coverage
- **Events API**: Full test suite
- **Matches API**: Full CRUD tests
- **Dashboard API**: 12 tests passing
- **Socket.IO**: Full WebRTC + chat coverage (1 flaky timeout test)
- **Socket.IO**: Full WebRTC + chat coverage (12/12 passing)
- **Test Isolation**: Fixed with unique test data per suite
- **Code Coverage Highlights**:
- matching.js: 94.71% statements, 91.5% branches
- routes/matches.js: 76.11% statements
- routes/events.js: 78.2% statements
**Frontend: Test files ready** (requires test runner setup)
- WebRTC detection utility tests