Fix #459: chain cache staleness #470
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!470
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-459"
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?
Child of #449 (audit F6). wal forkChain was a handle-lifetime cache, but the adopted-provenance backfill CAS-moves Root under a live handle and the chain is built from Parent+Root — a stale cache skipped the Root short-circuit past a dead middle.
Fix (not the documented-window fallback): the handle caches its own Parent+Root+Version with the chain and revalidates on every use with one exact-key GET of its own fork.json (failure path only — forkChain runs after an own-prefix NotFound — so law-6 hot-path budgets are untouched); the Root backfill now bumps Version like every other fork.json CAS (already-correct docs untouched, no churn). forkMu stays a leaf lock (snapshot outside, GET+compare outside, store under lock). ForkDoc comment updated; decision appended to docs/features/03_pull_requests.md.
Tests: TestForkChainRootBackfillInvalidates (fails on old code with stale [f/c], passes on fix); go test ./internal/wal/... + ./internal/pulls/... -race green; cover wal 95.1%, pulls 96.1% (≥95 gate holds); gofmt/vet clean. No new deps.