fix: ProviderStateGenerator expression shorthand support for query, header, and body (FFI)#532
Draft
Copilot wants to merge 4 commits into
Draft
fix: ProviderStateGenerator expression shorthand support for query, header, and body (FFI)#532Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…uery, header, and body (FFI)
When a JSON object contains an `expression` key (without `pact:matcher:type`), it is now
treated as a ProviderStateGenerator shorthand. The `value` field is extracted as the example
value, and a ProviderStateGenerator is configured with the expression.
This fixes the issue where `{"expression":"${var}","value":"100"}` was not working for
query parameters, headers, and bodies - only the path case worked before.
Agent-Logs-Url: https://github.com/pact-foundation/pact-reference/sessions/fb2a6dd6-ef83-46ac-af88-f8edd5445fc0
Co-authored-by: mefellows <53900+mefellows@users.noreply.github.com>
…ve redundant condition in bodies.rs Agent-Logs-Url: https://github.com/pact-foundation/pact-reference/sessions/fb2a6dd6-ef83-46ac-af88-f8edd5445fc0 Co-authored-by: mefellows <53900+mefellows@users.noreply.github.com>
…son.md; add warn log for missing value Agent-Logs-Url: https://github.com/pact-foundation/pact-reference/sessions/fb2a6dd6-ef83-46ac-af88-f8edd5445fc0 Co-authored-by: mefellows <53900+mefellows@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ProviderStateGenerator path matching for query strings
fix: ProviderStateGenerator expression shorthand support for query, header, and body (FFI)
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
{"expression":"${var}","value":"example"}shorthand format forProviderStateGeneratorwas silently broken for query parameters, headers, and bodies — only path worked. For bodies, the full JSON object was stored verbatim instead of extracting the example value; for query/headers, the example value was extracted correctly but no generator was configured.Changes
bodies.rs—process_object: Add branch for objects withexpressionbut nopact:matcher:type. CallsGenerator::from_map("ProviderState", ...), registers the generator, and returns thevaluefield as the example.handles.rs—from_integration_json_v2: Same treatment for non-body values. Extracted the repeatedif path_or_status { path.parent()... }pattern intoeffective_pathto eliminate three near-identical blocks.IntegrationJson.md: Documents both formats explicitly, clarifying the shorthand configures no matching rule.Usage
Both formats are now supported across all interaction parts:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
www.google-analytics.com/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.0cifm40e9n7lso8a96xtiaars.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.0jduurjg32c9hz1odmlkqnb90.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.0jgm4wupv2qnfqlwjtv192rms.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.0l2n31o5f0vv1wdfytfwzjtds.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.0mnh80qsyc2b854gc8nevx3ju.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.0wnhykf4hdsi6hxhjrm6qb9ni.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.11w7lisbnykqfms5f4lzo5y87.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.12jojkzxzbtqc8s07ifgtirth.1h2mas3.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783�� /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.11w7lisbnykqfms5f4lzo5y87.03lvett.rcgu.o /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.12jojkzxzbtqc8s07ifgtirth.03lvett.rcgu.o f/aw�� g/build/aws-lc-s/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/build/aws-lc-scc g/build/aws-lc-s/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/build/aws-lc-s-m64 g/build/aws-lc-s/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/build/aws-lc-s/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/rustchOhC69/symbols.o g/build/aws-lc-scc g/build/aws-lc-s-m64 g/build/aws-lc-s/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/rustc74RF/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.055a4tmiboq33ztlpitmr61mv.1h2mas3.rcgu.o g/build/aws-lc-s/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c.0693wwdgfq1vm2d2m56z2t0lp.1h2mas3.rcgu.o(dns block)/home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c /home/REDACTED/work/pact-reference/pact-reference/rust/target/debug/deps/pact_ffi-e783aee9d449c50c 0bzbvvm6dpkdu2ro9aatowjsk.1dqaq2c.rcgu.o 0cr6os003m3fbkqi1y3xftqcd.1dqaq2c.rcgu.o 0lgswwy2ino2dgjg01ddqfb8p.1dqaq2c.rcgu.o 0mbymqz4xzv9qpgpzgder4k20.1dqaq2c.rcgu.o Oa/symbols.o 1cf18b17b1d81.04qrp1n3mvjo6xv2vr86izxx0.0ht63s8.rcgu.o 1cf18b17b1d81.05byn37z5c935ymoq1jqhmq4i.0ht63s8.rcgu.o 1cf18b17b1d81.07j6xjnyzmn2m7kx3es45oxnu.0ht63s8.rcgu.o 1cf18b17b1d81.09nq0brzpccczm1jkhmaybugq.0ht63s8.rcgu.o 1cf18b17b1d81.0annzys4445gos8ngapgyvels.0ht63s8.rcgu.o 1cf18b17b1d81.0ccjg5kexagklgvy99spr06jr.0ht63s8.rcgu.o 1cf18b17b1d81.0j6xprtxe0p48l5spzwt9ddx7.0ht63s8.rcgu.o 1cf18b17b1d81.0lfgbzsshcvdrdq9j1yf3dny8.0ht63s8.rcgu.o 1cf18b17b1d81.0lusoyi8avqm2dganwy2296t4.0ht63s8.rcgu.o 1cf18b17b1d81.0o3gvmc5dy2j4xlv6lqetwgaf.0ht63s8.rcgu.o 1cf18b17b1d81.0stna28rz95vq4qiqv03op0ta.0ht63s8.rcgu.o 1cf18b17b1d81.0yeq1ia8h5gap6wnh0ihh8aot.0ht63s8.rcgu.o 1cf18b17b1d81.0ynf9xpc4r4sdxivkd0i0dk1m.0ht63s8.rcgu.o 1cf18b17b1d81.0z37cflm40kzqq5q8l3at0vaa.0ht63s8.rcgu.o(dns block)When a JSON object contains an
expressionkey (withoutpac-a /lib/jspawnhelper rust/target/debu/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/cargo rust/target/deburustc rust/target/debu-Z /lib/jspawnhelpeunstable-options(dns block)