Skip to content

Recognize spinbutton purchase forms with a button-type Add to Cart on declared product detail pages - #8037

Draft
chubes4 wants to merge 1 commit into
trunkfrom
fix/issue-8035-blocks-engine
Draft

chubes4 wants to merge 1 commit into
trunkfrom
fix/issue-8035-blocks-engine

Conversation

@chubes4

@chubes4 chubes4 commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

What changed

  • New FormRuntimeRequirementAnalyzer::holdsQuantityAndAddToCartAction(): a form counts when it holds an enabled quantity control (ARIA spinbutton, a number input, or a quantity/qty field) plus a button whose text or accessible name says "add to cart". Any button type counts. It reads ARIA roles, accessible names and button text only, never vendor class names.
  • In CommerceFallbackReporter, the purchase-form pass already runs only on pages with a single Product declaration. It now also accepts these forms, so they get a commerce_add_to_cart_form binding that the product row claims, which produces its whole_page_candidate.
  • The same form on a page with no Product declaration is unchanged: it stays an ordinary form, with no product binding and no whole-page candidate.
  • New unit test tests/unit/product-detail-spinbutton-purchase-form.php compiles the issue's reduced artifact with ArtifactCompiler and covers both the positive and the negative case.

Verification

All gates passed on 0158f4e9d7fe. Base trunk: gated on 6befe400b4e3, target now 6befe400b4e3, re-verified: no.

  • ( if git diff --quiet --no-renames 6befe400b4e3660754469bf3b7024b0ebf94a60a -- ':(literal)php-transformer'; then :; els…: passed, 33303 ms; retained gate metadata.
  • php php-transformer/tests/run.php: passed, 67072 ms; retained gate evidence.
  • ( if git diff --quiet --no-renames 6befe400b4e3660754469bf3b7024b0ebf94a60a -- ':(literal)php-transformer'; then :; els…: passed, 85338 ms; retained gate metadata.
  • repro: none (no repro gate was declared, so these gates do not prove the issue).
  • CI: pending

Gate 2 output
[output truncated; retained tail]
nt-recorder.php
ok    0.0s tests/unit/subtree-classifier.php
ok    0.1s tests/unit/source-style-element-identity.php
ok    0.1s tests/unit/table-element-converter.php
ok    0.1s tests/unit/raw-html-companion-editability.php
ok    0.0s tests/unit/unreachable-text-trap-controls.php
ok    0.0s tests/unit/unsupported-selector-declaration.php
ok    0.0s tests/unit/wordpress-compat-anchor-boundary.php
ok    0.0s tests/unit/wrapper-decision-retention.php
ok    0.1s tests/unit/theme-json-projection-layered-deferral.php
ok    0.0s tests/unit/wrapper-decision-lowering.php
ok    0.0s tests/unit/wordpress-compat-source-liveness.php
ok    0.0s tests/unit/wordpress-compat-specificity-shims.php
ok    0.1s tests/unit/text-leaf-element-converter.php
ok    0.1s tests/unit/theme-json-projection-typography-families.php
ok    0.0s tests/unit/wrapper-decision-layout.php
ok    0.0s tests/unit/wordpress-compat-impossible-navigation-hosts.php
ok    0.0s tests/unit/wrapper-decision-conversion.php
ok    0.0s tests/unit/wrapper-decision-patterns.php
ok    0.0s tests/unit/wrapper-coalescer-disposition.php
ok    2.8s tests/unit/image-auto-margin-centering.php
ok    0.6s tests/contract/richtext-subject-arm-scaling.php
ok    6.1s tests/contract/shared-author-stylesheet-scaling.php
ok    0.0s tests/unit/form-custom-property-condition-scaling.php
ok    3.7s tests/unit/gallery-compilation-scaling.php
ok    3.4s tests/unit/recognizer-compilation-scaling.php
ok    0.5s tests/unit/route-root-stylesheet-scaling.php
ok    0.2s tests/unit/route-selector-match-index-scaling.php
ok    0.0s tests/unit/site-plan-write-token-scaling.php
Slowest:
    36.6s tests/contract/runtime-entity-budget.php
    20.6s tests/unit/design-system-usage-derivation.php
    18.2s tests/contract/test-runner.php
    17.8s tests/unit/boxless-image-figure-paint.php
    17.6s tests/contract/shared-shell-extraction.php

2153 tests, 0 failed, 66.3s wall, 1287.7s cpu, 32 jobs, opcache file cache off, test workers on (59 own-process tests)

Cook run
  • Cook ID: agent-task-db0bf8ea-a01c-46d0-8a1b-9b59bfe7c9c0
  • Attempt run ID: agent-task-db0bf8ea-a01c-46d0-8a1b-9b59bfe7c9c0-attempt-1-c5326d7e
  • Gate 1: tree e7f80fc447c89830ad07f63a301c421ee6603385
  • Gate 2: tree e7f80fc447c89830ad07f63a301c421ee6603385
  • Gate 3: tree e7f80fc447c89830ad07f63a301c421ee6603385

Delivery

  • Delivered:
  • Delivered: Unit test with the reduced artifact, positive and negative cases, failing on trunk
  • Delivered: PR body links the issue, includes the loop signature and an AI disclosure

Evidence

  • Local run: php tests/run.php reported 2153 tests, 0 failed. This is a local run, not the gate result.
  • Local run: the new test printed ok with the fix. With the source changes stashed (trunk), it threw a RuntimeException.
  • The Homeboy lint gate could not run locally because the php-transformer component has no linked extension with deps support. I only ran php -l on the three changed files, which reported no errors; lint itself is left to the gate run.

AI disclosure

Tool: Homeboy Cook. Agent: Homeboy (roadie). Model: roadie · route cook-heavy · served claude-opus-5-5. Cook time: 11m08s.

The AI read the issue, traced the add-to-cart gating through the analyzer, reporter and entity collector, wrote the fix and the regression test, and ran local checks, under the direction of the Cook requester. Homeboy reports controller verification separately from this account of the AI's work. A human reviews before merge.

Refs #8035

@chubes4

chubes4 commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

End-to-end check on the real site. The PR's transformer was dropped into the SSI v1.47.2 release with lab/import-loop/gates/reimport.sh and imported newyorktactical2a.com (Weebly, 17 products). No product page handed off. All 17 product-route Pages are still published (14-2, 9-2, hxqolksf66is7oshwwloed4v, …), and the import report never mentions whole_page.

Isolating it with ArtifactCompiler directly on the captured pages, plus the capture's commerce-catalog.json declared as generic/products/v1 (slug = URL id, source_route = URL path):

input detail row page whole_page_candidates
index.html + s/shop/index.html + product/draw-from-concealment/14/index.html draw-from-concealment, commerce_add_to_cart_form, candidate 1 ✓
same + product/nra-basic-pistol/9/index.html nra-basic-pistol, no binding, no candidate 0 ✗

Two remaining gaps:

  1. Duplicate Product JSON-LD on one page. 6 of the 17 detail pages carry two WebPage.mainEntity Product blocks for the same product. The second @id only adds a query string: …/product/nra-basic-pistol/9#product and …/product/nra-basic-pistol/9?cs=true&cst=custom#product. The purchase form is identical to the draw-from-concealment page, so the page apparently no longer counts as one declared product. Two declarations of the same product (same name/offer, @id equal once the query is dropped) should still be one product owning the page.
  2. The single-JSON-LD pages also fail through the SSI import path. draw-from-concealment gets its candidate with ArtifactCompiler in isolation, but in the full SSI import it lands as product 14 with a separate 14-2 Page and no handoff diagnostics. That points at a difference between the importer's staged/per-page compilation (SitePlanRun / site plan preparation) and the one-shot ArtifactCompiler::compile(). Either the candidate is lost there or it gets detached during the catalog merge. This needs a test that goes through the same path SSI uses.

Reduced inputs and the probe script are on the loop host. Re-check command:
SSI_ZIP=<ssi 1.47.2 zip> IMPORT_LOOP_STUDIO=<studio> bash lab/import-loop/gates/reimport.sh <php-transformer> <capture> <site>, then studio wp post list --post_type=page.


AI disclosure: Claude Opus (via Claude Code) ran the re-import and the isolation probes and wrote this comment.

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