Skip to content

Store GitHub community scores in the database - #33

Merged
meddlin merged 1 commit into
mainfrom
claude/community-score-storage-9fd8b7
Nov 2, 2026
Merged

meddlin merged 1 commit into
mainfrom
claude/community-score-storage-9fd8b7

Conversation

@meddlin

@meddlin meddlin commented Nov 2, 2026

Copy link
Copy Markdown
Owner

What changed

Community scores are now persisted in gitlib.db instead of living in a 30-minute in-memory cache that was lost on every restart.

  • New github_community_profiles table (created automatically on existing databases), keyed by lowercased owner/repo so linked worktrees share a row.
  • The repo list and Community tab read stored profiles, so no GitHub request is made per view.
  • Daily refresh: profiles older than 24h are re-fetched in the background, oldest first, triggered by a page load and by an hourly check while the server runs. GITLIB_COMMUNITY_REFRESH_HOURS changes the interval; 0 disables automatic refresh.
  • Manual refresh: a "Refresh scores" button on the repo list (all repos) and a "Refresh" button on each Community tab (one repo), both showing when data was last fetched.
  • Rescan no longer touches community scores.
  • A failed or rate-limited refresh keeps the stored scores, shows the error, and backs off automatic retries for an hour.

Why

Scores cost one GitHub request per repo, and anonymous access allows only 60 an hour. Storing them makes the table instant and usable offline, and spends requests only on a schedule or on demand.

Reviewer notes

  • The scheduler starts on the first server request after startup, not at process boot.
  • Only {score, items: {id, present, url}} is stored; labels and hints come from code, so wording changes apply to old rows. Rows missing a checklist item are treated as unusable and re-fetched.
  • Docs, both .env.example files, and docker-compose.yml are updated for the new setting.

Testing

  • npm run typecheck and npm test pass (185 tests), including new tests for the store, stored format, and the interval/staleness helpers.
  • Manually checked in a throwaway instance: a rate-limited auto-refresh showed its error; Refresh scores then fetched 28% for a public repo, wrote the row, and the score was still shown after a restart with no GitHub call. The per-repo Community-tab Refresh button was not clicked, to conserve rate limit.

🤖 Generated with Claude Code

Scores used to live in a 30-minute in-memory cache and were re-fetched from
GitHub on every restart. They now persist in a github_community_profiles table
in gitlib.db, keyed by lowercased owner/repo so worktrees share a row.

- The repo list and Community tab read stored profiles; no GitHub call per view.
- Stale profiles (default 24h, GITLIB_COMMUNITY_REFRESH_HOURS, 0 = off) are
  refreshed in the background on page load and by an hourly server check,
  oldest first so a rate-limited run resumes where it stopped.
- "Refresh scores" on the repo list and "Refresh" on the Community tab fetch
  on demand. Rescan no longer touches scores.
- A failed refresh keeps stored scores and backs off automatic retries for an hour.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@meddlin
meddlin merged commit 886efc4 into main Nov 2, 2026
1 check passed
@meddlin
meddlin deleted the claude/community-score-storage-9fd8b7 branch November 2, 2026 18:26
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.

1 participant