Skip to content

fix(test): count concurrent fetches through a Sendable box - #979

Merged
bmc08gt merged 1 commit into
mainfrom
fix/upload-policy-test-race
Oct 5, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
fix/upload-policy-test-race

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

The "Cross-platform vector gate" job "App vectors (build)" fails at test build on main:

UploadPolicyTests.swift:105:23: error: passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure
UploadPolicyTests.swift:107:25: note: closure captures reference to mutable let 'fetches' which is accessible to code in the current task

coalescesConcurrentFetches captured a local Mutex(0) in the group.addTask closures. Mutex is ~Copyable, so the capture is by reference. The counter now lives in a private Sendable FetchCounter class in the test file; the test still makes five concurrent cache.policy calls and expects one fetch. Production code is untouched.

coalescesConcurrentFetches captured a local `Mutex` in `group.addTask`
closures. `Mutex` is ~Copyable, so the closures capture it by reference
and Swift 6 region-based isolation rejects the `sending` closure, which
broke the test build in the "App vectors (build)" job. Hold the counter
in a Sendable class instead.
@bmc08gt bmc08gt self-assigned this Oct 5, 2026
@bmc08gt
bmc08gt merged commit c713a9d into main Oct 5, 2026
2 of 3 checks passed
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