Files
Oleksandr Bezdieniezhnykh 5441ea2017 [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>
2026-05-13 23:23:22 +03:00

5.4 KiB
Raw Permalink Blame History

Code Review Report — Batch 48

Batch: 48 (Cycle 1) Tasks: AZ-508 — ISO-timestamp helper consolidation (2 pt) Date: 2026-05-13 Verdict: PASS

Findings

No findings.

Phase Summary

Phase 1 — Context Loading

  • Task spec: _docs/02_tasks/todo/AZ-508_hygiene_iso_timestamps_consolidation.md
  • Cumulative review F2 (batches 3133) + F3 (batches 2830) — origin of the hygiene PBI.
  • Changed source files: 1 new helper + 1 helper package re-export + 3 c6 import rewires + 2 c7 local-def → import rewires + 1 deleted c6 internal shim.
  • Changed test files: 1 new (tests/unit/test_az508_iso_timestamps.py, 9 tests covering AC-1..AC-7 + Layer-1 invariant).
  • Changed docs: module-layout.md (new shared/helpers/iso_timestamps entry) + task spec (drift note + corrected AC-2 regex).

Phase 2 — Spec Compliance (AC-by-AC)

AC Verdict Evidence
AC-1 PASS test_ac1_import_and_call_returns_str
AC-2 PASS test_ac2_format_matches_canonical_regex + test_ac2_fromisoformat_roundtrip_yields_utc_aware_datetime
AC-3 PASS test_ac3_two_successive_calls_are_non_decreasing
AC-4 PASS test_ac4_no_other_iso_ts_now_definition_exists_in_src (AST walk over src/) + test_ac4_c6_and_c7_callers_import_from_helpers
AC-5 PASS tests/unit/test_az272_fdr_record_schema.py runs unmodified, 100% pass
AC-6 PASS test_ac6_helper_uses_stdlib_only (AST whitelist) — pyproject.toml unchanged
AC-7 PASS tests/unit/test_az270_compose_root.py::test_ac6_only_compose_root_imports_concrete_strategies passes

Spec drift note: the task spec originally listed 5 call-sites and a +00:00 regex. On-disk reality at implementation time: 3 call-sites (c6 already locally consolidated under _timestamp.py; tensorrt_runtime.py had no local copy) and the canonical FDR ts format is Z-suffix per the _TS = "2026-05-11T00:00:00.000000Z" fixture. Spec + AC-2 regex updated in this batch; no behavioral drift from the spec's actual intent ("single Layer-1 helper, byte-identical to existing locals, no FDR schema change"). User explicitly approved the path via Choose A.

Phase 3 — Code Quality

  • SRP: pure stateless free function; no class wrapper (per Constraint § "no class wrapping").
  • Error handling: no exception suppression; stdlib datetime.now cannot raise under normal operation.
  • Naming: iso_ts_now matches the canonical name used by all three pre-existing local helpers — no naming churn in call sites (from … import iso_ts_now as _iso_ts_now alias preserved in the c7 files).
  • Complexity: 1 line. n/a.
  • DRY: net deletion — eliminates duplication (the explicit goal).
  • Test quality: assertions cover format, parseability, monotonicity, absence of stray definitions, import-path enforcement, layer-1 invariant, and stdlib-only constraint.
  • Dead code: removed unused from datetime import datetime, timezone imports from both c7 files after the local _iso_ts_now defs were removed (adjacent-hygiene, permitted by coderule.mdc).

Phase 4 — Security Quick-Scan

No SQL, no subprocess, no eval / exec, no secrets, no untrusted input handling. Helper is stdlib-only and side-effect-free. n/a.

Phase 5 — Performance Scan

datetime.now(timezone.utc).strftime(...) is the same call all three previous local helpers made; zero runtime delta. No new allocations on the hot path.

Phase 6 — Cross-Task Consistency

Single task in batch — no inter-task interface concerns. Helper aligns with the existing 8-helper convention (single-file Layer-1 modules under src/gps_denied_onboard/helpers/, re-exported from helpers/__init__.py).

Phase 7 — Architecture Compliance

  • Layer direction: helper sits at Layer 1 (Foundation / shared); consumers in c6 (Layer 2 Infrastructure) and c7 (Layer 2 Infrastructure) import strictly downward. ✓
  • Public API respect: consumers import via gps_denied_onboard.helpers.iso_timestamps (or the helpers package facade after the __init__.py re-export). Internal modules of c6/c7 are not imported across components. ✓
  • No new cyclic deps: the helper imports only stdlib; no possible cycle. ✓
  • Duplicate symbols: eliminated by design — the AC-4 AST walk asserts zero other iso_ts_now / _iso_ts_now definitions remain anywhere under src/. ✓
  • Cross-cutting concern home: moved from per-component locals to the canonical helpers/ directory. ✓
  • AZ-507 layering lint: test_ac6_only_compose_root_imports_concrete_strategies passes — helper imports are allowed from components. ✓
  • AZ-270 lint: passes. ✓

Pre-existing Findings (NOT introduced by this batch)

The following ruff findings remain in src/gps_denied_onboard/components/c7_inference/onnx_trt_ep_runtime.py but are pre-existing (verified by re-running ruff against HEAD before this batch's edits):

  • B905 at line 547 — zip() without strict=.
  • RUF022 at lines 8898 — __all__ not sorted.
  • RUF023 at lines 127134 — __slots__ not sorted.

Per coderule.mdc "Pre-existing lint errors should only be fixed if they're in the modified area" — left untouched. Candidate for a future c7 hygiene PBI.

Verdict Justification

  • Critical findings: 0
  • High findings: 0
  • Medium findings: 0
  • Low findings: 0

PASS — proceed to commit per implement skill Step 11.