Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.

Bring Swift to parity#5

Merged
fasterthanlime merged 6 commits into
mainfrom
swift-parity
Jan 11, 2026
Merged

Bring Swift to parity#5
fasterthanlime merged 6 commits into
mainfrom
swift-parity

Conversation

@fasterthanlime

Copy link
Copy Markdown
Contributor

Key findings:

  • Swift codegen already works (16/17 spec tests pass)
  • Fixed enum variant naming to use lowerCamelCase
  • Fixed preregisterChannels to be static method
  • Fixed spec error codes (channeling.unknown, etc.)
  • Only streaming tests fail (Tx/Driver ordering issue)

Archived obsolete phases 002-012 since codegen works. Revised plan: only 3 phases remain (~5-9 hours total).

Key findings:
- Swift codegen already works (16/17 spec tests pass)
- Fixed enum variant naming to use lowerCamelCase
- Fixed preregisterChannels to be static method
- Fixed spec error codes (channeling.unknown, etc.)
- Only streaming tests fail (Tx/Driver ordering issue)

Archived obsolete phases 002-012 since codegen works.
Revised plan: only 3 phases remain (~5-9 hours total).
decodeU16, decodeI16, and decodeU32 were using fixed-width byte reads
instead of varint encoding as required by Postcard format.

This caused 'truncated' errors when parsing request payloads,
making streaming tests fail with immediate error responses.

All 17 spec tests now pass (100%).
All 39 Swift runtime tests still pass.
Added r[impl ...] annotations to Swift runtime files:
- COBS.swift: transport framing rules
- Channel.swift: channeling rules, added deliverReset/deliverCredit
- Driver.swift: message handling, hello, goodbye, lifecycle rules
- Wire.swift: message types, metadata rules
- Postcard.swift: encoding rules
- RoamRuntime.swift: error handling rules

Swift now has 84% impl coverage (73/87 rules), exceeding Rust's 80%.

Remaining 14 uncovered rules are for unimplemented features:
- Flow control with credit (byte accounting, credit consume/overrun)
- Advanced channel lifecycle (speculative, immediate-data)
@fasterthanlime fasterthanlime marked this pull request as ready for review January 11, 2026 13:46
swift-nio 2.87.0+ requires Swift 6.0, but CI runs Swift 5.10.
Pin to .upToNextMinor(from: "2.86.0") to use 2.86.2.
- Update CI to use depot-macos-15 (Swift 6)
- Update Package.swift to swift-tools-version: 6.0
- Use swift-nio 2.92.0+ (requires Swift 6)
- Fix Binding.swift: use Mirror for optional unwrapping
- Fix Driver.swift: capture continuation as let for Sendable
- Fix Transport.swift: capture continuation as let for Sendable

One warning remains: ByteToMessageHandler Sendable conformance is
explicitly unavailable in SwiftNIO - this is benign.
The subject-swift.sh script expects .build/release/subject-swift
@fasterthanlime fasterthanlime merged commit a2f5e66 into main Jan 11, 2026
8 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant