Skip to content

feat: adopt pact_ffi 0.5.4 based PactSwiftMockServer#134

Open
pepejeria wants to merge 1 commit into
surpher:feat/v2.0.0from
pepejeria:feat/adopt-pactswiftmockserver-0.5.4
Open

feat: adopt pact_ffi 0.5.4 based PactSwiftMockServer#134
pepejeria wants to merge 1 commit into
surpher:feat/v2.0.0from
pepejeria:feat/adopt-pactswiftmockserver-0.5.4

Conversation

@pepejeria

@pepejeria pepejeria commented Jul 21, 2026

Copy link
Copy Markdown

Updates PactSwift to use the new pact_ffi 0.5.4 based PactSwiftMockServer.

📝 Summary of Changes

  • Map the provider verifier options to the new typed VerificationOptions API.
  • Small fixes for consumer side API changes in the new mock server.
  • Update tests.

⚠️ Items of Note

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 update Package.swift to point to it.

Known mapping gaps (the new FFI is a bit less flexible than the old CLI string, all noted in code):

  • Multiple filter states or descriptions now use only the first one.
  • logLevel is not applied (the new verifier API has no per run log level).
  • WIP provider version is not sent unless publishing.

🧐🗒 Reviewer Notes

💁 Example

The public ProviderVerifier.Options API is unchanged, so existing usage stays the same. The change is internal, the options are now mapped to the mock server's typed VerificationOptions instead 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.

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 surpher left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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. 🫡

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