Documentation

Build, CI/CD & replay

Reproducible Gradle 8.14.3 builds, repository layout, protected GitHub Actions workflows, and offline SHA-256 replay verification.

MTR Memory Saver v0.4.9 targets Official MTR 4.1.0-beta.2 through 18 Mixins & Accessors (13 common + 5 official-target). See Technical principles for the full four-layer architecture diagram, 7 -D properties, and 18-Mixin inventory, and Runtime contract & review for concurrency and cancellation invariants.


Four-Layer Runtime Summary

  1. Exact Binary Identity Gate (CompatibilityPlugin / BinaryFingerprint): Streams the active MTR JAR SHA-256 during Mixin onLoad and throws MixinInitialisationError (exit 1) before any vehicle registration if bytes differ from ff2b753d03f2bcc000d053a9014e4250c8ba720daa9b69b6899fe7dc26be1efa.
  2. Two-Level Bounded Single-Flight Scheduling (GenerationWorkCache): Checks L1 path keys to skip I/O and hashing; enforces a fair 2 + 64 semaphore queue; releases snapshot channels and read permits before L2 Blockbench content-alias waiters attach; isolates .mtl materials per path (StreamedObjCache); retires reload generations atomically under a single lock (beginReload()).
  3. Single-Pass Streaming Snapshots & 96 MiB LRU (SnapshotResourceProvider / Utf16TextSnapshot): Wraps only the 5 audited official ResourceProvider entry points, streaming .bbmodel / .obj / .mtl through a single CREATE_NEW | READ | WRITE | DELETE_ON_CLOSE channel while computing UTF-8 SHA-256 in one FilterReader pass; spills oversized legacy readResource calls safely via fair-share TextWorkspace; caps retained text in a 96 MiB Deflater.BEST_SPEED LRU.
  4. Lossless 36B Compressed Meshes & Shared JSON (PackedVertices / DisplayRetention / VehicleJsonCache): Compresses CPU-side StoredVertexData into fixed 36-byte chunks preserving exact raw float bits and AABB collision boxes; retains PartType.DISPLAY transforms only; shares identical non-empty vehicle JsonObject trees per epoch.

Reproducible Source Builds (BUILDING.md)

Building and running headless test suites require Java 21 JDK (JAVA_HOME) and optional Python 3 (requirements-test.txt). The checked-in Gradle 8.14.3 wrapper verifies its own distribution checksum and ModDevGradle downloads/caches dependencies directly—never reading any game-test instance marker or launcher-private Python API:

# Clone repository (use PowerShell 7 + ./gradlew.bat on Windows; ./gradlew on Linux/macOS)
git clone https://github.com/teamCreating/MTR-Memory-Saver.git
cd MTR-Memory-Saver

# Build the default official-nf265 JAR and .build.json identity manifest
./gradlew.bat build -Ptarget=official-nf265

# Supply an explicit audited JAR or run offline with cached Gradle dependencies
./gradlew.bat build -Ptarget=v6-nf265 -PmtrJar="<exact custom MTR JAR>"
./gradlew.bat build --offline

# Produce deterministic release ZIP + .build.json under build/releases/
./gradlew.bat releaseBundle
  • Single Matrix Authority: config/targets.json selects source directories, exact MTR SHA-256, exact NeoForge version, metadata, and Mixin sets; gradle.properties holds the sole version string.
  • Deterministic Outputs: build/libs/ outputs the target-named JAR and .build.json manifest (stable timestamps and entry order so clean rebuilds yield identical JAR SHA-256 digests); optional probeJar diagnostic tools are excluded from standard bundles.
  • Artwork: src/main/resources/pack.png (512x512 RGBA) is committed in-repo; standard builds need no Pillow or requirements-artwork.txt.

Repository Layout

  • src/main/java/ — Shared Mixins, bounded scheduler, streaming snapshots, text workspace/LRU, packed mesh store, JSON/display sharing
  • src/targets/official/java/ — Official MTR 4.1.0-beta.2 adapters (StreamedObjCache, ResourceTextReadMixin, VertexColorMixin, etc.)
  • src/targets/v6/java/ — Historical custom Performance v6 ABI target (currently paused)
  • config/ — Authoritative build matrix (targets.json) and frozen experiment policies
  • evidence/ & performance/ — Immutable, hash-indexed failure/pass captures with offline verify_sealed.py replay scripts
  • tools/ & tests/ — Acceptance harnesses, JFR/Spark exporters, and 354 Python regression tests

CI/CD & Branch Protection (CI_CD.md)

  1. Cross-Platform CI (.github/workflows/build.yml): Runs on Linux and Windows Server 2022 across pushes, PRs to main, merge groups, and releases—executing Python tests (minecraft_testkit verify/test), official target builds, Java unit suites, independent observer tests, and bundle verification (Windows Server CI does not substitute for live Windows 10 gameplay acceptance).
  2. Rulesets (.github/main-ruleset.json / release-tags-ruleset.json): main requires PRs, linear history (squash or rebase), and all required CI checks with no admin bypass; v* release tags cannot be edited or deleted.
  3. Automated Release & Dry-Run (.github/workflows/release.yml): Pushing a matching tag (v0.4.9) re-runs full CI, validates .zip/.jar manifests and fingerprints, and publishes formal tags as Latest using docs/releases/<tag>.md (hyphenated tags publish as pre-release). Manual workflow runs dry-run all build and fingerprint checks without creating a tag or GitHub Release.

Local Verification & Offline Cryptographic Replay

Headless Java & Python Suites

# Run all 106 Java unit & regression tests (including -Xmx64M OOM controls)
./gradlew.bat test

# Verify 682 historical script entries and run 354 Python tool tests
python -m pip install -r requirements-test.txt
python -X utf8 -m minecraft_testkit verify
python -X utf8 -m minecraft_testkit test

Read-Only Offline Evidence Replay

No Minecraft installation is required to audit sealed payload hashes, log prefix chains, and outlier sensitivity reports from evidence/ (exit code 0 confirms complete consistency):

# Read-only replay of 20-reload passes and negative OOM controls
python -X utf8 evidence/engineering-056/nf265-reload20/verify_sealed.py
python -X utf8 evidence/engineering-052/revised048-reload20/verify_sealed.py
python -X utf8 evidence/engineering-051/streamed051a-reload-oom/verify_sealed.py

# Scripts writing summary JSON into temporary .cache/
python -X utf8 evidence/engineering-050/owned049d-reload-attempt03-oom/verify_sealed.py .cache/recheck-050.json
python -X utf8 tools/client_outlier_analysis.py --assessment evidence/engineering-054/practical-spark/assessment.json --output .cache/recheck-054-outlier.json

Five-Point Audit Checklist

  • Artifact Identity: Match build/libs/*.build.json against the 64-character SHA-256 digests in Stage records & hashes.
  • Fixture Scope: Distinguish legacy 16 packs (2,541 vehicles for v0.1–v0.3) from native-catalogue 16 packs (1,092 declarations / 1,091 IDs + 974 OBJ for 0.4.x).
  • Preserved Failures: Confirm engineering-050 (0/20), 051 (0/20), 054 (12-JVM fail), and 0.4.2 (inconclusive) remain intact in raw summaries.
  • Per-Epoch Log Attribution: Confirm native-invalid-model.jsonl matches native-diagnostic-review.json 1:1 per epoch without regex ignores.
  • Boundary Separation: Never extrapolate single-input microbenchmarks or 20/20 reload endurance as a substitute for the pending 48-JVM whole-client benchmark.