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

66 lines
3.6 KiB
Python

#!/usr/bin/env python3
"""One reviewed84559 publication integration; no SDK/codec/encoder replay."""
import copy
import json
import sys
import unittest
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'ops'))
import published_client_assets as publication
J=ROOT/'runtime/continuation-20261026/Root-openworld529-Area313-metadata'
class OpenworldPublicationMetadataTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.wrapper=json.loads((J/'reviewed-Map0-1-Area313-publication-wrapper.json').read_text())
bindings=json.loads((ROOT/'runtime/continuation-20261026/openworld0-1-scene-closure/original529-Map0-Map1-actual-WDT-bindings.json').read_text())
manifest=json.loads(Path(bindings['candidate_manifest']).read_text())
cls.assets={r['file_data_id']:r for r in manifest['assets']if r['file_data_id']in(8554294,8554295)}
cls.inputs=publication._reviewed_map_replacement_metadata(cls.wrapper,
cls.wrapper['input_identity']['base_package']['sha256'],cls.assets)
def test_actual_cohort_and_affected_record_refusals(self):
data=self.inputs
self.assertEqual(len(data['base']['rows']),84246)
self.assertEqual(len(data['target']['rows']),84559)
self.assertFalse(self.wrapper['prefix_exact'])
refused=[]
# Change a second Map field while retaining the requested WDT mutation.
target=dict(data['target'],rows=list(data['target']['rows']))
i=next(i for i,r in enumerate(target['rows'])if r['table_name']=='Map'and r['id']==0)
target['rows'][i]=copy.deepcopy(target['rows'][i])
target['rows'][i]['record']['Directory']='unreviewed'
with self.assertRaises(ValueError):
publication._reviewed_openworld_area_records(data['base'],target,data['changes'],data['areas'],self.assets)
refused.append('extra_Map_Directory_field')
# An owned append may not overwrite any original/native Area key.
target=dict(data['target'],rows=list(data['target']['rows']))
i=next(i for i,r in enumerate(target['rows'])if r['table_name']=='AreaTable'and i>=84246)
target['rows'][i]=copy.deepcopy(target['rows'][i]);target['rows'][i]['id']=616
target['rows'][i]['record']['ID']=616
with self.assertRaises(ValueError):
publication._reviewed_openworld_area_records(data['base'],target,data['changes'],data['areas'],self.assets)
refused.append('native_Area616_overwrite')
# Binding to a different installed parent cannot reuse these proofs.
with self.assertRaises(ValueError):
publication._reviewed_map_replacement_metadata(self.wrapper,'0'*64,self.assets)
refused.append('wrong_parent')
# A future arbitrary Area/profile cohort is outside this frozen class.
areas=dict(data['areas'],Map0_1_ready_rows=314)
with self.assertRaises(ValueError):
publication._reviewed_openworld_area_records(data['base'],data['target'],data['changes'],areas,self.assets)
refused.append('wrong_Area_cohort_count')
result=dict(status='PASS_REVIEWED84559_PUBLICATION_METADATA_BOUNDARY',
parent_rows=84246,rows=84559,Map_WDT_replacements=2,Area_appends=313,
prefix_exact=False,actual_compiled315_proof_consumed=True,
old_Map1_169_route_unchanged=True,refusals=refused,
no_SDK_or_original_body_or_codec_or_encoder_repeated=True,
no_client_changes=True)
(J/'reviewed84559-publication-focused-result.json').write_text(json.dumps(result,indent=2)+'\n')
if __name__=='__main__':unittest.main()