feat(map): add persisted ghost pin sandbox

This commit is contained in:
DCCONSTRUCTIONS
2026-07-29 18:29:13 +03:00
parent b91d3b913e
commit 0c3855eac5
10 changed files with 1222 additions and 13 deletions
+24 -2
View File
@@ -18,7 +18,7 @@ from k1link.web.map_view_api import (
def test_default_map_view_matches_the_canonical_foundry_scene_and_cache_policy() -> None:
document = default_map_view()
assert document.schema_version == "missioncore.map-view/v2"
assert document.schema_version == "missioncore.map-view/v3"
assert document.revision == 0
assert document.view.camera is not None
assert document.view.camera.longitude == pytest.approx(37.618423)
@@ -34,6 +34,9 @@ def test_default_map_view_matches_the_canonical_foundry_scene_and_cache_policy()
assert document.view.visual_settings.background_color == "#08090d"
assert document.view.cache_intent.enabled is True
assert document.view.cache_intent.no_overwrite is True
assert document.view.ghost_pins.count == 12
assert document.view.ghost_pins.positions == []
assert document.view.ghost_pins.presentation.stem_height_meters == 1_500
def test_map_view_round_trip_uses_optimistic_revision(tmp_path: Path) -> None:
@@ -143,10 +146,29 @@ def test_v1_map_view_is_upgraded_without_rewriting_the_source_file(
upgraded = store.read()
assert upgraded.schema_version == "missioncore.map-view/v2"
assert upgraded.schema_version == "missioncore.map-view/v3"
assert upgraded.revision == 7
assert upgraded.view.camera is None
assert upgraded.view.visual_settings.atmosphere_enabled is True
assert upgraded.view.visual_settings.sun_enabled is False
assert upgraded.view.visual_settings.monochrome_enabled is True
assert upgraded.view.ghost_pins.positions == []
assert json.loads(store.document_path.read_text(encoding="utf-8")) == legacy
def test_v2_map_view_receives_the_default_ghost_pin_layer_without_rewrite(
tmp_path: Path,
) -> None:
store = MapViewStore(tmp_path / "map-view")
store.root.mkdir(parents=True)
current = default_map_view().model_dump(mode="json")
current["schema_version"] = "missioncore.map-view/v2"
current["view"].pop("ghost_pins")
store.document_path.write_text(json.dumps(current), encoding="utf-8")
upgraded = store.read()
assert upgraded.schema_version == "missioncore.map-view/v3"
assert upgraded.view.ghost_pins.count == 12
assert upgraded.view.ghost_pins.presentation.label_mode == "attributes"
assert json.loads(store.document_path.read_text(encoding="utf-8")) == current