Fix #319: open-count badges #322
No reviewers
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub!322
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-319"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #319 — count badges next to the Issues/Pulls tabs (open counts, hidden at 0).
Server (ride the summary, zero new client requests): GET …/api gains always-present open_issues/open_pulls from the shared issues/index.json, read index-first behind the new Env.CollabCounts hook (the MirrorSummary shape — api never imports the feature, law 8; one exact-key GET serves both numerators; absent index → zeros with the byte-identical ETag). New issues.Service.OpenCounts (state+kind filtered, version passthrough), wired in buildCollab; store errors fail open. Rejected: two count endpoints (+2 requests/view) and windowed-list counting (capped at 100) — cost evidence in 07 §9.1.
ETag trap handled: ~c suffix (the #235/#240 precedent — version bumps on every card upsert, so ref-less close/reopen busts SWR). Class stays SWR, coordinated with (not duplicating) the #280 no-cache migration; residual ≤60s window closes client-side via stream invalidation of the shared summary entry.
Client: pure tabBadge helper (lib/tabs.js) + badge in the tab render (.tab-badge reuses tray count-pill language, aria-label, dark-safe); issue/pull frames gain repo: key; mutation-site reconcile extended (invalidateIssueLists + Pull reload, the #318 pattern).
Tests: table-driven wire/ETag-movement/hide-at-0 (summary319_test.go, counts_test.go incl. list-agreement, repo-tabs/collab-lib/issue-invalidation). Coverage: api 95.5%, issues 96.3% (OpenCounts + summary handler 100%). gofmt/vet clean; go test -race green (api, issues, cmd/walhub); 606/606 node --test; vite+esbuild build green.
Docs: 07 §9.1 + Decisions, 02 + 08 Decisions, SDK RepoInfo typedef, Apidocs row.