feat(lab): publish E37 R0 acceptance result

This commit is contained in:
DCCONSTRUCTIONS
2026-07-28 02:37:38 +03:00
parent a2fcaa7b39
commit 6db5ac05ef
9 changed files with 801 additions and 9 deletions
+113 -3
View File
@@ -26,7 +26,7 @@ def _endpoint(router: APIRouter, path: str) -> object:
def test_advanced_catalogs_are_empty_when_not_configured() -> None:
router = build_advanced_laboratory_router()
for name in ("e31", "e32", "e33", "e34", "e35"):
for name in ("e31", "e32", "e33", "e34", "e35", "e37"):
route = _endpoint(router, f"/api/v1/laboratory/{name}/results")
catalog = route(limit=1) # type: ignore[operator]
assert catalog == {
@@ -47,22 +47,25 @@ def test_advanced_catalogs_fail_closed_on_incomplete_results(
e33 = tmp_path / "e33"
e34 = tmp_path / "e34"
e35 = tmp_path / "e35"
for root in (e31, e32, e33, e34, e35):
e37 = tmp_path / "e37"
for root in (e31, e32, e33, e34, e35, e37):
root.mkdir()
(e31 / f"e31-source-qualification-{'1' * 64}").mkdir()
(e32 / f"e32-track-geometry-{'2' * 64}").mkdir()
(e33 / f"e33-worker-shadow-{'3' * 64}").mkdir()
(e34 / f"e34-temporal-occupied-{'4' * 64}").mkdir()
(e35 / f"e35-degradation-recovery-{'5' * 64}").mkdir()
(e37 / f"e37-ravnoves-acceptance-{'7' * 64}").mkdir()
router = build_advanced_laboratory_router(
e31_root_provider=lambda: e31,
e32_root_provider=lambda: e32,
e33_root_provider=lambda: e33,
e34_root_provider=lambda: e34,
e35_root_provider=lambda: e35,
e37_root_provider=lambda: e37,
)
for name in ("e31", "e32", "e33", "e34", "e35"):
for name in ("e31", "e32", "e33", "e34", "e35", "e37"):
route = _endpoint(router, f"/api/v1/laboratory/{name}/results")
catalog = route(limit=1) # type: ignore[operator]
assert catalog["configured"] is True
@@ -312,3 +315,110 @@ def test_e35_catalog_projects_recovery_and_review(
assert item["review"]["scenarios"] == []
assert item["authority"] == authority
assert item["access"] == "read-only"
def test_e37_catalog_projects_the_frozen_r0_contract(
tmp_path: Path,
monkeypatch: MonkeyPatch,
) -> None:
result_id = f"e37-ravnoves-acceptance-{'7' * 64}"
root = tmp_path / "e37"
candidate = root / result_id
candidate.mkdir(parents=True)
(candidate / "manifest.json").write_text("{}", encoding="utf-8")
authority = {
"commands_enabled": False,
"navigation_or_safety_accepted": False,
}
result = SimpleNamespace(
result_id=result_id,
accepted=True,
manifest={
"created_at_utc": "2026-07-28T10:00:00Z",
"acceptance_state": "accepted-r0-source-scoped-contract",
"identity": {
"source": {
"session_id": "20260720T065719Z_viewer_live",
"display_name": "RAVNOVES00",
},
"profile": {
"profile_id": "e37-ravnoves00-r0-acceptance/v1",
},
"execution": {
"class": "deterministic-offline-contract-build",
"worker_node": "DESKTOP-OPJ8J04",
},
},
},
contract={
"dimension_distributions": {
"presence": {"object-present": 200, "unknown": 2},
"geometry_association": {
"object-associated": 180,
"unknown": 2,
},
"freshness": {"current": 300, "unavailable": 186},
},
"severity_distribution": {
"standard": 401,
"medium": 81,
"high": 4,
},
"label_provenance": {
"engineering_items": 484,
"human_exception_items": 2,
"independent_ground_truth": False,
},
"split": {
"strategy": "deterministic-source-stratum-range-holdout",
"validation_fraction": 0.3,
},
"targets": {
"presence_target": 0.9,
"geometry_association_target": 0.9,
"freshness_target": 0.9,
},
},
report={
"metrics": {
"reviewed_items": 486,
"development_items": 340,
"validation_items": 146,
"engineering_items": 484,
"human_exception_items": 2,
"terminal_outcomes": 486,
"accounting_fraction": 1.0,
"false_free_claims": 0,
},
"acceptance": {"accepted": True, "checks": {}},
"decision": {"quality_target_evaluated": False},
"limitations": ["source-scoped"],
"authority": authority,
},
)
def fake_read(
root_text: str,
signature: tuple[int, ...],
) -> SimpleNamespace:
assert root_text == str(candidate.resolve())
assert signature
return result
monkeypatch.setattr(advanced_api, "_read_e37_cached", fake_read)
router = build_advanced_laboratory_router(
e37_root_provider=lambda: root,
)
route = _endpoint(router, "/api/v1/laboratory/e37/results")
catalog = route(limit=1) # type: ignore[operator]
assert catalog["candidate_total"] == 1
assert catalog["invalid_total"] == 0
item = catalog["items"][0]
assert item["status"] == "accepted-r0-source-scoped-contract"
assert item["worker_node"] == "DESKTOP-OPJ8J04"
assert item["metrics"]["reviewed_items"] == 486
assert item["metrics"]["validation_items"] == 146
assert item["quality_target_evaluated"] is False
assert item["authority"] == authority
assert item["access"] == "read-only"