Skip to content

Wait for the product grid before the DOM price cross-check - #17

Merged
jehrr merged 1 commit into
mainfrom
fix/site-change-2026-10-14
Oct 15, 2026
Merged

jehrr merged 1 commit into
mainfrom
fix/site-change-2026-10-14

Conversation

@jehrr

@jehrr jehrr commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

The daily canary went red on 2026-10-13 (run 38483372156) with dom_confirm = {tiles: 19, checked: 0, confirmed: 0}. That run itself exited 0 with 109 correct rows. The next scheduled run (2026-10-14, same commit) passed with 60 tiles and 41 checked, so the failure comes and goes.

Diagnosis, measured live on 2026-10-15 (headful Chromium under Xvfb, no proxy, no key):

  • /shop/browse/bakery now paints a 19-tile horizontal carousel (seasonal products) about one second before the 37-tile product grid. Tile counts polled every 250 ms went 0 → 19 → 52 → 56.
  • The readiness wait counts any wc-product-tile, so the 19 carousel tiles satisfy it.
  • None of the carousel's stockcodes is on page 1 of the listing. When the page-1 API answer comes back quickly, confirm_with_dom reads only the carousel. It then checks 0 rows and logs that at INFO only.

A capture taken in that gap reproduces the canary's numbers exactly: 19 tiles, 0 checked. A later read in the same session gives 37/37.

Change

  • product_parser.rows_with_a_tile(rows, tiles): how many rows have a rendered tile with their own stockcode.
  • page_flow.confirm_with_dom: when tiles are on screen but none matches the page's rows, it re-reads them every 500 ms for up to GRID_SETTLE_MS (10 s) until the grid shows up. If nothing ever matches, it logs a WARNING naming the tile count. Rows are never changed by this path.
  • Fixture tiles_carousel_first: a real capture from one session. It holds the carousel-only read (19 tiles), the full read (56 tiles), and page 1 of the category API that the page's own UI requested, trimmed the same way as the other listing fixtures. make_fixtures.py documents and builds it.

Evidence

  • Offline suite, core-only venv: 123/123, with the three engine groups skipped.
  • Control: with page_flow.py restored from main and the new fixture and tests kept, test_dom_confirmation_waits_past_a_carousel_for_the_grid fails. The cross-check reads the carousel and stops at checked 0, and the give-up test errors.
  • Fixture assertions: the early read matches 0 rows and gives (0, 0). The late read gives (8, 8). Pinned skus and prices are 6041394 $4.00, 49622 $5.20 and 6037735 $2.60.
  • Live run with the change, the canary's exact command (bakery, 3 pages): 19 tile(s) had painted… then 37 of 37 row(s) checked against 56 rendered tile(s). Result: 109 rows, exit 0.

Not changed

  • The readiness wait's selector. It still counts any tile, because the grid's class names are build hashes. The wait now sits in the cross-check, keyed on stockcodes rather than markup.
  • Canary workflow changes are in the separate audit PR.

🤖 Generated with Claude Code

Category pages now paint a 19-tile carousel about a second before the
grid. The readiness wait counts any tile, so the cross-check could read
only the carousel, match none of page 1's rows and record checked=0, which
turned the daily canary red on 2026-10-13. It now waits (bounded, 10 s)
until a rendered tile carries one of the page's stockcodes, and warns if
none does. Adds a real two-read capture of the bakery page as a fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jehrr
jehrr marked this pull request as ready for review October 15, 2026 13:53
@jehrr
jehrr merged commit f5a988a into main Oct 15, 2026
8 checks passed
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