fix(db): paginate complete trace tag groups - #124
Open
n30nex wants to merge 1 commit into
Open
Conversation
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.
What this PR does
Closes #123. The trace-list cursor filters individual packets before grouping them by trace tag. A tag returned on an earlier page can therefore appear again with an older timestamp and a smaller packet count.
Apply the cursor to each filtered group's maximum
last_heard_atinHAVING. Existing region, scope, type and time-window filters still define the group; its complete count, timestamps and best-payload selection are preserved. No schema or API contract changes.Type of change
Checklist
go build ./...passesgofmt -l .is emptygo vet ./...passesgo test ./...passesCONTRIBUTING.mdTesting notes
The PostgreSQL regression uses temporary tables in a rolled-back transaction and calls the real Store/SQL path. Interleaved packet timestamps make four trace tags produce seven summaries across two-row pages on the original query, including three repeats with altered summaries. The candidate returns exactly four complete summaries. Both outcomes were reproduced in five native Pi 5 runs.
Twelve cases check initial/cursor/end pages, region and duplicate-region filters, unknown regions, scopes, types and inclusive time windows. Cases where scope/type/time filtering changes a group's maximum verify that the cursor uses that filtered maximum. Returned times, counts, IATA counts, type, longest path and SNR values are reconciled.
Full Go checks pass locally and natively on the Pi, including the combined preview source. Live seven-row pages reconcile 45 global traces and 36 regional traces without repeats or changed summaries; TRACE and PING lists also pass. Ordinary API/burst smoke, fresh MQTT ingestion, public source hashes and the populated Traces view pass at the preview. Exact combined source:
031fd5659ca038dacd0dc8ceba681fd66fd8564b, linked from Source & changes.The existing timestamp-only cursor still has no tie breaker and is represented in milliseconds. Traversal across equal timestamps or concurrent data changes is not made snapshot-complete by this fix; extending that contract is separate work.
AI tools assisted implementation and validation under the contributor's standing approval for this effort.