883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
66 lines
3.7 KiB
Python
66 lines
3.7 KiB
Python
"""Only45 newly affected inputs; originaldry ignores highbits before wetroles."""
|
|
import ast
|
|
import collections
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import struct
|
|
import sys
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
from map_asset_preflight import _adt_split_chunk,_adt_split_records,adt_root_equivalent_ocean_candidate
|
|
|
|
J=Path('runtime/rea-system-jobs-20261022/terrain-MH2O329-role-20261025')
|
|
previous=json.loads((J/'Source209-MCLQ-MH2O-ocean-correspondence.json').read_text())['rows']
|
|
selected=[r for r in previous if r.get('held')=='Source nonfishable or nonOcean wet class' and r.get('flag') in (79,207,1,129)]
|
|
assert len(selected)==45
|
|
# Reuse only the existing pure byte-preservation verifier, never execute its
|
|
# completed140 input loop or rebuild its outputs.
|
|
testpath=Path('tests/map_equivalent_ocean_candidate_test.py')
|
|
tree=ast.parse(testpath.read_text());definition=next(n for n in tree.body if isinstance(n,ast.FunctionDef) and n.name=='verify')
|
|
namespace=dict(_adt_split_records=_adt_split_records,struct=struct)
|
|
exec(compile(ast.Module(body=[definition],type_ignores=[]),str(testpath),'exec'),namespace)
|
|
verify=namespace['verify']
|
|
OUT=J/'private-new-dry-nibble-MH2O-ROOT';OUT.mkdir(exist_ok=True)
|
|
rows=[];held=[]
|
|
for row in selected:
|
|
raw=Path(row['input_ROOT']).read_bytes()
|
|
try:new,audit=adt_root_equivalent_ocean_candidate(raw)
|
|
except ValueError as exc:
|
|
held.append(dict(source_reference=row['source_reference'],old_first_flag=row['flag'],reason=str(exc)));continue
|
|
verify(raw,new)
|
|
filename=OUT/(Path(row['source_reference']).stem+'.root.adt');filename.write_bytes(new)
|
|
rows.append(dict(source_reference=row['source_reference'],input_ROOT=row['input_ROOT'],output_ROOT=str(filename),
|
|
bytes=len(new),sha256=hashlib.sha256(new).hexdigest(),old_first_flag=row['flag'],audit=audit))
|
|
assert len(rows)+len(held)==45 and rows
|
|
|
|
def encode(records):return b''.join(_adt_split_chunk(t,d)+x for t,d,x in records)
|
|
|
|
|
|
sample=next(r for r in rows if r['old_first_flag'] in (79,207))
|
|
top=_adt_split_records(Path(sample['input_ROOT']).read_bytes());found=None
|
|
for ci,(t,cell,z) in enumerate(top):
|
|
if t!='MCNK' or not struct.unpack_from('<I',cell)[0]&0x3c:continue
|
|
children=_adt_split_records(cell[128:])
|
|
for mi,(tag,block,x) in enumerate(children):
|
|
if tag=='MCLQ':
|
|
index=next((i for i,f in enumerate(block[656:720]) if f in (79,207)),None)
|
|
if index is not None:found=(ci,cell,children,mi,block,index);break
|
|
if found:break
|
|
assert found
|
|
ci,cell,children,mi,block,index=found
|
|
for flag in (78,9,33,225):
|
|
changed=bytearray(block);changed[656+index]=flag
|
|
parts=list(children);parts[mi]=('MCLQ',bytes(changed),b'')
|
|
records=list(top);records[ci]=('MCNK',cell[:128]+encode(parts),b'')
|
|
try:adt_root_equivalent_ocean_candidate(encode(records))
|
|
except ValueError:pass
|
|
else:raise AssertionError('Nondry/unproved wet nibble skipped as dry')
|
|
report=dict(status='PASS_ONLY45_AFFECTED_SOURCE_DRY_NIBBLE_MH2O_BOUNDARY',newly_affected_inputs=45,
|
|
new_admitted=len(rows),new_held=len(held),held_reasons=dict(collections.Counter(r['reason'] for r in held)),
|
|
original_dry_predicate='(Sourceflag&0xF)==0xF',refusals=4,
|
|
prior140_or89_or_geometry_alpha_SDK_replayed=False,entire_MH2O_and_other_payloads_byte_exact=True,
|
|
exact22_cardinality_and_wet09_other_holds_unchanged=True,publishable=False)
|
|
(J/'affected45-dry-nibble-focused-check.json').write_text(json.dumps(report,indent=2)+'\n')
|
|
(J/'affected45-dry-nibble-candidate-manifest.json').write_text(json.dumps(dict(status=report['status'],rows=rows,held=held),indent=2)+'\n')
|
|
print(json.dumps(report))
|