Skip to content

EDU-18161/18154/18162: restore signal in tests-summary PR comment (Phase 1)#1249

Open
PedroAntunesCosta wants to merge 45 commits into
mainfrom
fix/edu-18161-deterministic-doc-sampling
Open

EDU-18161/18154/18162: restore signal in tests-summary PR comment (Phase 1)#1249
PedroAntunesCosta wants to merge 45 commits into
mainfrom
fix/edu-18161-deterministic-doc-sampling

Conversation

@PedroAntunesCosta

@PedroAntunesCosta PedroAntunesCosta commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR started as the tests-summary signal-restoration work and now also carries the interim Cypress fixes needed on the same branch for #1239 and #1242.

Linked issues and Jira tasks

  • #1240 - EDU-18161 - Make documentation-pages-status.cy.js deterministic and unify navigation source
  • #1234 - EDU-18154 - Fix tests-summary PR comment to count distinct failing tests
  • #1241 - EDU-18162 - Reduce preview-infrastructure noise in documentation-pages-status.cy.js
  • #1239 - EDU-18159 - Interim sidebar test stabilization in this PR; the proper @vtexdocs/components hook bump remains tracked separately
  • #1242 - EDU-18160 - Make api-reference.cy.js resilient to slow loads on /docs/api-reference
  • Related regression coverage context: EDU-16758 - API reference hash-navigation regression work carved out of #1268 into #1249

Changes

Deterministic page sampling (select-pages.js, cypress.yml, cypress-extensive.yml)

  • Replace Math.random() with a seeded PRNG (mulberry32 over a SHA hash) in select-pages.js
  • Read seed from SAMPLE_SEED env var; fall back to a time-based seed for local runs
  • Set SAMPLE_SEED: ${{ github.event.pull_request.head.sha || github.sha }} in cypress.yml and SAMPLE_SEED: ${{ github.run_id }} in cypress-extensive.yml
  • Remove the Fetch navigation.json step - public/navigation.json from the PR branch is the single navigation source for both workflows
  • Persist sampled page metadata to cypress-sample.json; render a collapsible "Sampled pages" section at the bottom of the comment with the seed in the H1 heading

Structured failure records (support/functions.js, documentation-pages-status.cy.js)

  • Replace plain-text writeLog(title) with writeLog({ spec, title, attempt, type, message }) emitting one JSONL record to cypress-failures.jsonl per failure
  • documentation-pages-status.cy.js classifies each failure before the failing command: non-2xx responses -> http (status code in message), page-load timeouts -> load_timeout, DOM assertion failures -> dom

Summary report (summary-report.js)

  • Read cypress-failures.jsonl line-by-line; skip malformed lines without crashing
  • Collapse records by spec x title, keeping the highest-attempt entry per unique test
  • Show (retried Nx) suffix when a test was attempted more than once
  • Render three sections: Content regressions (dom), Preview infrastructure (http/load_timeout), Other (defensive bucket)
  • Headline N tests failed counts only content regressions; infrastructure failures are surfaced but not counted in the headline
  • Always render all three section headers, falling back to a "none" line when a bucket is empty
  • Truncate long per-spec test lists to 5 items with a collapsible overflow block

Workflow robustness (cypress.yml)

  • Guard the summary report: only run if failure records exist OR the component test step completed - prevents a Cypress crash from falsely publishing "All tests were successful!"
  • Preserve component test failures before integration tests overwrite the JSONL file; merge before generating the report
  • Run the integration test step headless and cap it at 25 minutes; add a 10-minute timeout and one retry to the component test step
  • Add a Unit tests (utils) step before component tests so a regression in report logic blocks merge

Unit tests (src/tests/utils/__tests__/summary-report.test.js)

7 tests using node:test + node:assert/strict (no new dependencies):

  • Retry collapsing: same title retried 3x -> countDistinct === 1, maxAttempt === 2
  • Multi-spec aggregation: 2 specs, 3 distinct titles -> countDistinct === 3, per-spec map sizes correct
  • Type partitioning: dom/http/load_timeout/unknown -> content/infra/infra/other buckets
  • Malformed JSONL: valid line + blank line + not-json -> returns only the valid record, no throw
  • specDisplayName: strips .cy.js / .cy.ts / .cy.tsx and directory prefix
  • Empty input: non-existent path -> []; countDistinct(collapseFailures([])) === 0

