Repo delete leaves userspace references (stars/watches/notifications/invites) #63
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 project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#63
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Follow-up from the backend audit on issue #59 (origin/main @
940ca8c).Evidence: Registry.Delete (internal/wal/registry.go:271-318) sweeps only the repos/// prefix. These families live outside it and are never cleaned: users/
/starred|watching//.json (internal/social/social.go:148-161; internal/notify/notify.go:296-298), users/
/notifications/.json + index.json (internal/notify/notify.go:283-296), users/
/invitations/index.json (internal/identity/identity.go:153-155).
Impact: (1) Starred() lists with no repo-existence check (internal/social/service.go:187-217), so deleted repos linger in starred lists and dead notifications/invites accumulate. (2) On delete+recreate, the stale star record makes Star() take the early-return path (internal/social/service.go:32-36, no counter bump) while fresh meta/social.json starts at 0: user shows starred with desynced counters until an unstar/restar reconverges.
Suggested fix: lazy-existence filtering on the read paths (Starred/tray/inbox skip repos whose manifest is absent), or a delete-time tombstone the readers honor. orgs/* must keep surviving (shared by design).
Fix ready for review: PR #66 (branch fix/issue-63) — #66
Design (a)+(c): miss-tolerant reads everywhere (Starred/tray/inbox skip dead repos; Counts 404s; viewer/watch flags hide), counter resync on recreate (already-starred path repairs absent/zeroed counters with one +1), notifications for dead repos dropped by retention (window + bounded overflow sweep, unread_count reconciled). Writes fail closed (star/watch/invite-create 404, accept 409, unstar/unwatch clean without resurrecting social.json). Verified: gofmt/vet clean, -race green, cover 99.3/97.1/97.4%, Decisions entries in 07/06/01, E8 budgets updated. P6/auth untouched; deletion stays admin-only.
Review of PR #66 (
79db5c4, fix/issue-63) — verified in scratch worktree, main worktree untouched. No changes pushed (no blocking problems found).Checks (all PASS):
Tests (scratch worktree /tmp/pr66 @
79db5c4): go test -race ./internal/social/... ./internal/notify/... ./internal/identity/... — all ok. Coverage: social 99.3%, notify 97.1%, identity 97.4% (gate >=95%). gofmt -l clean, go vet clean. Scratch worktree removed.MERGE RECOMMENDATION: ready to merge.
Fixed by PR #66 (review clean; coverage 99.3/97.1/97.4), merged. Closing.