Fixes a race in retire_obsolete_callgraph_refresh_waiters where a concurrent retire's snapshot of a batch kept the waiter's query catch-up guard alive after the retire that removed the waiter had returned. The snapshot now copies only ticket and refresh states instead of whole batch clones, so keepalive guards are released as soon as the queue drops the batch rather than when the snapshot finishes.
Adds a test seam that pauses a retire between its snapshot and removal pass, plus a deterministic test reproducing the guard retention.
Confidence Score: 5/5
The PR appears safe to merge.
Summary
The PR stops retirement snapshots from keeping query guards alive after an obsolete waiter is removed.
Retire snapshots no longer keep obsolete refresh guards alive.
No actionable issues found. Tests were not run.
Diagram
sequenceDiagram
participant A as First retire
participant Q as Waiting queue
participant B as Second retire
A->>Q: Copy identity and replay inputs
Note over A: Snapshot owns no keepalive
B->>Q: Remove obsolete waiter
Q->>Q: Drop batch and release keepalive
A->>Q: Recheck identity before removal