Skip to content

CC-40714 Accept the unprefixed availableQuantity validation detail - #421

Merged
matweew merged 1 commit into
masterfrom
fix/cc-40714-configurable-product-available-quantity-flaky
Sep 29, 2026
Merged

matweew merged 1 commit into
masterfrom
fix/cc-40714-configurable-product-available-quantity-flaky

Conversation

@matweew

@matweew matweew commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fix results: spryker-shop/b2b-demo-marketplace#1411

Summary

  • shopping-list-items-configurable-product.cy.ts flakes on b2b-demo-marketplace: should not add a configurable product to the shopping list with empty/string availableQuantity fails with AssertionError: expected response error details ["availableQuantity => This value should be of type numeric."] to contain every detail of one of [...].
  • Root cause: on shops whose spryker/api-platform validates productConfigurationInstance as its own top-level constraint tree (rather than as a field nested under the request's attributes), Symfony's Collection validator raises the availableQuantity violation with a property path relative to that tree. TranslatingConstraintViolationListNormalizer::extractFieldName() keeps only the last /-delimited JSON-pointer segment, so there's no productConfigurationInstance segment left to carry — producing a flat availableQuantity => ... detail instead of either of the two shapes this test already tolerated (the untyped leaf vs. the typed whole-object failure).
  • Adds that third, already-observed shape to acceptedDetails for both the empty and string availableQuantity cases, following the same tolerant pattern the test already uses for the untyped/typed split, and documents the mechanism in a comment.

Confirmed on b2b-demo-marketplace CI (PHP8.5 MariaDB and PHP8.3 Postgres runs both hit the same flat detail): https://github.com/spryker-shop/b2b-demo-marketplace/actions/runs/36433949382 and https://github.com/spryker-shop/b2b-demo-marketplace/actions/runs/36435049549

Jira: https://spryker.atlassian.net/browse/CC-40714

Test plan

  • npx tsc --noEmit passes (verified locally)
  • npx prettier --check passes (verified locally)
  • CI green on a demoshop that currently reproduces the flat detail (b2b-mp)

Some demoshops' spryker/api-platform validates productConfigurationInstance
as its own top-level constraint tree rather than as a field nested under
the request's attributes. Symfony's Collection validator then raises the
availableQuantity violation with a property path relative to that tree,
so TranslatingConstraintViolationListNormalizer::extractFieldName() (which
keeps only the last `/`-delimited pointer segment) has no
productConfigurationInstance segment left to carry, producing a flat
`availableQuantity => ...` detail instead of either of the two shapes this
test already tolerated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@matweew
matweew merged commit 6a12cf9 into master Sep 29, 2026
1 check passed
matweew added a commit to spryker-shop/b2b-demo-marketplace that referenced this pull request Sep 29, 2026
…1411)

* CC-40714 Point cypress-tests at the availableQuantity flaky-test fix

Temporary branch pin so this shop picks up the fix ahead of it landing on
spryker/cypress-tests master: spryker/cypress-tests#421

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* pin cypress to master

---------

Co-authored-by: Claude Sonnet 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

Development

Successfully merging this pull request may close these issues.

2 participants