feat(stats): add a public review-volume/filtered-rate trend and 2 more hero sparklines - #4722
Conversation
…e hero sparklines (#4445 follow-up) Extends GET /v1/public/stats with reviewVolumeTrend, mirroring #4447's accuracy-trend design but bucketed as per-week COHORTS (a PR credits the week it was first published, and `merged` reflects its current disposition regardless of which week it actually merged) since filteredPct only means anything against a fixed PR set. Wires the homepage's remaining two headline tiles ("PRs reviewed", "Filtered without merge") to their own 8-week sparklines, completing all 5 tiles. "Maintainer time saved" stays without one -- it's a fixed multiple of PRs reviewed, so its own trend would just be a rescaled copy.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
1 similar comment
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4722 +/- ##
=======================================
Coverage 94.19% 94.20%
=======================================
Files 437 438 +1
Lines 38574 38610 +36
Branches 14061 14068 +7
=======================================
+ Hits 36336 36372 +36
Misses 1576 1576
Partials 662 662
🚀 New features to boost your workflow:
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 6601f41 | Commit Preview URL Branch Preview URL |
Jul 10 2026, 08:44 PM |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-10 20:47:03 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
Review context
Contributor next steps
Signal definitions
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
GET /v1/public/statswithreviewVolumeTrend— the last two homepage headline tiles ("PRs reviewed", "Filtered without merge") were the only ones left without a sparkline, since neither had a persisted weekly series before this.accuracyTrend's merged/closed split: a PR credits the week it was first published, andmergedreflects its current disposition regardless of which week it actually merged.filteredPctonly means anything evaluated against a fixed PR set, so a cohort is the only formulation that stays consistent with the lifetimetotals.filteredPctfigure it mirrors.--chart-3,--chart-4), completing all 5 hero tiles — "Maintainer time saved" is the one intentionally left without one, since it'sreviewed × ~20min, a fixed multiple of the first tile, so its own trend would just be a rescaled copy of the same line.Closes #4721.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlint— skipped, no.github/workflows/**changes.npm run typechecknpm run test:coverage(targeted, not the full unsharded suite — see Notes) locally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed. Verified every changed line insrc/api/routes.ts,src/openapi/schemas.ts, and the newsrc/services/public-review-volume-trend.tsis hit, viatest/unit/public-review-volume-trend.test.ts(100% stmts/branch/funcs/lines on the new file),test/integration/public-stats-route.test.ts(extended), andtest/integration/public-stats-route-error.test.ts(unchanged, already covers the sharedPromise.allcatch path).npm run test:workers— skipped, no Worker-specific code touched beyond whattypecheck/test:coveragealready cover.npm run build:mcp/npm run test:mcp-pack— skipped, no MCP package changes.npm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
test:workersand the MCP checks are unrelated to this diff's surface (a new service module + one route field + a UI model/component extension);typecheck+ the targeted coverage above already validate the actual change.Safety
reviewVolumeTrendfield, OpenAPI regenerated +ui:openapi:checkclean./v1/public/statspayload.user-attachments/user-imagesURLs, and the template asks not to commit review-evidence images to the repo). See Notes for what was actually verified.Notes
Test coverage added:
test/unit/public-review-volume-trend.test.ts(9 tests): the cohort-bucketing pure function (accumulation across days in the same week, out-of-window rows ignored, unparseable day strings ignored, theMIN_REVIEW_VOLUME_TREND_SAMPLEnull-guard on both sides of the boundary, defaultweeksparam, empty-input all-zero buckets) and an end-to-end test proving a PR credits its publish week's cohort even when it merges in a later week, plus Orb-fleet folding across two directions of the?? 0fallback.test/integration/public-stats-route.test.ts(extended): assertsreviewVolumeTrendrides along on the same response, with real numbers from the existing seed.apps/gittensory-ui/src/components/site/proof-of-power-stats.test.tsx(updated): the "five headline stats" test's sparkline-count assertion is now 4 (all trend-eligible tiles), using an extended payload fixture.UI Evidence — what was actually verified (real
rechartsrender in a real browser DOM via Claude Code's Preview tooling, not a snapshot test; same method used for the original two sparklines):--chart-1..--chart-4ramp (verified via computedstrokematching the exact OKLCH values instyles.css), 2px stroke, round caps/joins..darkclass off directly (this app keys theming off a class, notprefers-color-scheme) — all 4 sparklines correctly repaint to their light-mode OKLCH values.