Skip to content

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

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
replace/18668
Oct 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
replace/18668

Conversation

@iamwhatever

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

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_language for 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

  • 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

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 071691755a4348573551d01ed6a73ff7f60cbf8c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .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 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 071691755a4348573551d01ed6a73ff7f60cbf8c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .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 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 071691755a4348573551d01ed6a73ff7f60cbf8c — 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

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 ships

Inventory (4 items) — 4 justified

Intent: the WakaTime headline and summary card should show the same coding total as WakaTime.com and the Languages bars. This is a FIX.

  1. The drill-in "This range" stat now includes time in the "Other" language bucket — justified
  2. The drill-in "Daily average" now includes time in the "Other" bucket — justified
  3. The Overview WakaTime summary card total now includes time in the "Other" bucket — justified
  4. Two optional nullable fields are added to the WakaTimeStats type — justified

These are the only two frontend readers of the WakaTime total. I grepped total_seconds|daily_average across website/src and the only hits are OverviewPage.tsx:131 and WakaTimeTab.tsx:112-113, so the fix leaves no unfixed siblings. The backend already sends both include-other fields (src/kiro_crew/wakatime/client.py:117,119). Each new type field has exactly two real consumers. The defect has a linked issue (#21521) and new tests that fail on base.

[FIRST-PRINCIPLES-REVIEWED] 0716917

Description read

[DESCRIPTION-READ] b3e75bc75866d5505864fc686eaa0034ef4e29b3a6626da2af01405987b9340a

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 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 071691755a4348573551d01ed6a73ff7f60cbf8c — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 0716917

Verdict parsed from the review's SHA-scoped output markers for commit 071691755a4348573551d01ed6a73ff7f60cbf8c.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 071691755a4348573551d01ed6a73ff7f60cbf8c: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 071691755a4348573551d01ed6a73ff7f60cbf8c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0716917

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 071691755a4348573551d01ed6a73ff7f60cbf8c: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 17, 2026
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)
@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 17, 2026
@iamwhatever
iamwhatever marked this pull request as ready for review October 17, 2026 11:27
@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 17, 2026 11:27
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 17, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 17, 2026 12:03

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit 0abecea into main Oct 17, 2026
107 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the replace/18668 branch October 17, 2026 12:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WakaTime headline total excludes the Other language bucket

3 participants