Skip to content

Fix CI: ObjC imports, Swift concurrency, macOS platform#3

Merged
dustturtle merged 5 commits intomainfrom
copilot/fix-action-failures
Feb 3, 2026
Merged

Fix CI: ObjC imports, Swift concurrency, macOS platform#3
dustturtle merged 5 commits intomainfrom
copilot/fix-action-failures

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

CI failing on all jobs due to SPM import resolution, Swift strict concurrency violations, and missing macOS platform declaration.

ObjC header imports

SPM doesn't create framework directory structures. Changed to quoted imports:

// Before
#import <RealReachability2ObjC/RRPathMonitor.h>
// After
#import "RRPathMonitor.h"

Swift strict concurrency

ICMPPinger.swift captured mutable var isResumed in concurrent closures. Replaced with thread-safe wrapper:

final class ResumeState {
    private let lock = NSLock()
    private var _isResumed = false
    func tryResume() -> Bool {
        lock.lock()
        defer { lock.unlock() }
        guard !_isResumed else { return false }
        _isResumed = true
        return true
    }
}

Swift await in autoclosure

RealReachability.swift used await with ?? operator—right-hand side evaluates in autoclosure where await is disallowed. Refactored to explicit if-else.

macOS platform

Added .macOS(.v10_15) to Package.swift. CI runs on macOS; without this, availability errors for NWConnection, AsyncStream, etc.

Original prompt

查看最近运行失败的action,并尝试修复;修复后重新运行,如此循环直至运行通过


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 3, 2026 03:52
Co-authored-by: dustturtle <2305214+dustturtle@users.noreply.github.com>
Co-authored-by: dustturtle <2305214+dustturtle@users.noreply.github.com>
Co-authored-by: dustturtle <2305214+dustturtle@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recent action failures and retry Fix CI build failures: ObjC header imports and Swift await in autoclosure Feb 3, 2026
Copilot AI requested a review from dustturtle February 3, 2026 03:55
Co-authored-by: dustturtle <2305214+dustturtle@users.noreply.github.com>
Copilot AI changed the title Fix CI build failures: ObjC header imports and Swift await in autoclosure Fix CI: ObjC imports, Swift concurrency, macOS platform Feb 3, 2026
@dustturtle dustturtle marked this pull request as ready for review February 3, 2026 06:11
Copilot AI review requested due to automatic review settings February 3, 2026 06:11
@dustturtle dustturtle merged commit acacba9 into main Feb 3, 2026
8 of 10 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes CI failures related to SwiftPM ObjC header import resolution, Swift strict concurrency diagnostics, and missing macOS platform declaration.

Changes:

  • Switched Objective-C header imports (in tests and public headers) from framework-style <Module/Header.h> to quoted "Header.h" for SwiftPM builds.
  • Refactored RealReachability.check() to avoid await in an autoclosure (from ??) by using an explicit if/else.
  • Updated ICMPPinger to prevent multiple continuation.resume(...) calls via a locked resume-state helper; added .macOS(.v10_15) to Package.swift.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/RealReachability2ObjCTests/RRReachabilityTests.m Updates ObjC import style for SwiftPM header layout.
Tests/RealReachability2ObjCTests/RRReachabilityIntegrationTests.m Updates ObjC import style for SwiftPM header layout.
Sources/RealReachability2ObjC/include/RealReachability2ObjC.h Switches umbrella header to quoted imports for SwiftPM.
Sources/RealReachability2ObjC/include/RRReachability.h Switches dependent header import to quoted form for SwiftPM.
Sources/RealReachability2/RealReachability.swift Avoids await in an autoclosure by using explicit control flow.
Sources/RealReachability2/Prober/ICMPPinger.swift Introduces a lock-protected resume-state to satisfy strict concurrency and prevent double-resume.
Package.swift Declares macOS 10.15 platform support to match CI/build availability requirements.
.gitignore Ignores CodeQL detected source root file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +55 to +60
final class ResumeState {
private let lock = NSLock()
private var _isResumed = false

func tryResume() -> Bool {
lock.lock()
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResumeState is captured by DispatchWorkItem and NWConnection.stateUpdateHandler closures, which are @Sendable under Swift strict concurrency. As written, ResumeState is a non-Sendable class (contains NSLock), so this can still fail compilation with “capture of non-Sendable type in a @sendable closure”. Make ResumeState conform to Sendable (likely @unchecked Sendable given the internal locking), or replace it with a Sendable atomic/critical-state primitive.

Copilot uses AI. Check for mistakes.
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.

2 participants