Repository navigation
test(cache): cross-pod in-flight staging e2e - #1361
Conversation
|
This change is part of the following stack:
Change managed by git-spice. |
|
Warning Review limit reached
More reviews will be available in 5 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a new distributed concurrency test that validates NAR retrieval across multiple cache instances sharing a database and Redis-based locks during in-flight staging. The test uses a delayed upstream handler to force download overlap, performs concurrent GetNar calls, and asserts byte-exact results on every instance. ChangesIn-Flight Staging Cross-Pod Test
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new integration test, testInflightStagingCrossPodServe, to verify the cross-pod fast path with in-flight NAR staging enabled. Feedback on the changes points out that the newly created cache.Cache instances are never closed, which leads to background goroutine leaks during testing. It is recommended to register a cleanup function using t.Cleanup to properly close each cache instance.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
6c4ea0c to
09dc11e
Compare
a628e01 to
25ab29a
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/cache/cache_distributed_test.go`:
- Around line 196-204: The current test handler (registered via
ts.AddMaybeHandler and referenced by handlerID and narPath) only sleeps before
starting the response, which allows the full 256 KiB body to be sent instantly
once it wakes; change the handler to stream the response body slowly instead of
a single pre-response sleep — e.g., write the body in small chunks with a short
sleep/flush between chunks or use an io.Pipe and delayed writes so readers make
incremental progress; ensure Transfer-Encoding is chunked or omit Content-Length
so chunks are sent progressively, and/or update the assertions (the block around
the former Lines 315-342) to explicitly check that at least one waiter has read
some bytes before the holder finishes to validate the in-flight cross-pod
serving path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4e672dff-3218-4f8f-b3b8-5655577ed08e
📒 Files selected for processing (1)
pkg/cache/cache_distributed_test.go
09dc11e to
cf1d9bd
Compare
Address review feedback on PR #1361: - The upstream handler now streams the NAR body in 16 KiB chunks with a pause between each, instead of sleeping only before the response starts. A start-only delay never put bytes into the holder's temp file during the window, so the staging producer had nothing to publish and the cross-pod serve path was not actually exercised; trickling the body gives a real in-flight window where parts become available progressively and peers tail them (PRRT_kwDONV6tZs6HscSe). - Each cache instance is now closed via t.Cleanup so the retention-grace reclaim goroutines (5-minute grace) are interrupted via shutdownCh rather than leaking for the full grace (PRRT_kwDONV6tZs6Hr3GM). Validated with NCPS_ENABLE_REDIS_TESTS=1: the staging cross-pod subtest passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
25ab29a to
78c0fc1
Compare
b50c288 to
dabf4c4
Compare
Address review feedback on PR #1361: - The upstream handler now streams the NAR body in 16 KiB chunks with a pause between each, instead of sleeping only before the response starts. A start-only delay never put bytes into the holder's temp file during the window, so the staging producer had nothing to publish and the cross-pod serve path was not actually exercised; trickling the body gives a real in-flight window where parts become available progressively and peers tail them (PRRT_kwDONV6tZs6HscSe). - Each cache instance is now closed via t.Cleanup so the retention-grace reclaim goroutines (5-minute grace) are interrupted via shutdownCh rather than leaking for the full grace (PRRT_kwDONV6tZs6Hr3GM). Validated with NCPS_ENABLE_REDIS_TESTS=1: the staging cross-pod subtest passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
34ea258 to
f2b17f2
Compare
dabf4c4 to
4655157
Compare
Address review feedback on PR #1361: - The upstream handler now streams the NAR body in 16 KiB chunks with a pause between each, instead of sleeping only before the response starts. A start-only delay never put bytes into the holder's temp file during the window, so the staging producer had nothing to publish and the cross-pod serve path was not actually exercised; trickling the body gives a real in-flight window where parts become available progressively and peers tail them (PRRT_kwDONV6tZs6HscSe). - Each cache instance is now closed via t.Cleanup so the retention-grace reclaim goroutines (5-minute grace) are interrupted via shutdownCh rather than leaking for the full grace (PRRT_kwDONV6tZs6Hr3GM). Validated with NCPS_ENABLE_REDIS_TESTS=1: the staging cross-pod subtest passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
f2b17f2 to
5225aea
Compare
4655157 to
4108820
Compare
Address review feedback on PR #1361: - The upstream handler now streams the NAR body in 16 KiB chunks with a pause between each, instead of sleeping only before the response starts. A start-only delay never put bytes into the holder's temp file during the window, so the staging producer had nothing to publish and the cross-pod serve path was not actually exercised; trickling the body gives a real in-flight window where parts become available progressively and peers tail them (PRRT_kwDONV6tZs6HscSe). - Each cache instance is now closed via t.Cleanup so the retention-grace reclaim goroutines (5-minute grace) are interrupted via shutdownCh rather than leaking for the full grace (PRRT_kwDONV6tZs6Hr3GM). Validated with NCPS_ENABLE_REDIS_TESTS=1: the staging cross-pod subtest passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
5225aea to
bb728ce
Compare
4108820 to
779386f
Compare
Address review feedback on PR #1361: - The upstream handler now streams the NAR body in 16 KiB chunks with a pause between each, instead of sleeping only before the response starts. A start-only delay never put bytes into the holder's temp file during the window, so the staging producer had nothing to publish and the cross-pod serve path was not actually exercised; trickling the body gives a real in-flight window where parts become available progressively and peers tail them (PRRT_kwDONV6tZs6HscSe). - Each cache instance is now closed via t.Cleanup so the retention-grace reclaim goroutines (5-minute grace) are interrupted via shutdownCh rather than leaking for the full grace (PRRT_kwDONV6tZs6Hr3GM). Validated with NCPS_ENABLE_REDIS_TESTS=1: the staging cross-pod subtest passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
bb728ce to
0698e7f
Compare
End-to-end verification for in-flight NAR staging (group 13). Adds InflightStagingCrossPodServe to the distributed suite: with staging enabled (non-CDC, distributed Redis lock, shared store), numInstances replicas concurrently pull the same large NAR during its download and each must receive a complete, byte-correct NAR with no truncation. Verified against Redis (NCPS_ENABLE_REDIS_TESTS=1). Zero-overhead (feature disabled, and enabled-but-uncontended) is covered deterministically by the group-5 producer unit tests.
Address review feedback on PR #1361: - The upstream handler now streams the NAR body in 16 KiB chunks with a pause between each, instead of sleeping only before the response starts. A start-only delay never put bytes into the holder's temp file during the window, so the staging producer had nothing to publish and the cross-pod serve path was not actually exercised; trickling the body gives a real in-flight window where parts become available progressively and peers tail them (PRRT_kwDONV6tZs6HscSe). - Each cache instance is now closed via t.Cleanup so the retention-grace reclaim goroutines (5-minute grace) are interrupted via shutdownCh rather than leaking for the full grace (PRRT_kwDONV6tZs6Hr3GM). Validated with NCPS_ENABLE_REDIS_TESTS=1: the staging cross-pod subtest passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
0698e7f to
da1ab82
Compare
…race The in-flight staging producer is spawned via SafeGo capturing the ctx variable by closure, but pullNarIntoStore reassigns that same variable shortly after (ctx, span := tracer.Start(...)). The goroutine's read of ctx in stageInflightNar raced with the parent's write, which the cross-pod staging race test deterministically catches under -race. Snapshot ctx into a dedicated stagingCtx before spawning so the goroutine reads a stable value. The producer is a background op, so the pre-span ctx is the correct parent anyway. Co-Authored-By: Claude Opus 4.8 <[email protected]>
End-to-end verification for in-flight NAR staging (group 13). Adds
InflightStagingCrossPodServe to the distributed suite: with staging enabled
(non-CDC, distributed Redis lock, shared store), numInstances replicas
concurrently pull the same large NAR during its download and each must receive
a complete, byte-correct NAR with no truncation. Verified against Redis
(NCPS_ENABLE_REDIS_TESTS=1).
Zero-overhead (feature disabled, and enabled-but-uncontended) is covered
deterministically by the group-5 producer unit tests.