Repository navigation
fix(cache): coordinate a compressed request mid-chunking, not 404 - #1376
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Warning Review limit reached
More reviews will be available in 23 minutes. 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 (7)
📝 WalkthroughWalkthroughThis PR fixes a CDC (Change Data Capture) failure where cross-pod replicas incorrectly short-circuit compressed NAR requests to chunk-based serving during active chunking, resulting in HTTP 404 responses. The fix adds a routing guard in ChangesCDC GetNar Chunking-Window Fix
🎯 2 (Simple) | ⏱️ ~12 minutes Possibly Related PRs
Suggested Labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 addresses an issue where cross-pod readers of an actively-chunking NAR with a compressed request receive an HTTP 404 instead of entering download coordination. To resolve this, a check is added in GetNar to prevent short-circuiting to chunk-based serving when the NAR is not yet finished and the request is compressed, forcing it to fall through to coordination and serve from staging. The review feedback points out a performance optimization in this new check: calling c.hasFinishedNar performs a redundant and potentially expensive storage stat check because hasNarInStore is already computed in the local scope. The reviewer suggests checking !hasNarInStore first and querying c.HasNarInChunks directly to avoid this overhead.
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.
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 `@openspec/changes/archive/2026-06-08-fix-cdc-getnar-chunk-route/design.md`:
- Around line 5-12: The fenced code block containing the Go snippet (lines
referencing hasNar, c.isServable(ctx, narURL), c.HasNarInChunks(ctx, narURL),
serveNarFromStorageViaPipe) lacks a language tag and triggers markdownlint
MD040; fix it by adding the "go" language identifier to the opening fence
(```go) so the block is treated as Go code and linting passes.
🪄 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: f11b2b89-2e97-4303-a508-a1ad670b5eaa
📒 Files selected for processing (7)
openspec/changes/archive/2026-06-08-fix-cdc-getnar-chunk-route/.openspec.yamlopenspec/changes/archive/2026-06-08-fix-cdc-getnar-chunk-route/design.mdopenspec/changes/archive/2026-06-08-fix-cdc-getnar-chunk-route/proposal.mdopenspec/changes/archive/2026-06-08-fix-cdc-getnar-chunk-route/specs/inflight-nar-staging/spec.mdopenspec/changes/archive/2026-06-08-fix-cdc-getnar-chunk-route/tasks.mdopenspec/specs/inflight-nar-staging/spec.mdpkg/cache/cache.go
6903097 to
df1060c
Compare
#1376) The compressed-request gate called hasFinishedNar, repeating the HasNarInStore stat and nar_file lookup already done by the servability check at the top of GetNar. Call narServability once to get both `servable` (hasNar) and `finished`, and reuse `finished` in the gate. Also tag the design-doc code fence with a language for markdownlint. Resolves threads PRRT_kwDONV6tZs6H_Ve-, _XSL.
52df659 to
5a879d7
Compare
df1060c to
c16367d
Compare
#1376) The compressed-request gate called hasFinishedNar, repeating the HasNarInStore stat and nar_file lookup already done by the servability check at the top of GetNar. Call narServability once to get both `servable` (hasNar) and `finished`, and reuse `finished` in the gate. Also tag the design-doc code fence with a language for markdownlint. Resolves threads PRRT_kwDONV6tZs6H_Ve-, _XSL.
5a879d7 to
5047344
Compare
c16367d to
32f3f06
Compare
#1376) The compressed-request gate called hasFinishedNar, repeating the HasNarInStore stat and nar_file lookup already done by the servability check at the top of GetNar. Call narServability once to get both `servable` (hasNar) and `finished`, and reuse `finished` in the gate. Also tag the design-doc code fence with a language for markdownlint. Resolves threads PRRT_kwDONV6tZs6H_Ve-, _XSL.
5047344 to
c1ae107
Compare
## Summary - Under eager CDC, a non-holder replica 404s a compressed NAR request: the download-coordination poll loop early-returned a "served-by-peer" state for an *actively-chunking* NAR because `isServable` conflates "finished" with "actively chunking", routing to chunk serving (which can't produce a compressed variant from decompressed chunks). - Split a finished-only predicate `hasFinishedNar` (whole-file-in-store OR `total_chunks>0`) out of `isServable`, threaded as `hasFinishedAsset` through `coordinateDownload` + `pollForDownloadOrTakeOver`, and restructured the per-tick decision into four states (dead-holder→takeover[D5] / finished→serve / chunking+staging→staging / chunking+no-staging→progressive). > **Status:** a correct, regression-free **prerequisite** toward closing the chunking-window cross-pod 404 (#1289). It does NOT fully close that 404 on its own — see the stack head (#1376) for the remaining root cause (a CDC lock-lifecycle design mismatch). ## Test plan - [x] `task fmt` / `task lint` / `task test` (race) pass — no regression to progressive-chunk/takeover paths - [x] New `hasFinishedNar` unit test --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
…nking Under eager CDC, a non-holder replica 404s a compressed (.nar.xz) request while the holder chunks: GetNar's isServable check is true for the holder's cross-pod-visible actively-chunking nar_file row, so it short-circuits to serveNarFromStorageViaPipe -> serveFromChunks, which cannot produce a compressed variant from decompressed chunks and returns "only available as chunks" (404). Log evidence: the loser had zero download-coordination lines -- it never reached prePullNar, so it never recorded an in-flight staging request. Gate the GetNar short-circuit: when the NAR is servable only because it is actively chunking (isServable && !hasFinishedNar) and the request is compressed, treat it as not-servable-here so it falls through to prePullNar -> coordination, where a cross-pod waiter records a staging request and (once parts exist) serves from in-flight staging, transcoding to the requested compression. The uncompressed progressive-chunk path and finished NARs are unaffected. Reuses hasFinishedNar from the prior change. Verified by the contention e2e: with this gate the loser now REACHES coordination (2 lock-acquisition lines, vs 0 before) and records a staging request -- which also activates the prior coordination-loop fix. Full -race suite green; no regression to uncompressed progressive serving. This is the second of three layers. The chunking-window e2e is still red because the CDC holder produces no staging parts despite the now-recorded request -- a separate downstream producer defect, now investigable and escalated to its own change. Co-Authored-By: Claude Opus 4.8 <[email protected]>
#1376) The compressed-request gate called hasFinishedNar, repeating the HasNarInStore stat and nar_file lookup already done by the servability check at the top of GetNar. Call narServability once to get both `servable` (hasNar) and `finished`, and reuse `finished` in the gate. Also tag the design-doc code fence with a language for markdownlint. Resolves threads PRRT_kwDONV6tZs6H_Ve-, _XSL.
c1ae107 to
3b3e9e5
Compare
Summary
GetNarshort-circuited to chunk-based serving for an actively-chunking NAR (viaisServable), 404-ing a compressed (.nar.xz) request and skipping download coordination entirely so the cross-pod waiter never recorded a staging request.isServable && !hasFinishedNar) with a compressed request now falls through toprePullNar→ coordination. Uncompressed progressive serving and finished NARs are unaffected.Test plan
task fmt/task lint/task test(race) pass — no regression