Repository navigation
fix(wakatime): headline reads the include-other coding total - #21522
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS On a real WakaTime account with heavy "Other" time, check that "This range", "Daily average" and the Overview card now match WakaTime.com. [UX-REVIEWED] 0716917 Description read[DESCRIPTION-READ] 9edae9b8c0240f1af9531453c659545da6a947c98d73ab9f69789c06953490f3 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Load a real account where most time is in "Other" and check the headline now roughly matches WakaTime.com. [DESIGN-REVIEWED] 0716917 Description read[DESCRIPTION-READ] 385b64cd5ef762a0c9878f9cd2e61281ef6c502244c5f69f79d053da6c6f2bd4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS One thing to check: the "free accounts return null" claim behind the fallback is unconfirmed. It does no harm either way, because the fallback only applies when the field is missing. What this change shipsInventory (4 items) — 4 justifiedIntent: the WakaTime headline and summary card should show the same coding total as WakaTime.com and the Languages bars. This is a FIX.
These are the only two frontend readers of the WakaTime total. I grepped [FIRST-PRINCIPLES-REVIEWED] 0716917 Description read[DESCRIPTION-READ] b3e75bc75866d5505864fc686eaa0034ef4e29b3a6626da2af01405987b9340a That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
WakaTime's classified total_seconds drops the "Other" bucket (heartbeats that arrive without a recognised language), so an account that dumps most of its time there shows a headline a fraction of the real total while the Languages breakdown stays correct. The dashboard's own Languages bars and WakaTime.com's headline both read the *_including_other_language variants. The Overview WakaTime drill-in (WakaTimeTab) and the Overview summary card (WakaTimeSummaryCard) now read total_seconds_including_other_language and daily_average_including_other_language, falling back to the classified field when the include-other variant is null (free accounts do not report it). Fixing only the drill-in would leave the summary card and the drill-in it opens disagreeing, so both move together. Two fields added to the WakaTimeStats type; the backend already forwards the WakaTime payload verbatim, so this is a frontend read-site change. Covered by tests pinning the include-other preference and the null fallback on both the drill-in headline and the summary card. (cherry picked from commit 9ea7158)
5adf70a to
0716917
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: bug fix; the WakaTime headline and overview card read the include-other totals with a fallback to the classified totals, with tests.
Problem / Motivation
Goal: make the WakaTime overview headline report the same coding time the user sees on WakaTime.com and in the Languages bars right below it, instead of a figure that is only a fraction of the real total.
The headline reads far lower than it should. On one account the "This range" stat showed 6h 31m while the Languages breakdown beneath it summed to roughly 95h and WakaTime.com reported 78h 5m for the same range; the daily average showed 56m against WakaTime's 13h. A total that is smaller than the Languages bars it sits above is structurally impossible for a true total, which is the tell that the headline is reading the wrong field.
Why it matters
The headline is the first number a user looks at to judge how much time was recorded. Reading it low makes the integration look broken or makes real coding time look like it was lost, and the discrepancy is largest for exactly the users this integration serves most: heavy agent users, whose coding turns send heartbeats without a recognised language and so land in WakaTime's "Other" bucket. The Languages bars and WakaTime.com both count that bucket; the headline did not.
Not a goal
What changed (motivation → approach → change)
Observed symptom: the headline "This range" and "Daily average" read a small fraction of the Languages bars and of WakaTime.com for the same range.
Root cause: both surfaces that show a WakaTime total bound it to the classified-only field.
WakaTimeTab(the Overview drill-in) bound "This range" and "Daily average" tostats.total_seconds/stats.daily_average, andWakaTimeSummaryCard(the Overview summary card that opens the drill-in) bound its total tostats.total_seconds. Those exclude time in the uncategorised "Other" language bucket. WakaTime.com's own headline and the Languages bars use the*_including_other_languagevariants, so on an account that sends most of its time without a recognised language the classified-only figure collapses to a fraction of the real total.Change: both the drill-in headline and the summary card now prefer
total_seconds_including_other_language/daily_average_including_other_language, falling back to the classified field when the include-other variant is absent or null (free WakaTime accounts can return null there). Fixing only the drill-in would leave the summary card and the drill-in it opens disagreeing, which the UX review flagged, so both move together. The two fields are added to theWakaTimeStatstype. The backend already returns the WakaTimedatadict verbatim (handlers/wakatime.pyreturns{"stats": data};client.fetch_statsreturnsdataunchanged), so both fields were already arriving at the client; this is a frontend-only field-choice fix.Backwards compatibility
Compatible: the change only reads two additional optional fields and keeps the existing fields as a fallback, so an account whose payload lacks the include-other variants renders exactly as before. The two new type fields are optional and nullable, adding no required field and narrowing nothing.
Removes nothing: no field, route, type member or capability is removed, renamed or hidden; two optional reads are added and the prior reads are retained as the fallback.
Tests
website/src/test/WakaTimeTab.test.tsx(the drill-in):headline reads the include-other total so it matches WakaTime.com and the Languages bars— payload carriestotal_seconds=3600(1h) andtotal_seconds_including_other_language=10800(3h); the headline must render 3h, not 1h.falls back to the classified total when the include-other field is null (free account)— include-other field isnull, classifiedtotal_seconds=7200(2h); the headline must render 2h, not zero.website/src/test/OverviewPage.test.tsx(the summary card):shows the WakaTime summary total from the include-other field, not the classified-only total— fixturetotal_seconds=1800(30m),total_seconds_including_other_language=7200(2h); the card must render 2h, not 30m, so it matches the drill-in it opens.The existing WakaTimeTab and OverviewPage tests continue to pass.
Manual verification
N/A — unit coverage sufficient. The change is a field-selection expression in two existing components, fully exercised by the three new tests plus the existing render tests. The symptom was a wrong numeric value in an existing, unchanged layout.
Screenshots / video
Why no screenshot: the only rendered change is the numeric value inside the existing, unchanged "This range" / "Daily average" stats and the Overview WakaTime summary card (the components, layout, styling and i18n labels are untouched), and this is a fork PR without GitHub attachment write access, so the before/after is given numerically in What changed rather than as media. A maintainer may apply the
no-screenshotslabel.Related Issues
Fixes #21521
Replaces #18668
Carried from fork PR #18668 by @Behordeun (cherry-picked with
-x, authorship kept). Thank you for the fix and the clear write-up.Related to #11336 and #13177 (the separate duration-accrual work); this PR fixes the independent display-field half of the same user-visible symptom. Relation to #20969 / #19394: those are backend-only (serve today/yesterday from summaries). #20969, now on main, already emits
total_seconds_including_other_language/daily_average_including_other_languagefor those ranges; this PR makes the frontend read them.Pattern harvest
Rule candidate: review-prompt
Pattern: a UI headline/summary stat binds to a provider's partial/classified total (e.g.
total_seconds) while the detail breakdown beside it uses the provider's grand total (*_including_other_language), so the summary reads smaller than the detail it summarises. When a total sits above its own breakdown, or two surfaces show the same provider total, they must read the same source field.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)