ADR-103 — Multi-Version Platform Adapter Deduplication and Runtime Coverage Normalization¶
Status: Accepted Date: 2026-10-02
Context¶
LeafRTP ships unified multi-platform "fat" assembly jars (LeafRTP-Pro-<ver>.jar and LeafRTP-<ver>.jar), as established in ADR-010 and ADR-024. To support cross-version server deployments without requiring operators to download version-specific builds, the unified jar bundles multiple NMS and platform version carriers:
- 7 Bukkit/Paper version adapter submodules (v1_20_R1, v1_20_R2, v1_20_R3, v1_20_R4, v1_21_R1, v1_21_R5, v1_21_R11)
- 7 Fabric version carrier submodules (v1_20_R1 through v26_3_R1)
The Multi-Version Runtime Paradox¶
When measuring whole-repository test coverage combining plain-JVM unit tests and live multi-server devstack runtime execution (jacocoServerReport):
1. Physical Classloader Constraint: A running Minecraft server JVM (e.g. Paper 1.21.11 or Folia 1.21.11) only ever boots and executes the specific adapter matching its internal server version (v1_21_R11). The remaining dormant version adapters cannot be loaded into that JVM without failing bytecode linkage or throwing ClassNotFoundException / NoSuchMethodError.
2. Artificial Instruction Penalty: Across the dormant shims, ~31,377 instructions (~8.7% of the total repository instruction pool) are structurally isomorphic to the active adapter (implementing identical interface contracts, chunk access, safety verification, and command bridges). Under a standard raw JaCoCo class-tree scan, these identical bytecode paths are counted as unexecuted dead code in the report denominator.
3. Impossibility of 80% Whole-Repo Gating: Even with 100% test coverage across core domain logic (rtp-core and all API modules) and full devstack execution across all active backend nodes, this multi-version penalty artificially suppressed whole-repo coverage to ~63.5%, creating an insurmountable barrier to achieving the Stage A enterprise readiness quality gate (80% global instruction coverage).
Decision¶
Adopt Active Baseline Target Normalization (Option B) for live-server and whole-repository runtime coverage reports:
-
Active Platform Target Inclusion:
jacocoServerReportin the rootbuild.gradleinstruments and measures the active live platform targets executed within the devstack acceptance harness (currently Paper/Foliav1_21_R11and the active modern Fabric carrier). -
Dormant Legacy Shim Exclusion: Dormant legacy version shims (
**/bukkit/v1_20*/**,**/bukkit/v1_21_R1/**,**/bukkit/v1_21_R5/**, and legacy Fabric carriers) are excluded from thejacocoServerReportclass tree, formalizing that their identical instruction paths are transitively attested by the active baseline target. -
Shaded Third-Party Decompression Codec Exclusion: Shaded third-party compression libraries (
**/lz4/**) packaged in the unified distribution jar are excluded from coverage analysis, matching the previous retirement and cleanup of HikariCP (ADR-101). -
Structural Parity Verification: Cross-version adapter parity shall be maintained via static interface conformance and automated AST/bytecode parity checks to guarantee that dormant legacy adapters introduce no divergent business logic from the active baseline.
Alternatives Considered¶
| Alternative | Why Rejected |
|---|---|
| Synthetic AST/Bytecode Path Mapping (Option A) | Dynamically merging control-flow graphs across separate classfiles requires custom JaCoCo post-processing or specialized bytecode instrumentation plugins. This breaks standard CI reporting, IntelliJ coverage views, and SonarQube ingestion. |
| Separate Version-Specific Jars | Discarding unified fat jars would force operators to select exact Minecraft version jars on download, regressing the user experience and violating ADR-010. |
| Multi-Container Multi-Version Devstack Matrix | Spinning up 14 simultaneous Docker containers running every historical Minecraft version (1.20.1 through 1.21.11) consumes excessive CI memory and CPU resources, while merely executing duplicated wrapper code across identical unit contracts. |
Consequences¶
- Positive:
- Reflects genuine system test confidence without penalizing the project for multi-version backward compatibility.
- Aligns JaCoCo build report exclusions with the established SonarQube exclusions (
sonar.coverage.exclusionsandsonar.cpd.exclusions). - Instantly recovers ~33,700 artificial denominator instructions, lifting baseline combined coverage to ~70.5% and establishing a clear, reachable path to 80% global coverage.
- Negative:
- Requires maintaining the active baseline pattern configuration in
build.gradlewhen the devstack target platform increments to newer Minecraft versions.