Interim Cypress fixes for #1239 / #1242 (api-guides.cy.js, api-reference.cy.js, support/commands.js, support/network.js)

  • Add waitForRapiDocReady() and replace the fixed cy.wait(10000) boot wait in api-reference.cy.js
  • Replace the sidebar collapse assertions in api-guides.cy.js and api-reference.cy.js so they assert sidebar content visibility and use forced .toggleIcon clicks instead of the old visibility paradox
  • Harden guide/api-reference preview visits so load timeouts fail fast or skip visibly instead of freezing the CI job
  • Add visitPageAllowingLoadTimeout() in a new support/network.js: it swallows remote page-load timeouts and removes its global fail handler inside the handler itself, so a swallowed timeout can no longer leak the handler into later tests and stall the job (root cause of the prior 25-minute integration-job timeouts)
  • Fix the table-of-contents selector in api-guides.cy.js by adding getDesktopTableOfContents() / getTocAnchorId() / getDesktopTocEntryLinks() - they target the populated desktop right-rail TOC (disambiguated from the empty mobile shell via the instance containing [data-cy="feedback-section"]) and match a[href*="#"], replacing the :visible selector that resolved to zero anchor links

Planned follow-up CI issues

The items below are scoped out of this PR and will be tackled separately after this merges:

EDU-16758 scope addition

Adds the EDU-16758 regression suite (5 Cypress cases) carved out of #1268, which shipped the product fix without tests. See plans/api-navitagion-bug/ for context.

Closes

Closes #1240
Closes #1234
Closes #1241
Closes #1239 (interim spec-side patch; the proper @vtexdocs/components hook bump for the toggle and category items is tracked separately)
Closes #1242

@PedroAntunesCosta PedroAntunesCosta added bug Something isn't working release-no No release bump labels May 5, 2026
@PedroAntunesCosta PedroAntunesCosta self-assigned this May 5, 2026
@netlify

netlify Bot commented May 5, 2026

Copy link
Copy Markdown

Deploy Preview for elated-hoover-5c29bf ready!

Name Link
🔨 Latest commit bc362c5
🔍 Latest deploy log https://app.netlify.com/projects/elated-hoover-5c29bf/deploys/6a4c08320325510008a962d9
😎 Deploy Preview https://deploy-preview-1249--elated-hoover-5c29bf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown

End-to-end tests (seed bc362c5)

Content regressions

No content regressions.

Preview infrastructure

3 infrastructure failures (HTTP errors and load timeouts — not content regressions)

documentation-pages-status

3 failing tests:

  • Checks page docs/guides/inventory — HTTP 404
  • Checks page docs/guides/product-display — HTTP 404
  • Checks page docs/apps/vtex.vtex.search/suggestions — HTTP 404

Other

None.

For more information, open the cypress action summary page.

Sampled pages

151 pages

