mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-06-06 08:01:30 +00:00
80bf128547
parseEnvelopeTime now returns a 'naive' flag identifying zone-less ISO parses (python isoformat-style). resolveRxTime applies a symmetric 15-minute tolerance window for naive values: anything more than 15 min off server-now collapses to ingest time and emits a warning log. Background (issue #1463): Naive timestamps are parsed as-if UTC. A California observer (UTC-7) emitting a naive local-clock value produces a moment 7h in the past; the existing soft-clamp only caught the future-skew (UTC+N) mirror case. As a result UTC-N observers had last_seen perpetually pinned ~7h behind wall-clock and rendered 'Stale' in the UI despite active MQTT status traffic. Why option B (symmetric clamp) over reject-or-warn-only: - Backward compatible: well-behaved observers (Z-suffixed or explicit offset) are entirely untouched regardless of skew, so legitimate buffered uploads remain accurate to the second. - Symmetric: catches both UTC+N and UTC-N drift with a single rule. - Visible: 'naive timestamp ... off by Xh, using ingest time' lands in the ingestor log so operators can identify which upstream observers still need to switch to RFC3339 with a zone. Tolerance is 15 min — large enough to absorb genuine clock skew on well-synced naive observers (the rare UTC observer using python datetime.now().isoformat() without tz), small enough that any non-zero UTC offset is caught. Tests: - TestResolveRxTimeNaiveTimestampClamp added in the red commit now passes green. - TestParseEnvelopeTime updated for the new (time.Time, bool, error) signature and asserts the naive flag. - All existing rxtime tests (factory date, 30-day floor, 14h future, plausible past) preserved unchanged. Fixes #1463