[AZ-398] Clear remaining test-suite failures + warnings

route_client: route Tier-2 sleep through WallClock.sleep_until_ns
instead of bare time.sleep, fixing the AZ-398 AC-4 components-have-no-
direct-time meta-test failure.

helpers/__init__: lazy-load the heavy descriptor / wgs / image
modules via PEP 562 __getattr__ to fix the cold-start NFR regression
(test_cold_start_under_1000ms_p99 was 1409ms p99; lazy imports drop it
to ~210ms).

pyproject filterwarnings: silence the three upstream SwigPy*
DeprecationWarnings emitted by faiss-cpu / gtsam at import time. They
are an upstream SWIG-binding-layer issue and cannot be fixed from our
code. Suppression is scoped to the three exact messages.

State: batch-3 of cycle-4 closed; cumulative-review marker bumped.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-26 22:52:04 +03:00
parent 007aa36fbf
commit 4f0d8bdcd9
4 changed files with 184 additions and 124 deletions
+3 -3
View File
@@ -6,9 +6,9 @@ step: 10
name: Implement name: Implement
status: in_progress status: in_progress
sub_step: sub_step:
phase: 7 phase: 8
name: batch-loop name: cumulative-review
detail: "batch 3 of 4 — AZ-895" detail: "batches 01-03 of cycle 4 — first cumulative review pending"
retry_count: 0 retry_count: 0
cycle: 4 cycle: 4
tracker: jira tracker: jira
+10
View File
@@ -188,6 +188,16 @@ markers = [
"slow: tests slower than ~5s", "slow: tests slower than ~5s",
"contract: contract-suite test (frozen public surfaces)", "contract: contract-suite test (frozen public surfaces)",
] ]
# Silence the three boot-time DeprecationWarnings emitted by the SWIG
# binding layer used by faiss-cpu (and gtsam on Linux). They surface as
# `<frozen importlib._bootstrap>:241` "builtin type SwigPy* has no
# __module__ attribute" and are an upstream issue we cannot fix from
# our code — they appear whenever any SWIG-bound C extension is imported.
filterwarnings = [
"ignore:builtin type SwigPyPacked has no __module__ attribute:DeprecationWarning",
"ignore:builtin type SwigPyObject has no __module__ attribute:DeprecationWarning",
"ignore:builtin type swigvarlink has no __module__ attribute:DeprecationWarning",
]
[tool.coverage.run] [tool.coverage.run]
source = ["src/gps_denied_onboard"] source = ["src/gps_denied_onboard"]
@@ -205,7 +205,7 @@ class SatelliteProviderRouteClient:
self._poll_interval_s = float(poll_interval_s) self._poll_interval_s = float(poll_interval_s)
self._poll_max_attempts = int(poll_max_attempts) self._poll_max_attempts = int(poll_max_attempts)
self._injected_client = http_client self._injected_client = http_client
self._sleep = sleep if sleep is not None else time.sleep self._sleep = sleep if sleep is not None else _default_sleep
self._clock_ms = clock_ms if clock_ms is not None else _wall_clock_ms self._clock_ms = clock_ms if clock_ms is not None else _wall_clock_ms
self._logger = logger or logging.getLogger( self._logger = logger or logging.getLogger(
"gps_denied_onboard.components.c11_tile_manager.route_client" "gps_denied_onboard.components.c11_tile_manager.route_client"
@@ -792,6 +792,21 @@ def _wall_clock_ms() -> int:
return int(time.monotonic() * 1000) return int(time.monotonic() * 1000)
def _default_sleep(seconds: float) -> None:
"""Production sleep hook routes through :class:`WallClock.sleep_until_ns`.
Tests inject a no-op or a recorder via the ``sleep`` constructor
parameter. Routing through ``WallClock`` keeps the AZ-398 AC-4 AST
scan over ``components/`` from seeing a bare ``time.sleep`` — same
pattern used by ``tile_downloader._default_sleep``.
"""
from gps_denied_onboard.clock.wall_clock import WallClock
clock = WallClock()
clock.sleep_until_ns(clock.monotonic_ns() + int(seconds * 1_000_000_000))
def _canonical_json_bytes(body: dict[str, Any]) -> bytes: def _canonical_json_bytes(body: dict[str, Any]) -> bytes:
"""Stable byte representation for the sha256 audit field. """Stable byte representation for the sha256 audit field.
+116 -81
View File
@@ -1,58 +1,66 @@
"""Shared utilities (E-CC-HELPERS / AZ-264). """Shared utilities (E-CC-HELPERS / AZ-264) — PEP 562 lazy re-exports.
Each helper has its own task (AZ-276..AZ-283). This package exposes the Each helper has its own task (AZ-276..AZ-283). Public names are
ones that have landed so consumers can depend on a stable public surface exposed via :func:`__getattr__` so importing a single submodule
without reaching into the helper modules directly. (e.g. ``from gps_denied_onboard.helpers.iso_timestamps import
iso_ts_now``) does not eagerly pull sibling heavies (``numpy``,
``cv2``, ``pyproj``, ``gtsam``). Cold-start critical for the C12
operator-orchestrator CLI (NFR-perf-cold-start).
""" """
from gps_denied_onboard.helpers.descriptor_normaliser import ( from __future__ import annotations
ALLOWED_DTYPES,
DescriptorNormaliser, from typing import TYPE_CHECKING, Any
DescriptorNormaliserError,
) if TYPE_CHECKING:
from gps_denied_onboard.helpers.engine_filename_schema import ( from gps_denied_onboard.helpers.accuracy_report import (
ALLOWED_PRECISIONS,
ENGINE_SUFFIX,
EngineFilenameSchema,
EngineFilenameSchemaError,
)
from gps_denied_onboard.helpers.accuracy_report import (
AC3_GATE_PCT, AC3_GATE_PCT,
AC3_GATE_THRESHOLD_M, AC3_GATE_THRESHOLD_M,
ReportContext, ReportContext,
format_failure_message, format_failure_message,
render_report, render_report,
verdict_passes_ac3, verdict_passes_ac3,
) )
from gps_denied_onboard.helpers.gps_compare import ( from gps_denied_onboard.helpers.descriptor_normaliser import (
ALLOWED_DTYPES,
DescriptorNormaliser,
DescriptorNormaliserError,
)
from gps_denied_onboard.helpers.engine_filename_schema import (
ALLOWED_PRECISIONS,
ENGINE_SUFFIX,
EngineFilenameSchema,
EngineFilenameSchemaError,
)
from gps_denied_onboard.helpers.gps_compare import (
GroundTruthRow, GroundTruthRow,
HorizontalErrorDistribution, HorizontalErrorDistribution,
horizontal_error_distribution, horizontal_error_distribution,
l2_horizontal_m, l2_horizontal_m,
match_percentage, match_percentage,
percentile_sorted, percentile_sorted,
) )
from gps_denied_onboard.helpers.imu_preintegrator import ( from gps_denied_onboard.helpers.imu_preintegrator import (
CombinedImuFactor, CombinedImuFactor,
ImuPreintegrationError, ImuPreintegrationError,
ImuPreintegrator, ImuPreintegrator,
make_imu_preintegrator, make_imu_preintegrator,
) )
from gps_denied_onboard.helpers.iso_timestamps import ( from gps_denied_onboard.helpers.iso_timestamps import (
iso_ts_from_clock, iso_ts_from_clock,
iso_ts_now, iso_ts_now,
) )
from gps_denied_onboard.helpers.lightglue_runtime import ( from gps_denied_onboard.helpers.lightglue_runtime import (
LightGlueConcurrentAccessError, LightGlueConcurrentAccessError,
LightGlueRuntime, LightGlueRuntime,
LightGlueRuntimeError, LightGlueRuntimeError,
) )
from gps_denied_onboard.helpers.ransac_filter import ( from gps_denied_onboard.helpers.ransac_filter import (
RansacFilter, RansacFilter,
RansacFilterError, RansacFilterError,
RansacResult, RansacResult,
) )
from gps_denied_onboard.helpers.se3_utils import ( from gps_denied_onboard.helpers.se3_utils import (
SE3, SE3,
Se3InvalidMatrixError, Se3InvalidMatrixError,
adjoint, adjoint,
@@ -61,64 +69,91 @@ from gps_denied_onboard.helpers.se3_utils import (
log_map, log_map,
matrix_to_se3, matrix_to_se3,
se3_to_matrix, se3_to_matrix,
) )
from gps_denied_onboard.helpers.sha256_sidecar import ( from gps_denied_onboard.helpers.sha256_sidecar import (
SIDECAR_SUFFIX, SIDECAR_SUFFIX,
Sha256Sidecar, Sha256Sidecar,
Sha256SidecarError, Sha256SidecarError,
) )
from gps_denied_onboard.helpers.wgs_converter import ( from gps_denied_onboard.helpers.wgs_converter import (
MAX_ZOOM, MAX_ZOOM,
WEB_MERCATOR_MAX_LAT_DEG, WEB_MERCATOR_MAX_LAT_DEG,
WgsConversionError, WgsConversionError,
WgsConverter, WgsConverter,
) )
__all__ = [ # PEP 562 lazy resolution. Each entry maps a public name → (submodule, attr).
"AC3_GATE_PCT", _LAZY_NAMES: dict[str, tuple[str, str]] = {
"AC3_GATE_THRESHOLD_M", # accuracy_report
"ALLOWED_DTYPES", "AC3_GATE_PCT": ("gps_denied_onboard.helpers.accuracy_report", "AC3_GATE_PCT"),
"ALLOWED_PRECISIONS", "AC3_GATE_THRESHOLD_M": ("gps_denied_onboard.helpers.accuracy_report", "AC3_GATE_THRESHOLD_M"),
"ENGINE_SUFFIX", "ReportContext": ("gps_denied_onboard.helpers.accuracy_report", "ReportContext"),
"MAX_ZOOM", "format_failure_message": ("gps_denied_onboard.helpers.accuracy_report", "format_failure_message"),
"ReportContext", "render_report": ("gps_denied_onboard.helpers.accuracy_report", "render_report"),
"SE3", "verdict_passes_ac3": ("gps_denied_onboard.helpers.accuracy_report", "verdict_passes_ac3"),
"SIDECAR_SUFFIX", # descriptor_normaliser
"WEB_MERCATOR_MAX_LAT_DEG", "ALLOWED_DTYPES": ("gps_denied_onboard.helpers.descriptor_normaliser", "ALLOWED_DTYPES"),
"CombinedImuFactor", "DescriptorNormaliser": ("gps_denied_onboard.helpers.descriptor_normaliser", "DescriptorNormaliser"),
"DescriptorNormaliser", "DescriptorNormaliserError": ("gps_denied_onboard.helpers.descriptor_normaliser", "DescriptorNormaliserError"),
"DescriptorNormaliserError", # engine_filename_schema
"EngineFilenameSchema", "ALLOWED_PRECISIONS": ("gps_denied_onboard.helpers.engine_filename_schema", "ALLOWED_PRECISIONS"),
"EngineFilenameSchemaError", "ENGINE_SUFFIX": ("gps_denied_onboard.helpers.engine_filename_schema", "ENGINE_SUFFIX"),
"GroundTruthRow", "EngineFilenameSchema": ("gps_denied_onboard.helpers.engine_filename_schema", "EngineFilenameSchema"),
"HorizontalErrorDistribution", "EngineFilenameSchemaError": ("gps_denied_onboard.helpers.engine_filename_schema", "EngineFilenameSchemaError"),
"ImuPreintegrationError", # gps_compare
"ImuPreintegrator", "GroundTruthRow": ("gps_denied_onboard.helpers.gps_compare", "GroundTruthRow"),
"LightGlueConcurrentAccessError", "HorizontalErrorDistribution": ("gps_denied_onboard.helpers.gps_compare", "HorizontalErrorDistribution"),
"LightGlueRuntime", "horizontal_error_distribution": ("gps_denied_onboard.helpers.gps_compare", "horizontal_error_distribution"),
"LightGlueRuntimeError", "l2_horizontal_m": ("gps_denied_onboard.helpers.gps_compare", "l2_horizontal_m"),
"RansacFilter", "match_percentage": ("gps_denied_onboard.helpers.gps_compare", "match_percentage"),
"RansacFilterError", "percentile_sorted": ("gps_denied_onboard.helpers.gps_compare", "percentile_sorted"),
"RansacResult", # imu_preintegrator
"Se3InvalidMatrixError", "CombinedImuFactor": ("gps_denied_onboard.helpers.imu_preintegrator", "CombinedImuFactor"),
"Sha256Sidecar", "ImuPreintegrationError": ("gps_denied_onboard.helpers.imu_preintegrator", "ImuPreintegrationError"),
"Sha256SidecarError", "ImuPreintegrator": ("gps_denied_onboard.helpers.imu_preintegrator", "ImuPreintegrator"),
"WgsConversionError", "make_imu_preintegrator": ("gps_denied_onboard.helpers.imu_preintegrator", "make_imu_preintegrator"),
"WgsConverter", # iso_timestamps
"adjoint", "iso_ts_from_clock": ("gps_denied_onboard.helpers.iso_timestamps", "iso_ts_from_clock"),
"exp_map", "iso_ts_now": ("gps_denied_onboard.helpers.iso_timestamps", "iso_ts_now"),
"format_failure_message", # lightglue_runtime
"horizontal_error_distribution", "LightGlueConcurrentAccessError": ("gps_denied_onboard.helpers.lightglue_runtime", "LightGlueConcurrentAccessError"),
"is_valid_rotation", "LightGlueRuntime": ("gps_denied_onboard.helpers.lightglue_runtime", "LightGlueRuntime"),
"iso_ts_from_clock", "LightGlueRuntimeError": ("gps_denied_onboard.helpers.lightglue_runtime", "LightGlueRuntimeError"),
"iso_ts_now", # ransac_filter
"l2_horizontal_m", "RansacFilter": ("gps_denied_onboard.helpers.ransac_filter", "RansacFilter"),
"log_map", "RansacFilterError": ("gps_denied_onboard.helpers.ransac_filter", "RansacFilterError"),
"match_percentage", "RansacResult": ("gps_denied_onboard.helpers.ransac_filter", "RansacResult"),
"make_imu_preintegrator", # se3_utils
"matrix_to_se3", "SE3": ("gps_denied_onboard.helpers.se3_utils", "SE3"),
"percentile_sorted", "Se3InvalidMatrixError": ("gps_denied_onboard.helpers.se3_utils", "Se3InvalidMatrixError"),
"render_report", "adjoint": ("gps_denied_onboard.helpers.se3_utils", "adjoint"),
"se3_to_matrix", "exp_map": ("gps_denied_onboard.helpers.se3_utils", "exp_map"),
"verdict_passes_ac3", "is_valid_rotation": ("gps_denied_onboard.helpers.se3_utils", "is_valid_rotation"),
] "log_map": ("gps_denied_onboard.helpers.se3_utils", "log_map"),
"matrix_to_se3": ("gps_denied_onboard.helpers.se3_utils", "matrix_to_se3"),
"se3_to_matrix": ("gps_denied_onboard.helpers.se3_utils", "se3_to_matrix"),
# sha256_sidecar
"SIDECAR_SUFFIX": ("gps_denied_onboard.helpers.sha256_sidecar", "SIDECAR_SUFFIX"),
"Sha256Sidecar": ("gps_denied_onboard.helpers.sha256_sidecar", "Sha256Sidecar"),
"Sha256SidecarError": ("gps_denied_onboard.helpers.sha256_sidecar", "Sha256SidecarError"),
# wgs_converter
"MAX_ZOOM": ("gps_denied_onboard.helpers.wgs_converter", "MAX_ZOOM"),
"WEB_MERCATOR_MAX_LAT_DEG": ("gps_denied_onboard.helpers.wgs_converter", "WEB_MERCATOR_MAX_LAT_DEG"),
"WgsConversionError": ("gps_denied_onboard.helpers.wgs_converter", "WgsConversionError"),
"WgsConverter": ("gps_denied_onboard.helpers.wgs_converter", "WgsConverter"),
}
def __getattr__(name: str) -> Any:
target = _LAZY_NAMES.get(name)
if target is None:
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
import importlib
module = importlib.import_module(target[0])
value = getattr(module, target[1])
globals()[name] = value
return value
__all__ = sorted(_LAZY_NAMES.keys())