Navigation source: public/navigation.json from this branch.

  • docs/guides/connect-the-vtex-cx-platform-mcp
  • docs/guides/implementing-mtls
  • docs/guides/vtex-ads-core-package-quickstart
  • docs/guides/storefront-roles
  • docs/guides/scheduling-prices-for-a-range-of-hours
  • docs/guides/setting-up-alternate-keys-in-master-data-v2
  • docs/guides/fulfillment-checkout-section-api-quick-start-guides
  • docs/guides/usecartpunchout-hook
  • docs/guides/get-cart-information-by-id
  • docs/guides/enable-an-observation-field-on-the-checkout-page
  • docs/guides/add-customer-profile-information-to-the-cart
  • docs/guides/discounts
  • docs/guides/getting-started
  • docs/guides/managing-tokenized-cards
  • docs/guides/composability
  • docs/guides/checking-which-user-is-currently-authenticated
  • docs/guides/payments-integration-payment-provider-protocol
  • docs/guides/sessions-system-overview
  • docs/guides/understanding-components-and-sections
  • docs/guides/inventory
  • docs/guides/payments-operations-category
  • docs/guides/order-canceling-improvements
  • docs/guides/orders-2
  • docs/guides/usesettings-hook
  • docs/guides/external-marketplace-integration-canceled-orders
  • docs/guides/installing-activity-flow-in-flutter-apps
  • docs/guides/master-data-v2-document-saving-flow
  • docs/guides/enable-cart-transfer-between-devices
  • docs/guides/external-marketplace-integration-logs
  • docs/guides/installing-activity-flow-in-headless-stores
  • docs/guides/using-weni-run-to-execute-tool-tests
  • docs/guides/tax-services-recipe
  • docs/guides/impressions
  • docs/guides/brands
  • docs/guides/external-search-provider-specification
  • docs/guides/pse-payment-method
  • docs/guides/checkout-extension-points
  • docs/guides/get-banner-list-for-a-specific-search
  • docs/guides/expiring-a-shoppers-password
  • docs/guides/vtex-ads-core-package-examples
  • docs/guides/payments-checkout-ui-category
  • docs/api-reference/payment-provider-protocol
  • docs/api-reference/payment-provider-protocol#get-/authorization/credentials
  • docs/api-reference/b2b-addresses
  • docs/api-reference/b2b-addresses#post-/api/dataentities/customFieldValues/documents
  • docs/api-reference/pick-and-pack-api
  • docs/api-reference/pick-and-pack-api#get-/shipments/-orderId-
  • docs/api-reference/vtex-shopee-integration-api
  • docs/api-reference/vtex-shopee-integration-api#post-/api/shopeeintegration/{accountName}/pub/orders/{mktplaceOrderId}/cancelDelivery
  • docs/api-reference/checkout-custom-card-payment-api
  • docs/api-reference/checkout-custom-card-payment-api#get-/api/pvt/transactions/-transactionId-
  • docs/api-reference/catalog-api
  • docs/api-reference/catalog-api#get-/api/catalog_system/pvt/commercialcondition/list
  • docs/api-reference/promotions-and-taxes-api
  • docs/api-reference/promotions-and-taxes-api#get-/api/rnb/pvt/benefits/calculatorconfiguration
  • docs/guides/vtex-io-documentation-4-declaring-a-theme-block
  • docs/guides/vtex-io-documentation-setting-your-apps-billing-model
  • docs/guides/vtex-io-documentation-what-is-vtex-io
  • docs/guides/vtex-io-documentation-docs-builder
  • docs/guides/developing-a-graphql-api-in-service-apps
  • docs/guides/controlling-access-to-app-resources
  • docs/guides/vtex-io-documentation-9-improving-performance-with-caching
  • docs/guides/vtex-io-documentation-vtex-io-cli-plugins
  • docs/guides/vtex-io-documentation-2-basic-development-setup-in-vtex-io
  • docs/guides/vtex-io-documentation-paymentprovider-builder
  • docs/guides/vtex-io-documentation-creating-development-workspace-for-cms-legacy
  • docs/guides/vtex-io-documentation-builder-version-statuses
  • docs/guides/vtex-io-documentation-8-makingyourpixelapppubliclyavailable
  • docs/guides/product-display
  • docs/apps/vtex.product-summary
  • docs/apps/vtex.product-specifications
  • docs/apps/vtex.store-media
  • docs/apps/vtex.product-summary/productsummaryskuname
  • docs/apps/vtex.overlay-layout
  • docs/apps/vtex.vtex.search/suggestions
  • docs/apps/vtex.product-price
  • docs/apps/vtex.rewriter/rewriter-graphql-api
  • docs/apps/vtex.search-result
  • docs/apps/vtex.product-summary/productsummarybuybutton
  • docs/apps/vtex.blueknow
  • docs/apps/vtex.product-quantity
  • docs/apps/vtex.reviews-and-ratings
  • docs/guides/vtex-io-documentation-improving-filter-navigator-experience
  • docs/guides/vtex-io-documentation-customizing-your-stores-typography
  • docs/guides/store-framework-working-with-site-editor
  • docs/guides/faststore/dynamic-content-step-1-setting-up-the-store-code-for-dynamic-content
  • docs/guides/faststore/storefront-features-implementing-live-shopping-for-faststore-previous-versions
  • docs/guides/faststore/search-search-provider
  • docs/guides/faststore/go-live-1-configuring-external-dns
  • docs/guides/faststore/getting-started-glossary
  • docs/guides/vtex-io-documentation-making-a-custom-component-available-in-site-editor
  • docs/guides/faststore/storefront-features-enabling-product-purchase-from-search-with-quick-order
  • docs/guides/faststore/api-extensions-consuming-api-extensions
  • docs/guides/vtex-io-documentation-collecting-user-session-data
  • docs/guides/how-product-name-control-works
  • docs/guides/faststore/headless-cms-widgets
  • docs/guides/faststore/molecules-checkbox-field
  • docs/guides/faststore/organisms-navbar
  • docs/guides/faststore/using-themes-mixins-breakpoints
  • docs/guides/store-framework-configuring-analytics-google-tag-manager
  • docs/guides/faststore/atoms-radio
  • docs/guides/faststore/molecules-tooltip
  • docs/guides/vtex-io-documentation-1-basicsetup
  • docs/guides/faststore/schema-inputs
  • docs/guides/faststore/molecules-cart-item
  • docs/guides/vtex-io-documentation-semantic-html-migration
  • docs/guides/faststore/faststore-api-overview
  • docs/guides/vtex-io-documentation-customizing-your-404-page
  • docs/guides/vtex-io-documentation-creating-robots-files-for-cross-border-stores
  • docs/guides/getting-started-3
  • docs/guides/faststore/go-live-2-integrating-the-vtex-login
  • docs/guides/faststore/molecules-radio-field
  • docs/guides/faststore/storefront-features-implementing-shopping-assistant-in-faststore
  • docs/guides/list-of-controls-for-templates
  • docs/troubleshooting/the-promotion-highlight-flag-does-not-appear-on-the-product
  • docs/troubleshooting/i-am-getting-500-errors-in-vtex-io-cli
  • docs/troubleshooting/my-routes-are-not-behaving-as-expected
  • updates/release-notes/new-marketplace-endpoints-available-request-review
  • updates/release-notes/2026-05-15-updated-vtexvaultcom-route-for-send-payments-request
  • updates/release-notes/new-save-user-data-opt-in-feature
  • updates/release-notes/new-product-price-blocks-for-installment-options
  • updates/release-notes/new-parameters-for-installments-in-payment-provider-protocol
  • updates/release-notes/checkout-ui-custom
  • updates/release-notes/ab-test-information-maximum-time-for-tests-is-now-limited-to-30-days
  • updates/release-notes/2023-06-06-new-integration-guide-headless-commerce
  • updates/release-notes/new-marketplace-endpoints-available
  • updates/release-notes/2023-07-05-recaptcha-validation-will-now-follow-orderform-configuration-for-all-requests
  • updates/release-notes/new-variable-for-the-google-tag-manager-app-originalreferrer
  • updates/release-notes/seller-selector-context
  • updates/release-notes/2025-06-24-faststore-webops-centralized-secrets-management
  • updates/release-notes/2026-06-19-faststore-release-notes-4-2-0
  • updates/release-notes/store-forms-form-inputupload-block
  • updates/release-notes/gift-card-support-multi-currencies
  • updates/release-notes/new-endpoint-available-on-suggestions-api
  • updates/release-notes/flexible-search-results-page
  • updates/release-notes/secure-proxy-a-new-option-for-card-payment-integrations
  • updates/release-notes/2025-01-08-simplified-lighthouse-dependency
  • updates/release-notes/2025-04-08-faststore-webops-self-service-domain-setup-now-available
  • updates/release-notes/2024-11-04-new-password-field-for-sending-secure-data-in-the-anti-fraud-flow
  • updates/release-notes/2025-12-17-faststore-custom-event-parameter
  • updates/release-notes/application-form-to-access-vtex-io-builders-is-no-longer-required
  • updates/release-notes/2025-04-16-store-framework-improved-image-dimension-control-with-store-image
  • updates/release-notes/store-locator-app
  • updates/release-notes/2026-02-20-faststore-release-notes-version
  • updates/release-notes/new-go-live-documentation-available
  • updates/release-notes/products-sorted-by-collection
  • updates/release-notes/facebook-domain-verification-app
  • updates/release-notes/2026-04-10-delivery-promise-suggestions-api-headless-integration
  • updates/release-notes/2023-07-07-change-in-the-sku-notification-behavior
  • updates/release-notes/vtex-io-release-notes-may-2020
  • updates/release-notes/new-affiliates-program-app

