Files
WoW-Hybrid-gateway/tests/map_still_river_exact_nibble_guard_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

40 lines
3.0 KiB
Python

"""Only changed Source5014 raw-nibble guard; reuse all171 payload proofs."""
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_source_water_render_class, adt_root_still_river_candidate
J=Path('runtime/continuation-20261026/openworld-Still-River-liquid-contract')
original=json.loads((J/'Still-containing171-component.json').read_text())
classification=json.loads((J/'new-original-exact-nibble-eligibility-metadata-only.json').read_text())
operands={r['source_reference']:r for r in json.loads(Path('runtime/continuation-20261026/Root-named-openworld-area-status/held-outdoor-liquid-operands.json').read_text())['rows']}
assert '_adt_source_water_render_class' in adt_root_still_river_candidate.__code__.co_names
eligible={r['source_reference'] for r in classification['eligible']}
excluded={r['source_reference'] for r in classification['held']}
assert len(eligible)==146 and len(excluded)==25 and not eligible&excluded
accepted=[];refused=[]
for row in original['rows']:
ref=row['source_reference'];flags={int(flag) for block in operands[ref]['blocks'] for flag in block['wet_flags']}
errors=[]
for flag in sorted(flags):
try:kind=_adt_source_water_render_class(flag)
except ValueError:errors.append(flag)
else:assert (kind==0 and flag&15==4) or (kind==1 and flag&15==1)
if ref in eligible:
assert not errors;accepted.append(row)
else:
assert ref in excluded and errors;refused.append(dict(source_reference=ref,refused_raw_flags=errors))
# Meaningful edge cases include exact-known upper roles, forbidden upper bits,
# previously overbroad0/8/12 and malformed values, using the real producer guard.
for upper in (0,64,128,192):
assert _adt_source_water_render_class(upper|4)==0
assert _adt_source_water_render_class(upper|1)==1
for flag in (0,8,12,64,72,76,128,136,140,192,200,204,0x14,0x21,-1,256,True,None):
try:_adt_source_water_render_class(flag)
except ValueError:pass
else:raise AssertionError('Unproved raw nibble admitted')
result=dict(status='PASS_CHANGED_EXACT_NIBBLE_GUARD_AND146_PAYLOAD_REUSE',accepted_reused_payloads=len(accepted),refused_prior_component_tiles=refused,accepted_upper_role_variants=8,additional_refusals=18,original171_unchanged=True,ROOT_body_reads=0,reconversions=0,payload_rehashes=0,old_tests_repeated=False,flow_tail_guard_unchanged=True,native_actions=0)
(J/'exact-nibble146-focused-result.json').write_text(json.dumps(result,indent=2)+'\n')
(J/'Still-containing146-component.json').write_text(json.dumps(dict(status=result['status'],source_parent_component=str(J/'Still-containing171-component.json'),original171_payloads_reused_without_body_reads=True,rows=accepted,excluded25=refused,source_drawn_mask_authority='Original5014 Still exact raw4 / Ocean exact raw1, plus knownFishable0x40 andDeep0x80 only',native_profile_limits='Original Water1 material/texture table relation; retained70334 HeightDepth schema. Native shading/runtime unverified.',flow_tail_guard_unchanged=True,publishable=False,installed=False),indent=2)+'\n')
print(result['status'])