feat(01-02): add Phase-3/4 stub Protocols (anchor_verifier, safety_state, flight_recorder)

- anchor_verifier.protocol: AnchorVerifier + VerifierDecision dataclass
  (Phase 3 VERIFY-01..05 fills semantics)
- safety_state.protocol: SafetyAnchorStateMachine + SourceLabel enum
  (Phase 3 SAFE-01..06 fills implementation)
- flight_recorder.protocol: FlightRecorder + RecorderHealth enum +
  FdrExportResult (Phase 4 FDR-01..06 fills)
- Enum string values match REQUIREMENTS.md SAFE-01 / FDR-04
- Not registered in build_pipeline yet — Phase 1 only requires existence
This commit is contained in:
Yuzviak
2026-05-10 22:55:23 +03:00
parent 622b1a1ebe
commit e13df36c9a
3 changed files with 121 additions and 0 deletions
@@ -0,0 +1,37 @@
"""Protocol surface for the anchor_verifier component (Phase 3, VERIFY-01..05).
Phase 1: stub only — semantics filled in Phase 3. The Protocol must
exist now so the ARCH-01 directory inventory is complete at end of
Phase 1.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Protocol, runtime_checkable
from gps_denied.hot_types.alignment_result import AlignmentResult
from gps_denied.hot_types.satellite_anchor import SatelliteAnchor
@dataclass(slots=True, frozen=True)
class VerifierDecision:
"""Result of an :meth:`AnchorVerifier.verify` call.
Phase 3 will refine the rejection-reason taxonomy (currently free-text:
``too_few_inliers`` / ``mre_above_threshold`` / ``degenerate_homography``
/ ``freshness_expired``).
"""
accepted: bool
anchor: SatelliteAnchor | None = None
rejection_reason: str | None = None
inlier_count: int = 0
mean_reprojection_error_px: float = 0.0
homography_condition_number: float = 0.0
@runtime_checkable
class AnchorVerifier(Protocol):
"""Geometry-gated anchor verifier. Filled in Phase 3."""
def verify(self, candidate: AlignmentResult) -> VerifierDecision: ...