@PedroAntunesCosta PedroAntunesCosta changed the title EDU-18161: make documentation page sampling deterministic EDU-18161/18154/18162: restore signal in tests-summary PR comment (Phase 1) May 11, 2026
PedroAntunesCosta and others added 20 commits May 29, 2026 12:39
Each failed test now emits a JSON line to cypress-failures.jsonl
with spec, title, attempt, type, and message fields instead of a
plain-text line in cypress.log. All callers updated accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
summary-report.js now reads cypress-failures.jsonl, groups records
by spec and title, and reports the number of unique failing tests
regardless of how many times each was retried. A (retried Nx) suffix
is shown when a test was attempted more than once.

Workflow files updated to preserve, merge, and clean up
cypress-failures.jsonl instead of the old cypress.log.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…spec

Replace the expect() status assertion with a conditional that sets a
failureType flag (http / load_timeout / dom) before the potentially
failing command. afterEach reads the flag so writeLog emits the correct
type for each failure rather than always emitting 'dom'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
summary-report.js now renders three sections:
- Content regressions (type=dom) — drives the headline count
- Preview infrastructure (type=http/load_timeout) — visible but not
  counted in the headline, each entry shows the status code or timeout
- Other — defensive bucket for unrecognised types

The headline "N tests failed" now reflects only actionable content
failures. Infrastructure noise is surfaced separately so reviewers
can distinguish flaky preview from real broken pages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
load_timeout entries had no explanation in the Preview infrastructure
section. Now falls back to the type name (e.g. "load timeout") so
reviewers always know why a failure was classified as infrastructure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When the Cypress component tests crash (not just test failures), no
cypress-failures.jsonl is written. Previously the report ran with an
empty input and published "All tests were successful!" which is wrong.

