Generated version facts through lab.version_info; options and world harnesses take the data version from the jar

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Ludovic MarieandClaude Opus 5.5 committed 2026-10-21 12:22:20 +02:00
1 parent ce87bfb8c7
commit eee7786609
4 files changed
+5 -11

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ class GenVersionConstsTests(unittest.TestCase):
jar = Path(directory) / "client.jar"
with zipfile.ZipFile(jar, "w") as archive:
archive.writestr("version.json", json.dumps(INFO))
self.assertEqual(gen.jar_info(jar), INFO)
self.assertEqual(lab.version_info(jar), INFO)
def test_committed_file_is_the_pinned_version(self):
"""A pin bump regenerates version.rs: the lock and the constants never disagree."""
+2 -8
View File
@@ -15,7 +15,6 @@ from datetime import datetime, timezone
import json
from pathlib import Path
import sys
import zipfile
try:
from . import lab
@@ -25,11 +24,6 @@ except ImportError:
OUT = lab.ROOT / "crates/horizon-core/src/version.rs"
def jar_info(client_jar):
with zipfile.ZipFile(client_jar) as archive:
return json.loads(archive.read("version.json"))
def java_date(iso):
"""`Date.toString()` of an ISO-8601 instant, in UTC (Locale.ROOT names)."""
return datetime.fromisoformat(iso).astimezone(timezone.utc).strftime("%a %b %d %H:%M:%S UTC %Y")
@@ -69,8 +63,8 @@ def main():
parser.add_argument("--out", type=Path, default=OUT)
parser.add_argument("--check", action="store_true", help="exit 1 if --out differs instead of writing it")
args = parser.parse_args()
jar = args.jar or lab.config()[1] / "jars" / "client.jar"
text = render(jar_info(jar))
jar = args.jar or lab.GAME / "jars" / "client.jar"
text = render(lab.version_info(jar))
if args.check:
if not args.out.exists() or args.out.read_text() != text:
print(f"{args.out} does not match {jar}; run tools/gen_version_consts.py", file=sys.stderr)
+1 -1
View File
@@ -13,7 +13,7 @@ try:
except ImportError:
import lab, oracle_harness as harness
VERSION = 5023
VERSION = lab.version_info()['world_version']
# Raw JSON-ish value texts: valid, boundary, wrong-typed, lenient-parser and
# syntax-error forms. Syntax errors abort the rest of a load, as in vanilla.
+1 -1
View File
@@ -96,7 +96,7 @@ def main():
references.append({"side": side, "jar_sha256": lab.digest(jars[side], "sha256"), **results[0]})
print(json.dumps(references[-1]), flush=True)
test_rust_parity.ensure_sources_unchanged(sources, tested_sources)
report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "data_version": 5023,
report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "data_version": lab.version_info()["world_version"],
"platform": platform.platform(), "java": run(["java", "--version"]).splitlines()[0],
"rustc": run(["rustc", "--version"]).strip(), "references": references,
"sources_sha256": tested_sources,