What happened?
The "Weekly XP" chart on the Settings → Usage page (src/app/(app)/settings/usage/page.tsx) always renders zero-height bars for every week, even for users with recent XP activity.
The chart is fed by getWeeklyXp, which sums the xp key from each activity row's detail column:
// usage/page.tsx:126
weeks[key] = (weeks[key] || 0) + Number(e.detail?.xp ?? 0);
But no code path in the repo ever writes a detail.xp field. I grepped every activity_log insert site — the actual keys written are:
pr_merged → detail: { recId, repo, prNumber, xpAwarded } (process-pr-event.ts:453)
claim → detail: { issueId } / { recId } (issues.ts:376, recommendations.ts:172)
help_dispatch → detail: { helpRequestId, fromUserId } (help-dispatch.ts:91)
xp_tripwire → detail: { threshold, priorTodayTotal, triggeringDelta, source, refId } (events.ts:126-133)
claim_reset_stale / claim_warning_stale → detail: { recId, ... } (maintenance.ts:390, 423)
So e.detail?.xp is always undefined, Number(undefined ?? 0) is always 0, max in XpChart stays at the 1 fallback, and every bar renders 0px tall. The two stat cards ("XP today" / "XP this week") are correct — only the chart is dead.
Steps to Reproduce
- Sign in and earn XP (merge a PR, claim an issue, get mentor-verified, trip the daily cap).
- Navigate to Settings → Usage (
/settings/usage).
- Observe the weekly XP bar chart: all 12 bars are flat/empty despite real activity entries and nonzero "XP this week".
Expected Behavior
The chart should sum the actual XP-bearing fields per event kind (e.g. xpAwarded for pr_merged, triggeringDelta for tripwires, the level-up delta for xp audit events), or the writers should store a normalized xp amount. Bars should reflect real weekly XP.
Where does this occur?
Contributor Dashboard
Environment
Not environment-specific — reproducible in any deployment.
Related
What happened?
The "Weekly XP" chart on the Settings → Usage page (
src/app/(app)/settings/usage/page.tsx) always renders zero-height bars for every week, even for users with recent XP activity.The chart is fed by
getWeeklyXp, which sums thexpkey from each activity row'sdetailcolumn:But no code path in the repo ever writes a
detail.xpfield. I grepped everyactivity_loginsert site — the actual keys written are:pr_merged→detail: { recId, repo, prNumber, xpAwarded }(process-pr-event.ts:453)claim→detail: { issueId }/{ recId }(issues.ts:376, recommendations.ts:172)help_dispatch→detail: { helpRequestId, fromUserId }(help-dispatch.ts:91)xp_tripwire→detail: { threshold, priorTodayTotal, triggeringDelta, source, refId }(events.ts:126-133)claim_reset_stale/claim_warning_stale→detail: { recId, ... }(maintenance.ts:390, 423)So
e.detail?.xpis alwaysundefined,Number(undefined ?? 0)is always0,maxinXpChartstays at the1fallback, and every bar renders0pxtall. The two stat cards ("XP today" / "XP this week") are correct — only the chart is dead.Steps to Reproduce
/settings/usage).Expected Behavior
The chart should sum the actual XP-bearing fields per event kind (e.g.
xpAwardedforpr_merged,triggeringDeltafor tripwires, the level-up delta forxpaudit events), or the writers should store a normalizedxpamount. Bars should reflect real weekly XP.Where does this occur?
Contributor Dashboard
Environment
Not environment-specific — reproducible in any deployment.
Related