Now the report only runs when failure records exist OR the component
test step actually completed successfully. A Cypress crash instead
publishes a "failed to run" message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without a timeout, the integration tests can run for GitHub's full 6-hour
job limit (e.g. when the sampled pages include many slow API reference pages),
preventing the summary report step from ever executing.
…pages section

- Surface the sample seed in the top-level H1 so it's immediately visible
- Content regressions / Preview infrastructure / Other sections are always
  rendered; each falls back to a "none" line when the bucket is empty
- Sampled pages list remains at the bottom of the comment
- Remove the now-inlined printSampleMetadata helper
Adds src/tests/utils/__tests__/summary-report.test.js covering retry
collapsing, multi-spec aggregation, type partitioning, malformed JSONL
tolerance, specDisplayName, and empty-input edge cases (node:test,
no new dependencies). Adds `test:utils` script to package.json and a
pre-component-tests CI step so a regression in report logic blocks merge.

Closes the missing acceptance criterion for Task 2 (EDU-18154).
…pi-reference spec

Adds a polling helper that waits for rapi-doc's resolvedSpec + scrollToPath
to be ready, replacing the fixed 10-second wait. Part of EDU-16758.
Replaces opacity-based visibility checks on .toggleIcon with
data-cy="sidebar-section" state checks and force-clicks.
Part of EDU-16758.
@PedroAntunesCosta PedroAntunesCosta force-pushed the fix/edu-18161-deterministic-doc-sampling branch from 1fe71c0 to 892f966 Compare May 29, 2026 15:40
@PedroAntunesCosta PedroAntunesCosta removed the request for review from henriquessb June 8, 2026 18:25
Reduce the Cypress step timeout and drop headed mode so CI fails faster and uses less runner time.
A swallowed remote page-load timeout aborts the command queue, so the
happy-path cleanup that removed the global fail handler never ran. The
leaked handler then bled into later tests, stalling healthy assertions
and leaving the guide load-timeout alias unregistered. Remove the handler
inside the handler itself so it can never leak, while preserving the
slow-load tolerance and the value yielded to callers.
Disambiguate the populated desktop TOC from the mobile shell so anchor-link
assertions resolve reliably in CI.
Table of contents entries use full preview URLs with a hash fragment, not
hash-only hrefs, so the api-guides spec now queries a[href*="#"].
Pre-register the alias so feedback tests do not fail when a swallowed page
load timeout aborts the visit chain before .as() runs.
Collapsed AnimateHeight sections hide nested links; filter to :visible
entries before selecting the last anchor to click.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working release-no No release bump

Projects

None yet

1 participant