# 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.