Files
WoW-Hybrid-gateway/tests/map_new_TEX1068_binding_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

52 lines
3.1 KiB
Python

"""Only530 new TEX roles; current9344 body proof and existing520 are reused."""
import collections
import hashlib
import json
from pathlib import Path
import sys
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from map_asset_preflight import adt_split_candidate
from map_new_active_family_split_test import verify_tex_binding_and_layers
J=Path('runtime/rea-system-jobs-20261022/terrain-TEX1068-binding-closure-20261025')
work=json.loads((J/'affected-and-new-TEX1068-worklist.json').read_text())
bindings={r['source_path']:r['file_data_id'] for r in json.loads(Path(work['canonical_bindings']).read_text())['aliases']}
assert work['action_counts']==dict(new_TEX0_role=530,held_missing_Source_texture=18,unchanged_existing_reused=520)
assert work['alpha8_affected']==0 and work['ambiguous_existing_rebindings']==0
selected=[r for r in work['rows'] if r['action']=='new_TEX0_role']
assert len(selected)==530
out=J/'private-new530-TEX0';out.mkdir(exist_ok=True)
progress=J/'completed-new530-TEX0.jsonl'
rows=[json.loads(line) for line in progress.read_text().splitlines()] if progress.exists() else []
done={r['source_reference'] for r in rows}
for row in selected:
path=row['source_reference']
if path in done:continue
filename=out/(Path(path).stem+'.tex0.adt');assert not filename.exists()
tile=tuple(map(int,Path(path).stem.rsplit('_',2)[1:]))
raw=Path(row['Source_payload']).read_bytes()
output,audit=adt_split_candidate(raw,tile,file_data_ids=bindings,roles=('tex0',))
assert set(output)=={'tex0'}
names=verify_tex_binding_and_layers(raw,output['tex0'],bindings)
assert set(names)==set(row['required_MTEXT_paths'])
filename.write_bytes(output['tex0'])
result=dict(source_reference=path,cohort=row['cohort'],TEX0_file=str(filename),
bytes=len(output['tex0']),sha256=hashlib.sha256(output['tex0']).hexdigest(),
MDID_source_paths_in_order=names,source_available_bindings=[bindings[p] for p in names],
Source_raw_layer_alpha_shadow_payloads_preserved=True,publishable=False)
rows.append(result)
with progress.open('a') as stream:stream.write(json.dumps(result,separators=(',',':'))+'\n')
assert len(rows)==530
report=dict(status='PASS_ONLY_NEW530_TEX0_BINDING_LAYER_BOUNDARY',Source_ROOTs=1068,
new_TEX0_written=530,new_layer_cells_preserved=530*256,
new_by_cohort=dict(collections.Counter(r['cohort'] for r in rows)),
old520_TEX0_reused_without_read_or_recheck=True,old75_alpha8_variants_unchanged=True,
existing_MDID52_intersections=0,missing_texture_held_tiles=18,
missing_unique_paths=work['missing_unique_paths'],complete_TEX0_roles=1050,
canonical1028_body_proof_reused=work['actual_body_proof'],
Source_exports_hash_sweeps_or_geometry_liquid_alpha_SDK_tests_repeated=False,
actual_native_material_or_terrain_activation=False)
(J/'new530-TEX0-focused-check.json').write_text(json.dumps(report,indent=2)+'\n')
(J/'new530-TEX0-candidate-manifest.json').write_text(json.dumps(dict(status=report['status'],rows=rows),indent=2)+'\n')
print(json.dumps(report))