Repository navigation
π fix(web): self-host the Star History chart after upstream outage - #672
Conversation
api.star-history.com went down globally (their GitHub tokens rate-limited, star-history/star-history#548), breaking the homepage card and README embed; starchart.cc is failing too. Remove the third-party dependency: - β¨ /api/star-history route renders the cumulative-stars SVG from our own origin: stargazer timestamps fetched server-side (optional GITHUB_TOKEN, graceful anonymous fallback), edge-cached 6h with stale-while-revalidate, short-lived fallback SVG when the fetch fails outright - π¨ chart drawn in the site ocean accent (sky-600, validated against both card surfaces) with neutral ink tokens and a tight nice-ceiling y-scale - π homepage chart component points at the self-hosted endpoint; link target now the GitHub stargazers page - π README swaps the embed for a theme-aware <picture> pair on getdrydock.com and links to the stargazers page - π api.star-history.com dropped from the CSP img-src Fixes #671
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
π WalkthroughWalkthroughThe change replaces third-party Star History images with a self-hosted flow. A Node.js API route fetches GitHub stargazer timestamps, applies caching and failure handling, and returns theme-aware SVG output. New utilities build cumulative series and render chart or fallback SVGs. The homepage and README use local light and dark endpoints. The CSP removes the external image source. Tests cover route behavior and SVG rendering. Possibly related PRs
π₯ Pre-merge checks | β 2β Passed checks (2 passed)
β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and canβt be posted inline due to platform limitations.
β οΈ Outside diff range comments (1)
apps/web/src/components/star-history-chart.tsx (1)
21-24: π― Functional Correctness | π‘ Minor | β‘ Quick winMake the accessible name match the link destination.
CHART_HREFopens the GitHub stargazers page. The current label says it opens the chart. Rename the link to describe the actual destination.Proposed fix
- aria-label="Open the Star History chart" + aria-label="Open the GitHub stargazers page"π€ Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/components/star-history-chart.tsx` around lines 21 - 24, Update the aria-label on the link using CHART_HREF to describe the GitHub stargazers destination rather than the Star History chart, while leaving the link behavior unchanged.
π€ Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/app/api/star-history/route.ts`:
- Around line 16-18: Update the star-history routeβs pagination flow around
MAX_PAGES and the later-page failure handling to require complete stargazer
retrieval before calling renderStarHistorySvg or storing SUCCESS_CACHE. If
pagination is capped or any page fetch fails, return the existing fallback
response; do not render or cache partial data as the repositoryβs total history.
- Around line 37-40: Update fetchStarredTimestamps() to create one
AbortSignal.timeout(...) before the pagination loop, then pass that shared
signal in the options for every GitHub fetch call. Keep the deadline shared
across all pages rather than creating a new timeout per request.
---
Outside diff comments:
In `@apps/web/src/components/star-history-chart.tsx`:
- Around line 21-24: Update the aria-label on the link using CHART_HREF to
describe the GitHub stargazers destination rather than the Star History chart,
while leaving the link behavior unchanged.
πͺ Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ed2ee8a-984b-4251-aea3-00b126545f31
β Files ignored due to path filters (1)
CHANGELOG.mdis excluded by!CHANGELOG.md
π Files selected for processing (7)
README.mdapps/web/scripts/marketing-performance.test.mjsapps/web/scripts/star-history-svg.test.mjsapps/web/src/app/api/star-history/route.tsapps/web/src/components/star-history-chart.tsxapps/web/src/lib/content-security-policy.mjsapps/web/src/lib/star-history-svg.mjs
β¦nd fetches - π fix: any failed/capped page now returns the fallback SVG instead of rendering and caching a truncated star total - π fix: one shared AbortSignal.timeout deadline across the pagination run so a stalled GitHub request can't hang the response - π§ͺ test: source guards for the no-partial-render and shared-deadline invariants
There was a problem hiding this comment.
Actionable comments posted: 1
π€ Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/scripts/marketing-performance.test.mjs`:
- Around line 62-65: Strengthen the source assertion for the pagination
implementation to verify that the shared
`AbortSignal.timeout(FETCH_DEADLINE_MS)` is created before the `fetch(...)` call
or pagination loop, not merely present in the source. Update the assertions
around `starHistoryRouteSource` to enforce one signal reused across pages while
preserving the existing headers/signal/next coverage.
πͺ Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a4bf8e14-42fb-451a-8e83-c91e837e6d38
π Files selected for processing (2)
apps/web/scripts/marketing-performance.test.mjsapps/web/src/app/api/star-history/route.ts
π§ Files skipped from review as they are similar to previous changes (1)
- apps/web/src/app/api/star-history/route.ts
| // One shared deadline across the whole pagination run. | ||
| assert.match(starHistoryRouteSource, /AbortSignal\.timeout\(FETCH_DEADLINE_MS\)/u); | ||
| assert.match(starHistoryRouteSource, /\{ headers, signal, next:/u); | ||
| }); |
There was a problem hiding this comment.
π― Functional Correctness | π‘ Minor | β‘ Quick win
π§© Analysis chain
π Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate file =="
git ls-files | rg 'apps/web/scripts/marketing-performance.test.mjs|marketing-performance' || true
echo "== relevant test lines =="
if [ -f apps/web/scripts/marketing-performance.test.mjs ]; then
nl -ba apps/web/scripts/marketing-performance.test.mjs | sed -n '1,120p'
fi
echo "== search timeout usage in target/router source =="
rg -n "starHistoryRouteSource|AbortSignal\.timeout|FETCH_DEADLINE_MS|for \\(let page|fetch\\(" apps/web -S || trueRepository: CodesWhat/drydock
Length of output: 287
π Script executed:
#!/bin/bash
set -euo pipefail
echo "== relevant test lines =="
awk '{printf "%7d\t%s\n", NR, $0}' apps/web/scripts/marketing-performance.test.mjs | sed -n '1,140p'
echo "== timeout/fetch/route usages =="
rg -n -S "starHistoryRouteSource|AbortSignal\.timeout|FETCH_DEADLINE_MS|for \\(let page|for \\(.*page|fetch\\(" apps/web -g '!node_modules' || trueRepository: CodesWhat/drydock
Length of output: 5323
Enforce signal-share coverage in the assertion.
The current check only proves AbortSignal.timeout(FETCH_DEADLINE_MS) exists, not that it is created before fetch(...) in the pagination loop. A timeout created inside the loop would still pass but give each page its own deadline.
Minimal source-level fix
- assert.match(starHistoryRouteSource, /AbortSignal\.timeout\(FETCH_DEADLINE_MS\)/u);
+ assert.match(
+ starHistoryRouteSource,
+ /const signal = AbortSignal\.timeout\(FETCH_DEADLINE_MS\);[\s\S]*?for \(\$1=let page = 1;/u,
+ );π€ Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/web/scripts/marketing-performance.test.mjs` around lines 62 - 65,
Strengthen the source assertion for the pagination implementation to verify that
the shared `AbortSignal.timeout(FETCH_DEADLINE_MS)` is created before the
`fetch(...)` call or pagination loop, not merely present in the source. Update
the assertions around `starHistoryRouteSource` to enforce one signal reused
across pages while preserving the existing headers/signal/next coverage.
biggest-littlest
left a comment
There was a problem hiding this comment.
LGTM β self-hosting kills the third-party dependency, and the fallback-on-incomplete-pagination behavior is the right call.
17-file identity roll-forward from rc.12 to rc.13, dated 2026-08-08. - CHANGELOG: new `[1.6.0-rc.13]` section from Unreleased content β #670 digest re-anchoring, #672 self-hosted Star History, #673 nanoid pin, #682 node 24.19.0 + trivy 0.73.0 base-image bumps, #683 icon-bundle alias resolution β plus compare-link rotation - README: version badge + rc.13 highlights block - Demo mocks, site config/content, docs API pages, quickstart, updates highlights, identity-test constants, changelog-link pairs Guarded by `scripts/release-identity.test.mjs` (4/4) and the web scripts suite (56/56). Once merged: devβmain wholesale-tree sync, then dispatch `release-cut.yml` for `v1.6.0-rc.13`. GA candidate clock restarts β earliest GA β Aug 16. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Changelog π§ **Changed** - Advanced the release identity from `1.6.0-rc.12` to `1.6.0-rc.13`, dated August 8, 2026. - Updated README, demo mocks, site configuration, roadmap content, API examples, quickstart, and update highlights. - Updated changelog comparison links and release identity test constants. - Added release notes for digest re-anchoring, self-hosted Star History, `nanoid` pins, Node 24.19.0 and Trivy 0.73.0 base images, and icon-bundle alias resolution. π **Security** - Documented workspace-wide `nanoid` security pinning. - Documented base-image CVE remediation. ## Concerns - Sync the `dev` tree to `main` after merge. - Dispatch `release-cut.yml` for `v1.6.0-rc.13`. - Confirm the expected GA date remains approximately August 16. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Wholesale-tree sync ahead of the v1.6.0-rc.13 cut (same pattern as #667). The single commit carries the exact tree of `dev/v1.6` at b98808e onto `main` β after merge, `git diff --quiet origin/main origin/dev/v1.6` holds. Content on dev since rc.12: - #669/#670 β release-cut digest re-anchoring - #672 β self-hosted Star History chart - #673 β NAS acceptance follow-ups - #681 β v1.7 dependency ordering (forward-ported) - #682 β CVE base-image bumps + digest-pinned Node base guard test - #683 β icon-bundle alias resolution (fixes blank Audit/registry icons shipped in rc.12) - #684 β rc.13 identity roll-forward (17 files, CHANGELOG, README) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Changelog - β¨ Added repository-aware Docker digest selection and multi-anchor comparison. - β¨ Added self-hosted, theme-aware Star History SVG API with pagination, caching, deadlines, and fallback rendering. - β¨ Added icon alias resolution and bundle coverage tests. - β¨ Added required icon bundle entries and updated icon mappings. - π§ Updated Node and Trivy image digests. - π Pinned `nanoid` to `3.3.18` across workspaces. - π Added a digest-pinned Node 24 Alpine base-image guard test. - π§ Updated `js-yaml` override to `3.15.1`. - π§ Updated release documentation, examples, mocks, badges, and tests to `1.6.0-rc.13`. - π§ Removed the external Star History CSP allowlist and embed. ## Concerns - Verify the Star History route stays within GitHub API rate limits under concurrent requests. - Verify cache headers do not serve incomplete or repository-specific fallback responses incorrectly. - Verify Docker digest re-anchoring preserves legacy behavior for stored containers without `repoDigests`. - Verify icon aliases with rotation or flipping have acceptable fallback behavior. - Run the Docker, Star History, icon-bundle, release-identity, and workspace dependency tests. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
The Star History chart on the homepage and in the README stopped rendering because api.star-history.com is down globally (GitHub restricted their starred-data access; upstream issue star-history/star-history#548 β every repo 404s/500s, and starchart.cc 400s too). This self-hosts the chart so no third party sits between us and the image again.
GET /api/star-history?theme=light|dark(apps/web/src/app/api/star-history/route.ts): pages the GitHub stargazers API (application/vnd.github.star+json) forstarred_attimestamps and renders an SVG. Cached 6h at the edge (s-maxage=21600, stale-while-revalidate=604800); on fetch failure it serves a short-lived (5 min) fallback SVG instead of a broken image. OptionalGITHUB_TOKENenv raises the rate limit but is not required (unauthenticated 60/hr is plenty at one origin fetch per 6h per theme).apps/web/src/lib/star-history-svg.mjs): cumulative-series builder, nice y-scale (3β5 integer ticks, tightest ceiling β 215 stars scales to 250, not 400), XML escaping, light/dark palettes using the site's ink/muted tokens with the sky-600 accent, transparent background so the homepage card and GitHub README canvas supply their own surface.star-history-chart.tsx): swaps the third-party URLs for/api/star-history?theme=β¦; link now points at the stargazers page instead of star-history.com.https://api.star-history.comremoved from img-src (route is same-origin).<picture>element with dark/light sources pointing athttps://getdrydock.com/api/star-history.Testing
apps/web/scripts/star-history-svg.test.mjs(series building, theme resolution, escaping, empty-series, nice-scale, fallback) + a guard inmarketing-performance.test.mjsasserting no third-party chart host remains. 55 web scripts tests pass.tscclean; biome clean.Deployment note
README (GitHub) and getdrydock.com both serve from
main, so this goes live at the next devβmain sync (GA cut, 2026-08-12) unless we sync earlier. Until then the embed URLs 404 by design β the current state is already broken, so nothing regresses.Fixes #671
β¨ Added
GET /api/star-history?theme=light|dark.GITHUB_TOKEN.π§ Changed
getdrydock.com.runtime = "nodejs"to the API route.ποΈ Removed
Removed
api.star-history.comfrom the image CSP.Removed third-party chart hosts from the request path.
Verify the configured repository slug in every deployment environment.
Verify GitHub rate-limit and incomplete-pagination behavior.
Verify cache behavior in the production runtime.
Confirm
GITHUB_TOKENremains server-only.