feat: adopt pact_ffi 0.5.4 based PactSwiftMockServer - #134
Conversation
Prepares PactSwift for the pact_ffi 0.5.4 based PactSwiftMockServer. Source changes only; the Package.swift repoint waits on a 0.5.4 XCFramework release, so the branch does not build until that dependency is updated. Provider verifier: - Replace the newline-delimited `args` string with a typed mapping from ProviderVerifier.Options to PactSwiftMockServer.VerificationOptions. - Update the ProviderVerifier call site and the MockVerifier test double for the new verifyProvider(options: VerificationOptions) signature. - Known gaps (documented in code): multiple filter states/descriptions collapse to the first (FFI takes one each), and logLevel is not mapped (no per-verifier FFI setter). WIP provider version is not forwarded outside publishing. Consumer-side API drift (fork -> surpher): - BodyBuilder.body contentType is now non-optional. - Drop the redundant HeaderBuilder.header(_:value:) extension; surpher provides it. - Pact.version is now the instance property ffi_version. Rewrite ProviderVerifier+OptionsTests to assert the mapped VerificationOptions. Verified locally against a macOS xcframework built from real pact_ffi 0.5.4: 201/203 tests pass. The 2 failures are pact_ffi 0.5.4 engine behaviour changes, not this change: multi-value request headers, and an empty response body no longer emitting a Content-Type header.
surpher
left a comment
There was a problem hiding this comment.
Love your work! Thank you.
I'll get the new version of PactSwiftMockServer and XCFramework out in the next couple of days. And we go from there. 🫡
|
Released @pepejeria carry on 🫡 |
Repoint the mock server dependency off the ittybittyapps fork onto the published surpher/PactSwiftMockServerXCFramework v1.2.0 (pact_ffi 0.5.4), in both Package.swift and PactSwift.xcodeproj. - Drop tvOS: the v1.2.0 xcframework has no tvOS slice. - Note: v1.2.0 is arm64 only (no x86_64), so Intel Macs and Intel iOS simulators are not supported. Verified against the released v1.2.0 on macOS and iOS Simulator: 201/203 tests pass. The 2 failures are pact_ffi 0.5.4 behaviour changes, not this change (multi value request headers, and an empty response body no longer setting a Content-Type header).
PactSwiftMockServer v1.2.0 is arm64 only, so the x86_64 CI destination and the Intel macos-13 runner can no longer build it. Run CI on macos-14 (Apple Silicon) with a native macOS destination.
238aa71 to
facdc9e
Compare
- testGetEvents: an empty response body no longer sends a Content-Type header. - testRequestHeaderWithMultipleValues: a comma-joined multi-value request header no longer matches a pact defined with an array of values. Skipped (not deleted) with XCTSkipIf and documented, pending confirmation with PactSwiftMockServer on whether these are intended or regressions.
facdc9e to
99bf252
Compare
|
Thanks @surpher! I repointed PactSwiftMockServer to use the new version. Note though, that there were 3 issues:
|
|
@pepejeria love it, thank you! Supporting x86_64 was just in the way of setting up the libpact_ffi and tools were complaining something in the chain broke. It's been officially dropped by Apple so, time to move on. |
Updates PactSwift to use the new pact_ffi 0.5.4 based PactSwiftMockServer.
📝 Summary of Changes
VerificationOptionsAPI.Note: This PR does not change
Package.swift. It still points at the ittybittyapps fork, so this branch will not build until the dependency is repointed. That repoint needs a 0.5.4 XCFramework release to exist first.@surpher, could you release a 0.5.4 release of PactSwiftMockServer (the merged
chore/update-libpact_ffi-0.5.x)? That creates the 0.5.4 xcframework binary. Once it's published I'll updatePackage.swiftto point to it.Known mapping gaps (the new FFI is a bit less flexible than the old CLI string, all noted in code):
logLevelis not applied (the new verifier API has no per run log level).🧐🗒 Reviewer Notes
💁 Example
The public
ProviderVerifier.OptionsAPI is unchanged, so existing usage stays the same. The change is internal, the options are now mapped to the mock server's typedVerificationOptionsinstead of a CLI args string.🔨 How To Test
Not testable in CI until Package.swift is repointed. Verified locally by building a macOS xcframework from the 0.5.4 branch and pointing this branch at it: 201/203 pass. The 2 failures are pact_ffi 0.5.4 behaviour changes, not this PR.