fix(admin): bound star history refreshes and correct chart rendering
Merged
KI
2mo ago+300+300+012345678901234567890123456789-71-71-01234567890123456789
What & why
A cold admin star-history request took about 38 seconds, and expired cache entries made readers wait for another full GitHub walk. Missing stargazer pages could also distort the curve when the last point was forced to the live total.
- Keep six-hour fresh data and a seven-day last-good copy; serve stale data while one shared refresh lease updates it. Coalesce concurrent fetches within each process.
- Bound the admin GitHub walk to 50 seconds, including retries and delays. Reject incomplete exact histories and remove the artificial final-point adjustment. Version the cache key to avoid reusing old distorted results.
- Preserve the first visible period's gains when filtering a date range. Let controls wrap, remove the fixed chart aspect ratio, and give each chart instance unique gradient IDs.
How I tested it
bun test packages/trpc/src/lib/growth: 24 passed, covering deadlines, missing pages, live-total drift, cache coalescing, and stale refreshes.bun run lint: passed.bun run typecheck: all 42 tasks passed.bun run test: failed in sandbox credential tests withDataErrorfrom crypto key import. Running that test file alone still reports one unrelated credential assertion failure. The new growth tests pass in the full run.- Rendered the shared chart locally at
/starchartusing real GitHub history; checked day/week toggles and 360px chart width with no horizontal overflow. Browser console was clean. - Screenshots below are from the local marketing page using the shared chart. The authenticated production admin dashboard remains unverified because the browser pane is signed out. This PR has not been deployed.
Cumulative history

Weekly gains

Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs (same-repository branch)
Summary by cubic
Introduces a stale-serve refresh path for the admin star-history cache and tighter bounds on the GitHub walk, then fixes related chart rendering.
- Serves six-hour-fresh data with a seven-day last-good copy; concurrent refreshes coalesce into one shared lease per process and failed refreshes keep the last good chart.
- Bounds the stargazer walk to 50 seconds total (including retries and delays), rejects any history with missing pages, and removes the artificial final-day adjustment that inflated the curve when the live total ran ahead. The cache key is bumped to
v2so old distorted results aren't reused. - Chart fixes: preserve the first visible period's gains when filtering a date range, let controls wrap, drop the fixed aspect ratio, and give each chart instance unique gradient IDs.