feat(simulation): integrate infrastructure jobs and semantic scene editing

Integrate infrastructure preparation and qualified map delivery with local scenes. Add semantic editing, object provenance, survey caching and operator scene tools.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-29 09:10:01 +03:00
parent 25dc0a1b44
commit f48411f8fe
116 changed files with 10690 additions and 263 deletions
+36
View File
@@ -0,0 +1,36 @@
import json
from pathlib import Path
import sys
import pytest
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'simulation/ai-polygon'))
from infrastructure_survey_cache import file_hash, find_survey, record_survey
def make_survey(tmp_path):
folder=tmp_path/'old';part=folder/'tile-000-000';part.mkdir(parents=True)
request={'source':{'sha256':'source'},'model':{'revision':'model'}}
(part/'job.json').write_text(json.dumps(request))
files={}
for name in ('top.png','top.geometry.npz','surface-atlas.npz'):
(part/name).write_bytes(b'original-derived-data');files[name]=file_hash(part/name)
(part/'survey-receipt.json').write_text(json.dumps({'status':'surveyed','job_sha256':file_hash(part/'job.json'),'files':files}))
(folder/'tile-index.json').write_text(json.dumps({'tiles':[{'id':part.name,'status':'surveyed'}]}))
return folder,request
def test_reuse_returns_existing_directory_without_copy_and_rejects_changed_data(tmp_path):
folder,request=make_survey(tmp_path)
record_survey(folder,request,'survey-v1',lambda:None)
before={str(p.relative_to(tmp_path)) for p in tmp_path.rglob('*')}
assert find_survey(tmp_path,request,'survey-v1',lambda:None)==folder
assert before=={str(p.relative_to(tmp_path)) for p in tmp_path.rglob('*')}
assert find_survey(tmp_path,request,'survey-v2',lambda:None) is None
assert find_survey(tmp_path,{**request,'source':{}},'survey-v1',lambda:None) is None
(folder/'tile-000-000/top.png').write_bytes(b'corrupt')
assert find_survey(tmp_path,request,'survey-v1',lambda:None) is None
def test_partial_survey_is_never_admitted_as_complete(tmp_path):
folder,request=make_survey(tmp_path)
(folder/'tile-index.json').write_text(json.dumps({'tiles':[{'id':'tile-000-000','status':'pending'}]}))
with pytest.raises(ValueError,match='incomplete'):
record_survey(folder,request,'survey-v1',lambda:None)
assert not (folder/'survey-cache.json').exists()