# Sprint 11 Plan Review v2 โ€” 6-Expert Panel (Expanded Targets) **Date:** 2026-06-15 **Sprint Theme:** Quality Foundation โ€” Backend Test Coverage (Expanded) **Reviewer:** Roo (Plan Reviewer) โ€” 6-Expert Panel **Documents Reviewed:** analysis.md v2, plan.md v2, testplan.md v2 **Verdict:** โœ… APPROVED (94% confidence) --- ## Panel Composition | # | Expert | Domain | Focus | |---|--------|--------|-------| | ๐Ÿ›๏ธ | Domain Expert (CanG/Finance) | Cannabis law, German financial compliance | CanG ยง26 reporting, ยง147 AO Kassenbuch, GoBD immutability | | ๐Ÿ”ง | Architecture Expert | Spring Boot testing, Maven | JaCoCo config, Testcontainers patterns, test isolation, build performance | | ๐Ÿ›ก๏ธ | Risk/Compliance Expert | GDPR, financial audit | Retention logic, data anonymization, audit trail | | ๐Ÿงช | Test Engineering Expert | Test design, mutation testing | Test quality, assertion strength, coverage accuracy, boundary testing | | ๐Ÿ”’ | Security Expert | JWT, tenant isolation, input validation | Auth tests, XXE prevention, rate limiting, filename attacks | | ๐Ÿ“Š | Quality Metrics Expert | Code quality measurement, CI/CD | Coverage thresholds, build pipeline, metrics accuracy | --- ## Expert Assessments ### ๐Ÿ›๏ธ Domain Expert โ€” Cannabis Law & Financial Compliance **Score: 98%** โœ… | # | Check | Verdict | Comment | |---|-------|---------|---------| | 1 | CanG ยง26 annual authority report testing | โœ… | Expanded to 8 tests โ€” now includes U21 marking and quota breach highlighting | | 2 | Quota enforcement boundary testing | โœ… | NEW: 10 dedicated ComplianceServiceTest extensions cover every boundary (25g daily, 50g monthly, U21 10g, THC 15%) | | 3 | EรœR (ยง4/3 EStG) correctness | โœ… | EurReportGeneratorTest expanded to 8 tests with performance and single-cent edge case | | 4 | Kassenbuch GoBD compliance | โœ… | BankImportServiceTest: 14 tests including concurrent upload and undo confirm | | 5 | Distribution THC limits (U21 vs adult) | โœ… | ComplianceServiceTest now has explicit boundary tests for U21 THC% limits | | 6 | Financial amounts in cents | โœ… | FinanceServiceTest: added Integer.MAX_VALUE boundary and 1/3 split (odd-cent) tests | | 7 | Cross-midnight quota reset | โœ… | NEW: testQuota_CrossMidnight_ResetsDailyCounter ensures day boundary correctness | **Findings:** None blocking. The v2 plan significantly strengthens compliance coverage. The addition of exact boundary tests for every CanG quota (daily/monthly/U21/THC%) is excellent โ€” these are the exact edge cases that could lead to regulatory violations if miscalculated. --- ### ๐Ÿ”ง Architecture Expert โ€” Spring Boot Testing & Maven **Score: 93%** โœ… | # | Check | Verdict | Comment | |---|-------|---------|---------| | 1 | JaCoCo plugin configuration | โœ… | Correct โ€” 80% threshold, appropriate exclusions | | 2 | Maven Surefire parallelization | โœ… | Added forkCount=2, addresses v1 build time concern | | 3 | Testcontainers integration | โœ… | Extended to 25 integration tests (up from 12) | | 4 | Test module separation | โœ… | Unit tests in cannamanage-service, integration in cannamanage-api | | 5 | Build time impact | โš ๏ธ | 255 new tests with forkCount=2 โ€” may push past 7min target | | 6 | Concurrent test scenarios | โš ๏ธ | Multiple concurrent test methods (PaymentMatching, BankImport, Assembly) โ€” need careful thread safety in test setup | | 7 | Migration integration test | โœ… | NEW: MigrationIntegrationTest validates Flyway schema | **Findings:** โš ๏ธ **SHOULD (non-blocking):** With 275 total tests, even with `forkCount=2`, build time may approach 7 minutes. If it exceeds the target, consider: - Adding `methods` for unit tests (safe since each test is independent) - Splitting integration tests into a separate Maven profile activated by `-Pintegration` โš ๏ธ **SHOULD (non-blocking):** Concurrent test methods (`testMatch_ConcurrentMatching_ThreadSafe`, `testConcurrentUpload_SameFile_OnlyOneSucceeds`, `testConcurrentVotes_AllCounted`) require careful setup. Recommend using `CountDownLatch` + `ExecutorService` pattern with explicit timeout to avoid flaky behavior. --- ### ๐Ÿ›ก๏ธ Risk/Compliance Expert โ€” GDPR & Financial Audit **Score: 97%** โœ… | # | Check | Verdict | Comment | |---|-------|---------|---------| | 1 | Retention/anonymization logic tested | โœ… | RetentionServiceTest expanded to 10 tests with boundary and concurrent scenarios | | 2 | Exact boundary date verification | โœ… | NEW: testAnonymize_MemberLeftExactlyAtBoundary_NotEligible โ€” critical for GDPR | | 3 | Concurrent anonymization safety | โœ… | NEW: testAnonymize_ConcurrentRun_Idempotent prevents double-processing | | 4 | Financial data immutability | โœ… | FinanceIntegrationTest: testLedgerImmutability_CannotDeleteEntry | | 5 | GoBD session lifecycle | โœ… | BankImportIntegrationTest: 7 tests (up from 4) with concurrent and split scenarios | | 6 | Data isolation in all paths | โœ… | TenantFilterAspectTest: expanded to 8 tests covering every controller type | | 7 | Flyway migration integrity | โœ… | NEW: MigrationIntegrationTest ensures no orphan FKs or broken migrations | **Findings:** None blocking. The v2 plan closes the critical gap identified in the retention boundary test โ€” exact-day boundary testing is legally required for GDPR Article 17 compliance. The concurrent anonymization test prevents a production scenario where two scheduler triggers could process the same member simultaneously. --- ### ๐Ÿงช Test Engineering Expert โ€” Test Design & Quality **Score: 92%** โœ… | # | Check | Verdict | Comment | |---|-------|---------|---------| | 1 | Boundary testing systematic | โœ… | Excellent โ€” every numerical boundary has exact-at and one-over tests | | 2 | Edit window boundary (ForumService) | โœ… | NEW: Tests at 14:59 (pass) and 15:01 (fail) โ€” second-level precision | | 3 | Rate limiter boundary | โœ… | NEW: Exactly-at-limit (pass) vs one-over (fail) | | 4 | Concurrent scenarios realistic | โš ๏ธ | Good intent, but concurrent tests need deterministic assertions | | 5 | Test count achievable | โš ๏ธ | 255 new tests is ambitious โ€” ensure quality over quantity | | 6 | Mutation testing validation | โœ… | PITest spot-check on 3 critical classes maintained from v1 | | 7 | Malformed input variants | โœ… | Excellent โ€” Mt940: 16 variants, Camt053: 14 variants, CSV: 10 variants | | 8 | Idempotency testing | โœ… | Multiple idempotency tests: reaction toggle, double-RSVP, duplicate report | **Findings:** โš ๏ธ **SHOULD (non-blocking):** For concurrent test methods, define explicit success criteria beyond "no exception." Example: `testConcurrentPayments_SameMember_CorrectBalance` should assert the exact expected balance (not just that it ran without error). Use `AtomicInteger` counters or `CompletableFuture.allOf()` patterns. โš ๏ธ **INFO (non-blocking):** 255 new tests averages ~4.3 tests per test method listed in the plan. This is achievable if each test method is truly independent (one assert per test). Watch for tests that grow too complex โ€” split rather than combine. --- ### ๐Ÿ”’ Security Expert โ€” Auth, Isolation & Input Validation **Score: 98%** โœ… | # | Check | Verdict | Comment | |---|-------|---------|---------| | 1 | JWT `alg:none` attack | โœ… | NEW in v2: testValidateToken_NoneAlgorithm_ReturnsFalse โ€” critical OWASP JWT vector | | 2 | JWT signature swap (wrong key) | โœ… | NEW: testValidateToken_WrongSigningKey_ReturnsFalse | | 3 | JWT payload tampering | โœ… | NEW: testValidateToken_TamperedPayload_ReturnsFalse | | 4 | XXE billion laughs DoS | โœ… | NEW: testParse_XxeBillionLaughs_Rejected โ€” defends against memory exhaustion | | 5 | XXE SSRF | โœ… | NEW: testParse_XxeSsrf_Rejected โ€” confirms no outbound HTTP | | 6 | Path traversal: all vectors | โœ… | Expanded DocumentServiceTest: backslash, null byte, unicode slash, dangerous extensions | | 7 | Cross-tenant on all controllers | โœ… | TenantFilterAspectTest: 8 tests covering Finance, Member, Document, Report controllers | | 8 | Rate limiter boundary + IPv6 | โœ… | NEW: Boundary tests + IPv6 handling | | 9 | Empty/null JWT handling | โœ… | NEW: testValidateToken_EmptyString_ReturnsFalse โ€” no NPE | **Findings:** None. The v2 security test expansion is excellent. Every major JWT attack vector from the OWASP JWT cheat sheet is now covered. The XXE expansion from 1 test to 3 (standard, billion laughs, SSRF) is thorough. The filename attack vector expansion from 1 test to 5 variants covers all common bypass techniques. --- ### ๐Ÿ“Š Quality Metrics Expert โ€” Coverage & CI **Score: 92%** โœ… | # | Check | Verdict | Comment | |---|-------|---------|---------| | 1 | 80% overall threshold realistic | โš ๏ธ | Ambitious jump from 12% to 80% โ€” depends on entity/DTO exclusions working correctly | | 2 | 90% for financial packages achievable | โœ… | With 120 targeted financial tests, 90% is realistic for bankimport + FinanceService | | 3 | Per-package enforcement configured | โœ… | Plan specifies 5 tier coverage targets | | 4 | Build enforcement mechanism | โœ… | JaCoCo `check` goal fails build below 80% | | 5 | CI integration planned | โœ… | Gitea Actions with PostgreSQL service (stretch goal) | | 6 | Coverage report accessible | โœ… | HTML + XML output, artifact upload in CI | | 7 | Test-to-source ratio healthy | โœ… | ~275 tests / ~73 service classes โ‰ˆ 3.8 tests/class average โ€” reasonable | **Findings:** โš ๏ธ **SHOULD (non-blocking):** The 80% overall threshold is aggressive for a single sprint jump from 12%. Key risk: if JaCoCo's exclusion patterns don't fully exclude all DTOs/entities/config classes, the denominator stays large and 80% becomes harder to achieve. Mitigation: after Phase 2 is complete, run a coverage check early to validate the exclusion patterns work as expected. If needed, add more specific exclusion patterns. **Recommendation:** Add a "coverage checkpoint" after Phase 2 completion (120 tests done). If the exclusions are misconfigured, catching it after 120 tests is recoverable. Catching it after 255 tests is a wasted sprint. --- ## Panel Summary | Expert | Score | Blockers | Warnings | |--------|-------|----------|----------| | ๐Ÿ›๏ธ Domain (CanG/Finance) | 98% | 0 | 0 | | ๐Ÿ”ง Architecture (Spring Boot) | 93% | 0 | 2 | | ๐Ÿ›ก๏ธ Risk/Compliance (GDPR/Audit) | 97% | 0 | 0 | | ๐Ÿงช Test Engineering | 92% | 0 | 2 | | ๐Ÿ”’ Security | 98% | 0 | 0 | | ๐Ÿ“Š Quality Metrics | 92% | 0 | 1 | | **AVERAGE** | **95%** | **0** | **5** | --- ## Consolidated Findings ### โŒ Blockers (must fix before implementation) **None.** ### โš ๏ธ SHOULD-Fix (non-blocking, recommended) | # | Expert | Finding | Recommendation | |---|--------|---------|---------------| | 1 | ๐Ÿ”ง Architecture | Build time may exceed 7 min with 275 tests | Add `methods` for unit tests; split integration into `-Pintegration` profile | | 2 | ๐Ÿ”ง Architecture | Concurrent test methods need careful setup | Use `CountDownLatch` + `ExecutorService` with explicit timeout | | 3 | ๐Ÿงช Test Engineering | Concurrent tests need deterministic assertions | Assert exact expected state, not just "no exception" | | 4 | ๐Ÿงช Test Engineering | Quality over quantity with 255 tests | Keep each test focused โ€” split complex tests rather than combining | | 5 | ๐Ÿ“Š Quality Metrics | 80% threshold depends on correct exclusion patterns | Run coverage checkpoint after Phase 2 (120 tests) to validate exclusions | --- ## Traceability Verification | Requirement Source | Plan Coverage | Test Coverage | Status | |-------------------|--------------|--------------|--------| | Security review: 12% coverage flagged | Phase 1-6 (full sprint) | QC-02 thresholds (80%+) | โœ… Addressed | | Security review: Document IDOR | Phase 4.4 (DocumentServiceTest โ€” 12 tests) | QC-06d (tenant), filename attacks | โœ… Addressed | | Security review: Path traversal | Phase 4.4 (5 filename attack variants) | QC-06b | โœ… Addressed | | Security review: JWT dev-secret | Phase 4.1 (JwtServiceTest โ€” 12 tests) | QC-06c (alg:none, wrong key, tampered) | โœ… Addressed | | CanG ยง26 annual reporting | Phase 2.10 (8 tests) | QC-02e (compliance 90%) | โœ… Addressed | | CanG quota boundaries (daily/monthly/U21/THC) | Phase 2.12 (10 tests) | QC-02e | โœ… Addressed | | GoBD ยง147 AO immutability | Phase 2.6 + 5.1 (concurrent + split) | QC-05d (void reversal) | โœ… Addressed | | GDPR retention compliance | Phase 2.7 (10 tests incl. boundary) | QC-04e (edge cases) | โœ… Addressed | | Payment matching accuracy | Phase 2.2 (22 tests) | QC-05 (financial precision) | โœ… Addressed | | XXE prevention (all vectors) | Phase 2.4 (3 XXE variants) | QC-06a (XXE standard + DoS + SSRF) | โœ… Addressed | | Tenant isolation (all controllers) | Phase 4.3 (8 tests) | QC-06d | โœ… Addressed | | Migration integrity | Phase 5.5 (3 tests) | QC-01c (mvn verify) | โœ… Addressed | --- ## Comparison: v1 โ†’ v2 | Metric | v1 (Original) | v2 (Expanded) | Delta | |--------|--------------|---------------|-------| | Overall coverage target | 60% | 80% | +20pp | | Financial/Compliance target | 80% | 90% | +10pp | | Security target | 75% | 80% | +5pp | | Core Business target | 60% | 75% | +15pp | | New tests | 151 | 255 | +104 | | Total tests | 171 | 275 | +104 | | JaCoCo enforcement | 60% | 80% | +20pp | | Build parallelization | none | forkCount=2 | new | | JWT attack vectors tested | 2 | 6 | +4 | | XXE variants tested | 1 | 3 | +2 | | Filename attack variants | 1 | 5 | +4 | | Quota boundary tests | 0 | 10 | +10 | | Concurrent scenario tests | 0 | 8 | +8 | --- ## Verdict ### โœ… APPROVED โ€” Panel Confidence: 94% The expanded v2 plan is comprehensive, well-structured, and pushes the project from a dangerous 12% coverage to a robust 80% in a single dedicated sprint. The 255 new tests are ambitious but achievable given: 1. The tests are primarily Mockito-based unit tests (fast to write, fast to run) 2. The plan provides exact method signatures and scenarios โ€” minimal design time needed during implementation 3. Build parallelization (forkCount=2) mitigates the time overhead **Key strengths of v2 over v1:** - Systematic boundary testing on every numerical threshold (quotas, rate limiter, edit window, retention date) - Every JWT attack vector from OWASP now covered - Concurrent scenario testing addresses real production failure modes - XXE defense-in-depth (standard, billion laughs, SSRF) - Filename sanitization covers all known bypass techniques - Migration integrity test prevents deployment failures - Coverage checkpoint after Phase 2 provides early feedback loop **Key risk (mitigated):** The 80% threshold is aggressive. The recommended coverage checkpoint after Phase 2 ensures we catch exclusion pattern issues early. If the exclusions work correctly, 80% is achievable with 275 tests across 73 service classes. **Recommendation:** Proceed to implementation. Address the 5 SHOULD-findings during implementation as practical optimizations.