Skip to content

feat: run the compatibility suite through the pact_ffi C API - #16

Open
YOU54F wants to merge 5 commits into
masterfrom
feat/compat-suite-ffi
Open

YOU54F wants to merge 5 commits into
masterfrom
feat/compat-suite-ffi

Conversation

@YOU54F

@YOU54F YOU54F commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Adds compatibility-suite-ffi/, a runner for the vendored compatibility suite that drives pact through the libpact_ffi C API instead of the Rust crates. It runs the same copy of the suite as compatibility-suite/ (compatibility-suite/pact-compatibility-suite, at master), so this PR checks the FFI against the master suite. The V4 plugin features moved to the follow-up PR, feat/compat-suite-ffi-plugins.

How it works

  • build.rs generates runtime-loaded bindings from pact.h with bindgen. libpact_ffi is loaded with libloading, so one build of the runner can test any library.
  • The header and library default to what .github/scripts/ffi-examples.sh installs (rust/pact_ffi/build/install). PACT_FFI_HEADER and PACT_FFI_LIB override them.
  • There are five cucumber test binaries: consumer, provider, matching, generators and message. Each scenario's FFI calls are written to target/ffi-trace.
  • CI adds a Run FFI compatibility suite step to the ffi job, after the C examples, on Linux, macOS and Windows.

Local result (macOS, released libpact_ffi)

Test Scenarios
consumer 44/44
provider 53/53
matching 45/45 (plus 1 known failure, skipped)
generators 23/23
message 23/23

Known failure (skipped)

V4 matching_rules.feature, "Supports a not empty matcher with binary data (negative case)". The mock server's extract_body turns a 0-byte body into OptionalBody::Empty, and the body matcher skips an empty actual body, so the expected Expected [] (0 bytes) to not be empty mismatch never appears. It's listed in KNOWN_FAILURES in tests/matching.rs.

Not yet verified

The runner hasn't been run on Linux or Windows; this PR's CI is the first time.

🤖 Generated with Claude Code

YOU54F and others added 4 commits October 29, 2026 14:15
Adds compatibility-suite-ffi, a cucumber runner that drives the vendored
compatibility suite through libpact_ffi instead of the Rust crates. Bindings
are generated from pact.h and the library is loaded at run time, defaulting
to the install from .github/scripts/ffi-examples.sh. The ffi CI job runs it
on Linux, macOS and Windows after the C examples.

One V4 matching scenario is skipped as a known failure: the mock server reads
a 0-byte body as no body, so the notEmpty rule never sees it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roxmltree normalises line endings to LF, so skipping the CRLF conversion on
Windows sent multipart bodies with bare LF, which fail to parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds pactffi_using_plugin, pactffi_interaction_contents, pactffi_cleanup_plugins and
pactffi_get_error_message wrappers, and a plugins test that reads the plugin features and
fixtures from the suite checkout in PACT_COMPAT_SUITE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…teps

All 48 plugin scenarios pass against pact_ffi 0.5.4 with the matt, csv,
avro and protobuf plugins. gRPC is driven with h2 directly and matt TCP
with plain sockets; provider transport pacts get their transport added to
the written file, as the FFI has no call to set it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plugin lifecycle, HTTP, message, synchronous message and transport
steps (66bf8f9, 1b9b60c) move to feat/compat-suite-ffi-plugins, so this
PR covers only running the existing suite through the C API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant