Repository navigation
Fix blank Cart/Checkout templates and the flaky Lighthouse cart perf gate - #172
Merged
Merged
Conversation
page-cart.html and page-checkout.html embedded a bare <!-- wp:woocommerce/cart /--> / <!-- wp:woocommerce/checkout /-->. Those blocks only render their inner-block tree, so with none declared the cart page loaded the full Cart bundle (~730 KB gz) and showed nothing under the heading, and the checkout page was blank. Both templates now render the page's own content via wp:post-content, as WooCommerce's bundled page-cart/page-checkout templates do; the content WooCommerce writes to those pages on install carries the full block trees. setup-woocommerce.sh created the pages with the same bare blocks when they were missing. It now runs WooCommerce's own install_pages tool (a no-op when the pages exist) and leaves the Cart/Checkout content to WooCommerce. Verified against WooCommerce 11.2.1 / WordPress 7.1.3: deleting both pages and re-running the script recreates them with the block trees and the page-cart/page-checkout template assignments. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The functional-page categories:performance floor drops from 0.85 to 0.50. The old floor only passed because /cart/ rendered no cart (see the previous commit): the empty page had no images, so all 61 blocking scripts got Chrome's "High" priority, and whether Lantern counted them as render-blocking depended on whether the runner painted before executing them -- simulated FCP 2.6 s (perf 0.90) or 6.9 s (perf 0.59) on byte-identical pages. That coin-flip is what failed the Dependabot vite bump (#170) on all three runs. A working Cart block cannot reach 0.85: it renders client-side, so its LCP element only paints after the WooCommerce/core JS has run, and simulated LCP is ~7-8 s on every run (observed 0.44-0.66 over 15 local runs; lhci asserts the best of the 3 runs). The resource budgets, CLS, a11y and best-practices floors are unchanged and still gate the cart. Also set include-hidden-files on the lighthouse-reports artifact upload: upload-artifact@v4 skips dot-paths by default, so .lighthouseci/ was never uploaded ("No files were found") since the step landed in #161. Docs: describe the floor and its measurements, correct the claim that assertions evaluate the median run (lhci's default aggregationMethod is optimistic), and add the calibration-history entry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
The
lighthouse-cicheck on #170 (Dependabot vite bump) failed/cart/performance at 0.59 (runs 0.47 / 0.59 / 0.59), while the electron bump started 15 s later passed at 0.90 — on byte-identical pages. The bump didn't cause it; the theme's Cart and Checkout pages have never rendered anything, and that made the Lighthouse score a coin flip.Root cause
page-cart.html/page-checkout.htmlembed a bare<!-- wp:woocommerce/cart /-->/<!-- wp:woocommerce/checkout /-->. Those blocks render only their inner-block tree, so with none declared the output is a stray</div>:/cart/loads ~730 KB gz of Cart-block JS and shows nothing under "Your cart";/checkout/is blank.A blank page has no images, so Chrome gives all 61 blocking scripts "High" priority. Whether Lantern treats them as render-blocking then depends on whether the runner happens to paint before executing them — simulated FCP 2.6 s (perf 0.90) vs 6.9 s (perf 0.59). The vite run landed on a slower runner and lost that race on all 3 runs.
Changes
<!-- wp:post-content /-->, likepage-myaccount.htmland WooCommerce's bundledpage-cart/page-checkouttemplates. The content WooCommerce writes to those pages on install carries the full block trees. Empty cart, filled cart and the checkout form all render (checked in headless Chrome at 412 px and 1440 px — summary table under Verification).categories:performanceinlighthouserc.json: 0.85 → 0.50. A working Cart block can't reach 0.85 under mobile simulation: it renders client-side, so its LCP element only paints after the WooCommerce/core JS has run — simulated LCP is ~7–8 s on every run. Over 15 local runs it scored 0.44–0.66. The old floor only passed because the page was empty. Script/CSS/image budgets, CLS, a11y and best-practices floors are unchanged and still pass.include-hidden-files: trueon thelighthouse-reportsupload.upload-artifact@v4skips dot-paths by default, so the artifact added in Lighthouse: raise a11y/SEO floors to 0.95 (closes #125) #161 has never contained anything (No files were found with the provided path: .lighthouseci/on every run).setup-woocommerce.sh— stops creating missing Cart/Checkout pages with the same bare blocks; runs WooCommerce's owninstall_pagestool instead (a no-op when the pages exist).tests/lighthouse/README.mdandCONTRIBUTING.md: the floor and its measurements, calibration history, and a correction: lhci asserts against the best of the 3 runs (defaultaggregationMethod: optimistic), not the median.0.50 is what a healthy cart scores under this suite, not a target. The alternative is to keep 0.85 and switch the cart to the classic
[woocommerce_cart]shortcode (~6× less JS), which the docs already describe as a UX trade-off (#125). If you'd rather go that way, items 1, 3, 4 and 5 stand on their own.Verification
Reproduced CI locally in an isolated Docker stack built from the same base image digest CI pulled (
wordpress:php8.3-apache@sha256:f3e6835f…), WordPress 7.1.3, WooCommerce 11.2.1, Chrome 155,@lhci/cli0.14 / Lighthouse 12.1 — the same versions as the failing run.origin/main): 5 runs → 0.52, 0.83, 0.86, 0.76, 0.87 — the coin flip reproduces.lhci assertpasses. Same runs against the old config: fails (cart best 0.63 < 0.85) — the template fix and the new floor have to ship together.woocommerce_*_page_idoptions, re-ransetup-woocommerce.sh --no-sample --theme flavian-shop --currency USD --country US:CA(the CI sidecar's args): both recreated with WooCommerce's block content and thepage-cart/page-checkouttemplate assignments.validate-block-markup.sh,security-scan.sh,audit-tokens.shpass on both templates;commitlintpasses on both commits.lighthouse-cicheck is that run.After merge
main(@dependabot rebase) to pick this up; its own change is fine.cart/checkoutwill change oncetests/visual/baselines/is bootstrapped (currently empty, so no diff runs).Not addressed here
/cart/undefinedwc/store/v1/cart(a malformed Store API URL, ~90 KB wasted per view) — WooCommerce bug, not ours.@lhci/cli0.14) can't parse Chrome 155's traces for thelargest-contentful-paint-element/layout-shiftsaudits (frame_sequenceerror). Bumping@lhci/cliwould restore them; noted in the README's debugging section.🤖 Generated with Claude Code