Hive
fix(server): build the xctest runner-error regex inline instead of a shared static
GitHub issue · Closed
What changed
XCResultParser.isRunnerError keeps matching the synthetic xctest (<pid>) encountered an error name with the same /xctest \(\d+\) encountered an error/ regex, but builds it inline instead of caching it in a private static let.
Why
Regex<Substring> isn’t Sendable, so the shared static let xctestRunnerErrorRegex (added by #11606) tripped Swift 6 concurrency checking:
static property 'xctestRunnerErrorRegex' is not concurrency-safe because
non-'Sendable' type 'Regex<Substring>' may have shared mutable state
That failed the SwiftPM Build check on main (the package compiles in Swift 6 language mode). The problem was the shared static, not the regex itself — nonisolated(unsafe) would only silence the checker rather than remove the shared mutable global.
Building the regex inline in isRunnerError sidesteps the shared state entirely: no unsafe, nothing to prove Sendable, and the declarative pattern stays. isRunnerError runs per “Test Case” node, but the per-call cost is negligible next to xcresult parsing (xcresulttool subprocess + JSON decoding), which dominates.
Validation
- Compiles clean under
-swift-version 6. - Behavior is unchanged — it’s the same regex and
wholeMatch, just not cached.
Once merged this restores the SwiftPM Build check on main.
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
No GitHub comments yet.