mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-06-22 12:11:13 +00:00
[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:
+5
-3
@@ -2,7 +2,9 @@
|
||||
|
||||
**Task**: AZ-508_hygiene_iso_timestamps_consolidation
|
||||
**Name**: ISO-timestamp helper consolidation
|
||||
**Description**: Replace five identical private `_iso_ts_now()` one-liners across c6_tile_cache + c7_inference with a single Layer-1 helper `src/gps_denied_onboard/helpers/iso_timestamps.py` exposing `iso_ts_now() -> str`. Closes cumulative review batches 31–33 Finding F2 (Low / Maintainability) and the earlier 28–30 cumulative review Finding F3 (the 3 c6 copies).
|
||||
**Description**: Replace the duplicated private `_iso_ts_now()` one-liners across c6_tile_cache + c7_inference with a single Layer-1 helper `src/gps_denied_onboard/helpers/iso_timestamps.py` exposing `iso_ts_now() -> str`. Closes cumulative review batches 31–33 Finding F2 (Low / Maintainability) and the earlier 28–30 cumulative review Finding F3 (the 3 c6 copies).
|
||||
|
||||
> **Spec drift note (Batch 48, 2026-05-13)**: this task was authored before c6 had locally consolidated its three copies into `components/c6_tile_cache/_timestamp.py`, and before `tensorrt_runtime.py` removed its local copy. Actual call-sites needing migration at implementation time: 3 (c6 `_timestamp.py` shim, c7 `onnx_trt_ep_runtime.py`, c7 `thermal_publisher.py`). Also, AC-2 originally specified a `+00:00` regex copied from a misread of `test_az272_fdr_record_schema.py`; the canonical FDR `ts` format on disk is the `Z`-suffix variant (`_TS = "2026-05-11T00:00:00.000000Z"`), produced by all three existing local helpers. AC-2 regex below has been corrected to `Z`; this preserves the AC-5 "FDR schema tests pass unmodified" invariant and the Excluded clause "no schema change".
|
||||
**Complexity**: 2 points
|
||||
**Dependencies**: AZ-263_initial_structure, AZ-266_log_module
|
||||
**Component**: helpers (epic AZ-264 / E-CC-HELPERS)
|
||||
@@ -73,9 +75,9 @@ When `from gps_denied_onboard.helpers.iso_timestamps import iso_ts_now` is run
|
||||
Then the import succeeds; the function is callable; the returned value is a `str`
|
||||
|
||||
**AC-2: Output format is byte-identical to the previous local helpers**
|
||||
Given the existing FDR record format that the five local helpers produced
|
||||
Given the existing FDR record format that the three local helpers produced (`%Y-%m-%dT%H:%M:%S.%fZ`, canonical FDR `_TS` fixture)
|
||||
When `iso_ts_now()` is called
|
||||
Then the output matches `^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}\+00:00$` and is parseable by `datetime.fromisoformat(...)` into a UTC-aware datetime
|
||||
Then the output matches `^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$` and is parseable by `datetime.fromisoformat(value.replace("Z", "+00:00"))` into a UTC-aware datetime
|
||||
|
||||
**AC-3: Monotonicity under normal clock**
|
||||
Given two `iso_ts_now()` calls separated by at least 1 microsecond
|
||||
Reference in New Issue
Block a user