Skip to content

fix(verifier): do not publish verification results when interactions were filtered out - #611

Open
YOU54F wants to merge 1 commit into
masterfrom
feat/skip-publish-when-filtered
Open

YOU54F wants to merge 1 commit into
masterfrom
feat/skip-publish-when-filtered

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 25, 2026

Copy link
Copy Markdown
Member

Problem

verify_provider_async publishes results for every pact fetched whenever publish options are set. It does not check whether a filter (FilterInfo, PACT_DESCRIPTION, PACT_PROVIDER_STATE) meant only some of a pact's interactions were verified. The broker records each of those results as a verification of the whole pact, so:

  • A pact where no interactions matched the filter is published as success=true, because "all results passed" is vacuously true for an empty set.
  • With one filtered verifier per test, which is a common setup in pact-net and other FFI wrappers, a later passing filtered run overrides an earlier failing one for the same provider version. A provider version with a known contract break then becomes deployable.

This was handled in pact-ruby by pact-foundation/pact-ruby@0c56752. That behaviour was not carried over to the Rust core.

Reported via https://community.smartbear.com/t/http-error-429-too-many-requests-to-pactflow/893. The request volume from that setup is what triggered the 429s, and it also produced misleading results.

Change

Results for a pact are now published only when every interaction in it was verified, which matches pact-ruby. Otherwise the verifier logs this warning and skips publishing for that pact, including tags and branch:

WARNING: Cannot publish verification for <consumer> as not all interactions have been verified (x of y were verified). Re-run the verification without the filter parameters or environment variables to publish the verification.

This also stops a pact that failed verification internally (no results at all) from being published as successful.

Tests

  • Unit tests for all_interactions_verified.
  • An integration test with a mock broker and two pacts. A filter matches only pact-one, so pact-one's results are published and nothing is published for pact-two. With the guard disabled, the test fails.
  • An end-to-end check through pact-net (pact-net#569 with a libpact_ffi built from this branch). Filtered per-test runs no longer publish partial results, and the failing provider version stays non-deployable. Unfiltered runs are unchanged.

🤖 Generated with Claude Code

…were filtered out

Results were published for every pact fetched whenever publish options
were set, even if a filter (FilterInfo / PACT_DESCRIPTION /
PACT_PROVIDER_STATE) meant only some, or none, of a pact's interactions
were verified. The broker records these as a verification of the whole
pact, so a pact where nothing ran was published as successful, and a
later passing filtered run could override an earlier failure for the
same provider version, making it deployable.

Results are now only published for a pact when every interaction in it
was verified, matching pact-ruby (0c56752). Otherwise a warning is
logged and nothing is published for that pact, including tags and
branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
YOU54F added a commit to YOU54F/pact-net that referenced this pull request Nov 25, 2026
Reproduces the setup from the community thread "HTTP error 429 Too Many
Requests to PactFlow": one filtered PactVerifier per xUnit fact, each
fetching all pacts from the broker and publishing results.

Shows the broker request volume and the misleading verification results
this produces (including a masked failure passing can-i-deploy), next to
the recommended single unfiltered verifier with a provider-state URL.

Refs pact-foundation/pact-ruby#143, pact-foundation/pact-reference#611

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

This branch has not been deployed

No deployments
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