Skip to content

feat: implement Phase 1 dynamic data decoupling for conformance tests#51

Merged
damaz91 merged 4 commits into
Universal-Commerce-Protocol:mainfrom
segiodongo:feat/dynamic-data-decoupling
Jul 17, 2026
Merged

feat: implement Phase 1 dynamic data decoupling for conformance tests#51
damaz91 merged 4 commits into
Universal-Commerce-Protocol:mainfrom
segiodongo:feat/dynamic-data-decoupling

Conversation

@segiodongo

@segiodongo segiodongo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Overview

This pull request introduces Phase 1 of dynamic data decoupling to the UCP conformance test suite. By enabling tests to dynamically parameterize test fixtures (SKU, pricing, discount codes, and destination addresses) from localized configuration profiles, merchants and external node implementers can run the conformance suite against their own product catalog and fulfillment rules without modifying core test assertions.

Key Changes

  1. Dynamic Fixture Context (integration_test_utils.py)

    • Introduced DynamicFixtureContext (and alias ConfiguredFixtureContext) to load and query test fixture configuration from conformance_input.json.
    • Added robust getter methods (get_test_sku(), get_test_price(), get_test_destination(), get_test_discount_code()) with graceful fallbacks to existing array lookups (items) and standard defaults.
    • Refactored create_checkout_payload() to dynamically populate item ID, price, and destination properties via DynamicFixtureContext.
  2. Fulfillment Flow Refactoring (fulfillment_test.py)

    • Updated test_fulfillment_flow to construct test PostalAddress instances using self.fixture_ctx.get_test_destination(), eliminating hardcoded indexing into static CSV address rows.
  3. Decoupled Test Fixtures (test_data/flower_shop/test_fixtures.json)

    • Decoupled the new test fixture and shipping location configuration blocks from the main conformance_input.json into a separate test_fixtures.json file.
    • Introduced a new --fixture_config flag (defaulting to the new test_fixtures.json) to allow parameterizing tests with custom fixtures, while maintaining backward compatibility by falling back to conformance_input.json for missing keys.

Verification

  • Verified cleanly against local Python reference server implementation (samples/rest/python/server/server.py).
  • Ran all 13 conformance test suites (ap2_test.py, binding_test.py, business_logic_test.py, card_credential_test.py, checkout_lifecycle_test.py, fulfillment_test.py, idempotency_test.py, invalid_input_test.py, order_test.py, protocol_test.py, simulation_url_security_test.py, validation_test.py, and webhook_test.py) locally, with 100% of tests passing.
  • Checked code style and formatting via ruff check and ruff format.

@damaz91 damaz91 added status:needs-triage Signal that the PR is ready for human triage status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Jul 10, 2026
@damaz91
damaz91 self-requested a review July 13, 2026 07:21
…rsal-Commerce-Protocol#56)

Update hardcoded version expectations in conformance tests to match
the updated server version 2026-04-08.
segiodongo and others added 2 commits July 16, 2026 09:39
- Replace FulfillmentDestinationCreateRequest instantiation with ShippingDestination to resolve TypeAliasType instantiation error.
- Decouple new test fixtures and shipping locations from conformance_input.json to a new test_fixtures.json file.
- Add --fixture_config flag to allow passing custom test fixtures.
- Update README with instructions for the new flag.
Update get_test_price() to treat both int and float major-unit inputs uniformly when converting to minor units.
@damaz91
damaz91 merged commit 657f32c into Universal-Commerce-Protocol:main Jul 17, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants