Skip to content

THRIFT-5655: Fix Swift library build on Swift 6.x and re-enable Swift CI#3586

Closed
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:THRIFT-5655
Closed

THRIFT-5655: Fix Swift library build on Swift 6.x and re-enable Swift CI#3586
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:THRIFT-5655

Conversation

@Jens-G
Copy link
Copy Markdown
Member

@Jens-G Jens-G commented Jun 6, 2026

THRIFT-5655: Fix Swift library build on Swift 6.x and re-enable Swift CI

The Swift cross-test CI (lib-swift) was disabled in May 2025 (THRIFT-5864) when the ubuntu-24.04 runner's bundled Swift toolchain moved to 6.x and the library stopped compiling.

Root cause

TFileTransport declared fileHandle as an optional UnsafeMutablePointer<FILE>? although it is always non-nil after init. Swift 6's Glibc/Darwin overlays annotate fclose/fread/fwrite as taking a non-optional FILE*, so the three call sites failed to compile. (The CFSocketError symbol named in the original ticket is not an issue on Swift 6.1.3.)

Changes

  • TFileTransport: make fileHandle a non-optional let — fixes all three call sites at the root, with no platform conditional (correct on both Darwin and Linux).
  • CI: re-enable the lib-swift job and add swift back to the cross-test matrix (server + client).
  • LANGUAGES.md: Swift tested level 5.75.7 / 6.1.

Testing

Verified in Docker (Linux):

  • lib/swift builds clean on Swift 5.7 (37/37) and Swift 6.1.3 (39/39).
  • Swift cross-test (precross) builds TestServer + TestClient on 6.1.3.
  • ThriftTest round-trips pass for binary/compact × buffered/framed × ip/domain (client_exit=0).

Real Apple-platform (macOS/Xcode) coverage is not part of this PR; the fix is platform-agnostic by construction.

🤖 Generated with Claude Code

Client: swift

TFileTransport declared fileHandle as an optional UnsafeMutablePointer<FILE>
even though it is always non-nil after init. Swift 6's Glibc/Darwin overlays
annotate fclose/fread/fwrite as taking a non-optional FILE*, which broke the
build on the Swift 6.x toolchain shipped by the ubuntu-24.04 CI runner.

- Make TFileTransport.fileHandle a non-optional let
  (builds clean on Swift 5.7 and 6.1.3)
- Re-enable the lib-swift job and add swift back to the cross-test matrix
- LANGUAGES.md: Swift tested level 5.7 -> 5.7/6.1

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Jens-G Jens-G requested review from fishy and jimexist as code owners June 6, 2026 20:20
@mergeable mergeable Bot added swift github_actions Pull requests that update GitHub Actions code labels Jun 6, 2026
@Jens-G Jens-G closed this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code swift

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant