feat(research): preserve urban geometry pipelines and qualification suites

Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-29 09:10:00 +03:00
parent 5d56237124
commit 69dc566665
611 changed files with 52016 additions and 28 deletions
+49
View File
@@ -0,0 +1,49 @@
import copy
import importlib.util
from pathlib import Path
import pytest
spec = importlib.util.spec_from_file_location('urban_ablation', Path(__file__).parents[1] /
'simulation/urban-plan-research/evaluation/ablation.py')
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
def test_equal_geometry_counts_do_not_hide_property_or_position_changes():
doc = dict(features=[dict(id='a', properties={'class': 'road_marking', 'subtype': 'crosswalk'},
geometry={'type': 'Point', 'coordinates': [0, 0, 0]})])
changed = copy.deepcopy(doc)
changed['features'][0]['geometry']['coordinates'][0] = .1
result = module.compare(doc, changed)
assert not result['features_equal'] and result['changed_ids'] == ['a']
assert not result['recall_measured']
changed['features'][0]['geometry'] = doc['features'][0]['geometry']
changed['features'][0]['properties']['subtype'] = 'linear_marking'
assert not module.compare(doc, changed)['features_equal']
def test_duplicate_id_is_not_collapsed():
with pytest.raises(ValueError, match='Duplicate'):
module.features(dict(features=[dict(id='a'), dict(id='a')]))
def test_omission_replays_all_later_stages_and_rejects_missing_named_input():
d = dict(groups=[dict(group='a', stages=['one']), dict(group='b', stages=['two']),
dict(group='c', stages=['three'])])
p = module.tail_plan(d, 'a', ['b'])
assert p['groups'] == ['a', 'c'] and not p['downstream_cache_reuse']
d['groups'][2]['input_files'] = {'/evidence': 'b'}
with pytest.raises(ValueError, match='producer'):
module.tail_plan(d, 'a', ['b'])
with pytest.raises(ValueError, match='outside'):
module.tail_plan(d, 'b', ['a'])
def test_holdout_requires_unseen_source_and_street_group():
development = [dict(source_sha256='one', location_group='street')]
for item in [dict(source_sha256='one', location_group='new'),
dict(source_sha256='two', location_group='street')]:
with pytest.raises(ValueError, match='leakage'):
module.validate_split(development, [item])
assert module.validate_split(development, [dict(source_sha256='two', location_group='new')])