Skip to content

fix(wakatime): headline reads the include-other coding total - #18668

Closed
Behordeun wants to merge 1 commit into
kirodotdev:mainfrom
Behordeun:feat/wakatime-headline-include-other
Closed

Behordeun wants to merge 1 commit into
kirodotdev:mainfrom
Behordeun:feat/wakatime-headline-include-other

Conversation

@Behordeun

@Behordeun Behordeun commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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" to stats.total_seconds / stats.daily_average, and WakaTimeSummaryCard (the Overview summary card that opens the drill-in) bound its total to stats.total_seconds. Those exclude time in the uncategorised "Other" language bucket. WakaTime.com's own headline and the Languages bars use the *_including_other_language variants, 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 the WakaTimeStats type. The backend already returns the WakaTime data dict verbatim (handlers/wakatime.py returns {"stats": data}; client.fetch_stats returns data unchanged), 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 carries total_seconds=3600 (1h) and total_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 is null, classified total_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 — fixture total_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-screenshots label.

Related Issues

Related to #11336 and #13177 (the separate duration-accrual work); this PR fixes the independent display-field half of the same user-visible symptom. No single issue tracks this display bug.

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Copilot AI balanced review requested due to automatic review settings October 9, 2026 23:46
@Behordeun
Behordeun requested review from a team and KiroCrewCaptain as code owners October 9, 2026 23:46
@Behordeun
Behordeun requested a review from CrysisDeu October 9, 2026 23:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@Behordeun
Behordeun force-pushed the feat/wakatime-headline-include-other branch from 19d2bc7 to cf30496 Compare October 11, 2026 16:52
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 11, 2026
@Behordeun
Behordeun force-pushed the feat/wakatime-headline-include-other branch from cf30496 to ab64ead Compare October 11, 2026 17:03
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 9ea715867721de509fb5e5a3e9e84a5004c03cf3 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 9ea7158

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 9ea715867721de509fb5e5a3e9e84a5004c03cf3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that a live paid-account payload really carries a non-null total_seconds_including_other_language that matches WakaTime.com. The tests only use fixtures.

[DESIGN-REVIEWED] 9ea7158

Description read

[DESCRIPTION-READ] 7e0ebcc34f0954a835a52eb16e19d41a4cb08757e4d7509ca3d45ace3817d01d

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 9ea715867721de509fb5e5a3e9e84a5004c03cf3 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check one live WakaTime payload: total_seconds_including_other_language should equal the WakaTime.com headline for the same range.

What this change ships

Inventory (5 items) — 5 justified

Intent: let a user see the same coding time on the WakaTime overview headline as on WakaTime.com and the Languages bars below it. This is a FIX.

  1. The "This range" stat in the WakaTime drill-in now counts time in the "Other" language bucket. — justified
  2. The "Daily average" stat in the drill-in now counts the "Other" bucket too. — justified
  3. The Overview WakaTime summary card total now matches the drill-in it opens. — justified
  4. When the include-other field is null, all three show the old classified figure instead of zero. — justified
  5. The WakaTimeStats type gains two optional, nullable include-other fields. — justified

[FIRST-PRINCIPLES-REVIEWED] 9ea7158

Description read

[DESCRIPTION-READ] 84917fb20855d7ef9df9cfc47d566a6d3ccaac24ca2d612f7a66e5285a94d5b3

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 9ea715867721de509fb5e5a3e9e84a5004c03cf3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Verify on a real account that the summary card and the drill-in's "This range" now match WakaTime.com.

[UX-REVIEWED] 9ea7158

Description read

[DESCRIPTION-READ] 5b6953de97acdefc5569841b778a7796f1d7a5308fb9df1b4413371b5185bbb4

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 9ea715867721de509fb5e5a3e9e84a5004c03cf3 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 9ea7158

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 11, 2026
@Behordeun
Behordeun force-pushed the feat/wakatime-headline-include-other branch from ab64ead to 1bbac4a Compare October 13, 2026 12:31
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 13, 2026
@Behordeun
Behordeun force-pushed the feat/wakatime-headline-include-other branch from 1bbac4a to cec657b Compare October 13, 2026 12:45
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 13, 2026
@Behordeun

Copy link
Copy Markdown
Contributor Author

Fixed in cec657b. The UX review was right: the first revision moved only the drill-in headline (WakaTimeTab) to the include-other total, which would have left WakaTimeSummaryCard on the Overview page showing the old classified-only figure, so the card and the drill-in it opens disagreed.

WakaTimeSummaryCard now reads total_seconds_including_other_language with the same classified fallback, so both surfaces show the same total. Covered by a new OverviewPage test (classified 30m vs include-other 2h; the card must render 2h). The Windows backend shard failure on the prior run was test_cancelled_descendant_scan_terminates_only_failed_session, a timing-sensitive session-lifecycle test unrelated to this frontend-only diff; the fresh run re-triggered it.

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.
@iamwhatever

Copy link
Copy Markdown
Contributor

Thank you @Behordeun for this fix and the clear write-up of the root cause.

To get it landed, we carried your commit unchanged into same-repo PR #21522 (cherry-picked with -x, your authorship kept), rebased on current main. Its checks are all green. It also tracks the bug as #21521.

Closing this one in favour of #21522. Your branch is left as is. Thanks again!

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants