From 170565391217b475e0fc69c72ed57af5a1fb1560 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 13 Oct 2026 02:53:54 +0200 Subject: [PATCH 1/2] Datafix harness: worlds saved before 1.17 stay in the branch's own .local until integrated --- tools/datafix_worlds.py | 11 ++++++++++- tools/test_datafix_parity.py | 12 ++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/datafix_worlds.py b/tools/datafix_worlds.py index 81c039cb7..ea7d9109c 100644 --- a/tools/datafix_worlds.py +++ b/tools/datafix_worlds.py @@ -38,6 +38,15 @@ LOCAL = ROOT / '.local' / 'datafix' # Old server jars and their worlds are inputs, not outputs: keep them beside the # vanilla data, which parallel worktrees share (.local/minecraft links there). SHARED = (ROOT / '.local' / 'minecraft').resolve().parent / 'datafix' +# Worlds saved before 1.17 are only read by branches that carry the fixes for them: until those are +# integrated they stay in the worktree's own .local, not in the folder every worktree's harness reads. +LEGACY = {'1.8.9', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1', '1.16.5'} + + +def worlds_dir(name): + return (LOCAL if name.split('-')[0] in LEGACY else SHARED) / 'worlds' + + VERSIONS = ['1.8.9', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1', '1.16.5', '1.17.1', '1.18.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.5', '1.20.6', '1.21.1', '1.21.3', '1.21.4', '1.21.5', '1.21.6', '1.21.8', '1.21.9', '1.21.10', '1.21.11', '26.1', '26.1.2', '26.2'] # Extra worlds of one version with another world type, for the level.dat generator settings: @@ -407,7 +416,7 @@ def build(name, force=False): version, props = VARIANTS.get(name, (name, None)) jar, data_version, protocol = server_jar(version) data_version = data_version or 0 # 1.8 saves have no DataVersion - target = SHARED / 'worlds' / name + target = worlds_dir(name) / name if target.exists() and not force: print(f'{version}: kept {target}') return [] diff --git a/tools/test_datafix_parity.py b/tools/test_datafix_parity.py index a07bf5557..412af1f3c 100644 --- a/tools/test_datafix_parity.py +++ b/tools/test_datafix_parity.py @@ -53,6 +53,10 @@ IGNORED = { } +def world_path(name): + return (LOCAL / 'worlds' if (LOCAL / 'worlds' / name).is_dir() else WORLDS) / name + + def java_classpath(): import oracle_harness as harness import test_rust_parity as base @@ -214,20 +218,20 @@ def main(): WORLDS.parent.mkdir(parents=True, exist_ok=True) with open(WORLDS.parent / 'generate.lock', 'w') as lock: fcntl.flock(lock, fcntl.LOCK_EX) # another worktree may be generating them - missing = [v for v in [*datafix_worlds.VERSIONS, *datafix_worlds.VARIANTS] if not (WORLDS / v / 'level.dat').exists()] + missing = [v for v in [*datafix_worlds.VERSIONS, *datafix_worlds.VARIANTS] if not (datafix_worlds.worlds_dir(v) / v / 'level.dat').exists()] if missing: print('generating sample worlds:', ' '.join(missing), flush=True) subprocess.run([sys.executable, str(ROOT / 'tools' / 'datafix_worlds.py'), *missing], cwd=ROOT, check=True) - worlds = sorted(p.name for p in WORLDS.iterdir() if p.is_dir()) + worlds = sorted(p.name for d in (WORLDS, LOCAL / 'worlds') if d.is_dir() for p in d.iterdir() if p.is_dir()) band = args.band if band and not args.versions: # worlds in the layout of before 1.16, saved before the target - worlds = [w for w in worlds if json.loads((WORLDS / w / 'datafix-source.json').read_text())['data_version'] < band] + worlds = [w for w in worlds if json.loads((world_path(w) / 'datafix-source.json').read_text())['data_version'] < band] versions = shard(args.versions or worlds) classpath = java_classpath() binary = None if args.vanilla_only else Path(args.binary) if args.binary else build_rust() total = 0 for version in versions: - world = WORLDS / version + world = world_path(version) source = json.loads((world / 'datafix-source.json').read_text()) print(f'{version} (DataVersion {source["data_version"]})') RUN.mkdir(parents=True, exist_ok=True) From b8ee0b27b3720212d008fa6aac6df83c7f6a354c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 13 Oct 2026 02:54:04 +0200 Subject: [PATCH 2/2] Datafix harness: pre-1.17 worlds in worlds-pre-1.17, which other worktrees' harnesses do not read --- tools/datafix_worlds.py | 2 +- tools/test_datafix_parity.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/datafix_worlds.py b/tools/datafix_worlds.py index ea7d9109c..13bb3f6dc 100644 --- a/tools/datafix_worlds.py +++ b/tools/datafix_worlds.py @@ -44,7 +44,7 @@ LEGACY = {'1.8.9', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1 def worlds_dir(name): - return (LOCAL if name.split('-')[0] in LEGACY else SHARED) / 'worlds' + return LOCAL / 'worlds-pre-1.17' if name.split('-')[0] in LEGACY else SHARED / 'worlds' VERSIONS = ['1.8.9', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1', '1.16.5', '1.17.1', '1.18.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.5', '1.20.6', '1.21.1', diff --git a/tools/test_datafix_parity.py b/tools/test_datafix_parity.py index 412af1f3c..8638c5cf1 100644 --- a/tools/test_datafix_parity.py +++ b/tools/test_datafix_parity.py @@ -54,7 +54,7 @@ IGNORED = { def world_path(name): - return (LOCAL / 'worlds' if (LOCAL / 'worlds' / name).is_dir() else WORLDS) / name + return (LOCAL / 'worlds-pre-1.17' if (LOCAL / 'worlds-pre-1.17' / name).is_dir() else WORLDS) / name def java_classpath(): @@ -222,7 +222,7 @@ def main(): if missing: print('generating sample worlds:', ' '.join(missing), flush=True) subprocess.run([sys.executable, str(ROOT / 'tools' / 'datafix_worlds.py'), *missing], cwd=ROOT, check=True) - worlds = sorted(p.name for d in (WORLDS, LOCAL / 'worlds') if d.is_dir() for p in d.iterdir() if p.is_dir()) + worlds = sorted(p.name for d in (WORLDS, LOCAL / 'worlds-pre-1.17') if d.is_dir() for p in d.iterdir() if p.is_dir()) band = args.band if band and not args.versions: # worlds in the layout of before 1.16, saved before the target worlds = [w for w in worlds if json.loads((world_path(w) / 'datafix-source.json').read_text())['data_version'] < band]