Invalidate every ref's lock snapshot when a relayed lock changes - #60
Merged
Merged
Conversation
A lock listing is cached under the ?refspec= it was fetched with, but a create or unlock carries its ref in the JSON body, so LockRouteHandler invalidated the null-ref key and left the refspec-scoped listing stale for up to ListTtl: a new lock missing, a released lock still shown. ILockSnapshotStore.Invalidate now takes the upstream and repository and drops every snapshot for that repository whatever its ref. Both the relayed create/unlock and the batch fan-out use it, which also covers a client that lists under one ref and locks under another. The only cost is a refetch. Fixes #46 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wsoxnwaqMuAzvkm2xnzYh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wsoxnwaqMuAzvkm2xnzYh
|
This was referenced Sep 28, 2026
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #46
What was wrong
A lock listing is cached under the
?refspec=it was fetched with. A create (POST /locks) or unlock (POST /locks/:id/unlock) carries its ref in the JSON body instead. After a create or unlock,LockRouteHandler.InvalidateIfChangedbuilt the key to clear from the query string, so it cleared the null-ref entry. The listing cached under the refspec stayed stale for up toListTtl: a new lock was missing from it, and a released lock still showed as held.Change
I took the simpler of the two fixes suggested in the issue, as the triage comment recommends:
ILockSnapshotStore.Invalidate(string upstream, string repositoryPath)drops every snapshot for that repository, whatever ref it was cached under.LockRouteHandlercalls it.LockFanOutcalls it as well. That covers a client that lists under one ref and locks under another.Test
LockListCachingTests.ChangingALock_InvalidatesASnapshotListedUnderARefspeccovers a create case and an unlock case. Each lists with?refspec=refs/heads/main, changes a lock with that ref in the body, then lists again and checks that the change shows up.GitLfsCache/changes and running the test.🤖 Generated with Claude Code
https://claude.ai/code/session_016wsoxnwaqMuAzvkm2xnzYh
Generated by Claude Code