Repository navigation
fix(desktop): use the live spans-endpoint total for the Load more badge - #22
Merged
nishantmodak merged 1 commit intoSep 9, 2026
Conversation
nishantmodak
approved these changes
Sep 9, 2026
nishantmodak
left a comment
Owner
There was a problem hiding this comment.
Approved. The header and Load more badge now use the total returned by the spans endpoint, with the trace summary as a lower bound. This handles a growing trace whose selected summary is stale while preserving the existing pagination response guard. No blocking findings.
Local validation: all 31 desktop tests passed on this head. Frontend, Linux/macOS core, and macOS bundle CI checks pass. Native WebView smoke testing was not run in this review.
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.
Detail bug report: View on Detail
Closes #17
Bug
TracePanel's "Load more spans" badge usedtrace.span_countas its denominator, buttrace.span_countonly updates via the polled recent-traces list. When a non-matching search filters the selected trace out of that list,App.tsxfalls back to a frozenselectionandtrace.span_countstops updating. Meanwhile "Load more" fetches from the live spans endpoint whosetotalreflects the current trace size (a liveCOUNT(*)), so during active capture + filtered search the badge could render an impossibility like400 of 250. The headerN spansread the same stale value, so the two displays could also disagree.Fix
In
desktop/src/panels.tsx(TracePanel):liveTotalstate seeded frompage.data.total(the first page) and advanced from eachmore()response'stotal— the authoritative live span count from the spans endpoint.displayedTotal = Math.max(liveTotal ?? 0, trace.span_count)in both the badge and the headerN spans, so the two can't disagree.Math.max(notliveTotal ?? trace.span_count) is required: when the polledspan_countrefreshes past a fetched page'stotal, the denominator must follow the fresher value. This keeps the existingd9ee901"200 of 300" assertion intact.useLivepage key and themore()in-flight guard key still usetrace.span_count(the selection-identity staleness guard) — unchanged.api.tsis untouched.Testing
load-more-stale.test.tsxrenders the realApp, selects a capture-active trace (capture_status: "collecting"), filters it out with a non-matchingxyzsearch, clicks "Load more" against a grown trace, and asserts the badge reads400 of 600with header600 spans(never400 of 250). It fails on the unmodified code with the reported message and passes with the fix.d9ee901keeps the badge at200 of 300after the polledspan_countadvances and drops the stale in-flightmore()response; the settled/normal paging test confirms "Load more" disappears at the end and appended spans render.tsc -b), Prettier, and the full frontend suite (31 tests) are green.ltracereceiver (not mocked): ingesting spans into one trace and reading the spans endpoint confirmed the livetotaladvances under capture (250→600,next_offset200→400), the run iscollecting, andrecent_traces?q=xyzexcludes the trace while a matching query re-includes it.cargo test --test receiver(10 tests) passes.glib-2.0/webkit2gtk-4.1system libs, no display/Xvfb), and the frontend can't run in a browser (Tauri IPC + origin-restricted read API). These scenarios are otherwise covered by the component-level reproduction test (pins the rendered400 of 600/600 spans), the existing panels tests (page re-key reset and paging-end button disappearance), and the backend receiver verification above.Automatic Fixes PRs can be configured here.