Skip to content

fix(prewarm): skip suffix fetch for fully resident sources - #831

Open
orut34iop wants to merge 1 commit into
superuser404notfound:mainfrom
orut34iop:codex/fix-prewarm-complete-source-prefetch
Open

orut34iop wants to merge 1 commit into
superuser404notfound:mainfrom
orut34iop:codex/fix-prewarm-complete-source-prefetch

Conversation

@orut34iop

Copy link
Copy Markdown
Contributor

A fully prewarmed file still starts a speculative suffix request on open: adoption installs the whole head, but the warm.tail == nil check treats the missing separate tail span as missing bytes. A 40 KiB source is fetched again by Range: bytes=-65536 even though its entire content is resident. The existing immediate request-count assertion can pass before that asynchronous request reaches the origin; this caused the all-traits failure observed on #823.

Skip tail prefetch only when the adopted head covers its declared content length. Partial warms, cold opens, header identity checks, redirect handling and memory-pressure eviction retain their existing paths. No public API or dependency change.

Strengthen the full-warm test with a bounded observation of absence, covering files smaller and larger than the suffix budget. Add a positive witness that partial warming still requests the missing suffix. The existing redirect/header-mismatch coverage runs alongside them.

Upstream context: #551, #554 and #584 already provide prewarm and resolved-target adoption; this fills the complete-head boundary they leave open. The affected production and test files are identical on main 151322d1b843b4414a0fcffa9ed44e8b3a9d087e and #823. This independent fix does not alter #823's audio coverage scope.

Validation on Apple Silicon Mac17,3, macOS 26.7.1 / Swift 6.4:

  • Before the fix, the strengthened witness fails with two requests instead of one, and the second raw Range header is bytes=-65536.
  • 56 prewarm/redirect tests in 9 suites pass under the strict cooperative pool, including both complete-head sizes and the partial-warm positive case.
  • Full serial default-traits run: 795 XCTest tests passed (1 existing skip); 4,615 Swift Testing tests ran with three assertions failing in the existing SoftwarePacketMemoryFIFOTests.evictPurgedHistory test (lines 99/102/103). Its consumed-history residency assumption is exactly the issue addressed by open test(cache): respect kernel purges in history eviction checks #819. This PR changes neither that test nor the memory FIFO; the isolated 11-test memory FIFO suite subsequently passed without changes. The full-run failure is retained and is not reported as a full-suite pass.
  • Documentation links and git diff --check pass. Host executables are signed and verified with a valid Apple Development identity; linker ad-hoc signing is disabled.

Other platforms and all-traits coverage are left to CI. No new device playback acceptance is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant