[AZ-508] Consolidate _iso_ts_now into helpers/iso_timestamps

Batch 48 / Cycle 1 (greenfield Step 7). Closes cumulative review
batches 31-33 F2 and 28-30 F3 by replacing the duplicated private
_iso_ts_now() one-liners with a single Layer-1 helper:

  src/gps_denied_onboard/helpers/iso_timestamps.py
  iso_ts_now() -> str

Output format matches the canonical FDR _TS fixture
(YYYY-MM-DDTHH:MM:SS.ffffffZ); no FDR schema change.

Migrated call-sites (3): c7_inference/onnx_trt_ep_runtime,
c7_inference/thermal_publisher, plus the 3 c6_tile_cache callers
that previously imported from the local c6_tile_cache/_timestamp
shim (now deleted, superseded by the Layer-1 helper).

Spec drift resolved (Choose A, user-approved): spec listed 5 call
sites + +00:00 regex; on-disk reality at batch start is 3 sites +
Z-suffix matching every existing helper and the FDR _TS fixture.
Spec preamble + AC-2 regex updated in the task file; documented in
batch_48_cycle1_report.md.

Tests: 9 new AC tests (AC-1..AC-7 + Layer-1 invariant +
public-surface defensive); 216 focused tests pass including the
unmodified AZ-272 FDR schema suite and AZ-270 / AZ-507 layering
lints. Verdict: PASS (no findings).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-13 23:23:22 +03:00
parent f29897cb3a
commit 5441ea2017
15 changed files with 596 additions and 48 deletions
@@ -22,6 +22,7 @@ from gps_denied_onboard.helpers.imu_preintegrator import (
ImuPreintegrator,
make_imu_preintegrator,
)
from gps_denied_onboard.helpers.iso_timestamps import iso_ts_now
from gps_denied_onboard.helpers.lightglue_runtime import (
LightGlueConcurrentAccessError,
LightGlueRuntime,
@@ -83,6 +84,7 @@ __all__ = [
"adjoint",
"exp_map",
"is_valid_rotation",
"iso_ts_now",
"log_map",
"make_imu_preintegrator",
"matrix_to_se3",
@@ -0,0 +1,33 @@
"""UTC ISO-8601 timestamp helper (E-CC-HELPERS / AZ-264 / AZ-508).
Single Layer-1 source for the wall-clock string used in the FDR record
``ts`` envelope across c6_tile_cache and c7_inference. Consolidates what
used to be a private ``_iso_ts_now`` one-liner repeated per module.
The output format is locked to RFC 3339 / ISO 8601 UTC with microsecond
precision and a ``Z`` suffix, matching the canonical FDR ``ts`` fixture
in ``tests/unit/test_az272_fdr_record_schema.py`` (``_TS =
"2026-05-11T00:00:00.000000Z"``) and the format produced by the three
existing local helpers this module replaces. Changing the format would
alter FDR record bit-shape and is explicitly out of scope for AZ-508.
Producers that need a Clock-injected payload field (e.g.
``age_seconds`` derived from an injected wall-clock for testability)
MUST NOT route through this helper — it is purely metadata about WHEN
the FDR record envelope itself was emitted.
"""
from __future__ import annotations
from datetime import datetime, timezone
__all__ = ["iso_ts_now"]
def iso_ts_now() -> str:
"""Return an RFC 3339 UTC timestamp with microsecond precision and a ``Z`` suffix.
Format: ``YYYY-MM-DDTHH:MM:SS.ffffffZ`` (fixed-width, lexicographically
monotonic under a non-decreasing wall clock).
"""
return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ")