fix: clamp future lastHeard timestamps to current time on ingestion#5418
Merged
Conversation
Nodes with bad time sources can report lastHeard values in the future, causing the UI to display nonsensical "last heard" times. This adds a clampTimestampToNow() utility that caps epoch-second timestamps at the current wall-clock time, applied at all packet ingestion points: - MeshMessageProcessorImpl: remote node rx_time - NodeManagerImpl: position time, telemetry time, installNodeInfo - TelemetryPacketHandlerImpl: telemetry-driven lastHeard Also clamps position.time to prevent future times in map UI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
The 'close resets transport' test used withTimeout inside runTest, where the test scheduler's virtual time could race ahead of the actual TCP socket FIN propagation. Wrapping the readLine assertion in withContext(Dispatchers.Default) ensures the timeout uses real wall-clock time, giving the socket closure time to propagate on loaded CI runners. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fe32771 to
014773a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Nodes with bad time sources report
lastHeardvalues in the future, causing the UI to display nonsensical "last heard" times (e.g. "in 3 days").Solution
Adds a
clampTimestampToNow()utility incore:commonthat caps epoch-second timestamps at the current wall-clock time. Applied at all packet ingestion points:rx_timeinstallNodeInfo(bothlast_heardandposition.time)lastHeardPast timestamps pass through unchanged. Only future values are clamped to
now.Testing
clampTimestampToNow()(past, future, zero)core:dataandcore:commontests pass