Why
Closes #132. The repository overview read git on every request: rev-parse
for the tip, log for five commits, for-each-ref for tags, ls-tree plus
shortlog for languages and contributors, and cat-file for the README. Only
the README is not a property of a ref, and refs move only when a push lands.
This is stacked on #131 (the head summary) because it uses the repos.head_sha
comparison to decide whether the stored summary belongs to the tip being shown.
Base is index/head-summary; #131 should merge first.
What changed
- Schema v10:
repo_languages,repo_commits,repo_contributors,repo_tags. They are derived rows, deleted with the rest on a schema bump orvole admin index rebuild. RefreshHeadnow stores the tip’s five newest commits and its language breakdown from onels-tree -r -l, and reports whether the tip moved.RefreshContributorsstores the top eight authors; the hook calls it only when the tip changed, so a metadata or tag push never runsshortlog.RefreshTagsstores the tag rows beside the release events it already rewrote.IndexReponow refreshes tags and contributors too, so a rebuild restores everything a push would have written.- The overview reads those rows when
Entry.HeadSHAequals the actual branch tip (read withRefCommit, a loose-ref file read) and falls back to git when it does not. If one stored section is empty on a repository with commits, that section alone is re-read from git, so a failedshortlogor tree walk does not leave a blank forever. - Sidebar:
Filter.Limit/RequestFilter.Limitlet the overview ask for the five open rows it shows instead of sorting the whole queue in memory. - README: rendered HTML is cached by repository, commit and ref under a byte budget (8 MiB / 512 entries), and a repository with no README remembers that too instead of trying four names on every visit.
- Fallback languages now read one
ls-tree -r -lrather thanls-treeplus acat-file --batch-check. Removedeletes every derived row for a repository, not only itsreposrow.
Measurement
Load harness, concurrency 4, three repositories, five seconds:
| before | after | |
|---|---|---|
| overview | 473 req/s, p50 8 ms | ~740 req/s, p50 5 ms |
| home | 749 req/s, p50 5 ms | 737 req/s, p50 5 ms |
| activity | 762 req/s | 763 req/s |
| instance activity | 482 req/s | 816 req/s |
git-children sampled during the overview run: 0.
Tests
TestRefreshHeadStoresRecentCommitsAndLanguages(order, subjects, language bytes, and that a repeat at the same tip reports no change).TestRefreshContributorsStoresAuthors.TestRefreshTagsStoresTagsAndReleaseEvents(annotated vs lightweight, moved and deleted tags).TestReadmeCacheEvictsOldEntries(byte budget).- The existing overview/home tests now exercise the stored rows; the full
-racesuite, vet, gofmt, link check, andvole workflow run verifypass.
Notes
The post-receive hook now does one shortlog per pushed default-branch tip. A
push to another branch or to metadata does not pay it; a code push already pays
for pack processing and the index refresh, and the alternative is paying it on a
page read for every process.