Skip to content

Read PMM-T269's selected filter through Show selected - #1186

Closed
claude[bot] wants to merge 1 commit into
mainfrom
claude/elegant-cerf-k7a6lq
Closed

Read PMM-T269's selected filter through Show selected#1186
claude[bot] wants to merge 1 commit into
mainfrom
claude/elegant-cerf-k7a6lq

Conversation

@claude

@claude claude Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Failures fixed (investigator)

What failed

locator.textContent: Timeout 20000ms exceeded.
  - waiting for locator('#grafana-iframe').contentFrame().locator(
      '//div[contains(@data-testid, "filter-checkbox")]//input[@type="checkbox" and @checked]
       //following-sibling::span[@class="checkbox-container__label-text"]').first()

Root cause — pmm-qa test code, not the product

QAN renders each filter group through react-viewport-list
(CheckboxGroup.tsx),
so only the values inside a group's viewport exist as DOM elements. A selected
filter that sits below that viewport is not in the DOM at all, and the test's
checkedFilters() locator scans the whole panel for one.

Read straight out of the failed run's Playwright trace:

evidence value
service_name values in the last metrics:getFilters response 32
filter-checkbox elements in the DOM at the failing step 81 (of 270 filter values overall)
service the test had just selected pdpgsql_pmm_patroni_17_1_3600
its index in the re-sorted Service Name list 16 of 32 — outside the ~9 rendered rows
last metrics:getReport request labels: [{"key":"service_name","value":["$__all","pdpgsql_pmm_patroni_17_1_3600"]}]

The report request still carries the filter, so PMM applied the selection
correctly — only the checkbox for it was virtualised away.

The test picked that far-down service because the loop above it never actually
deselects. selectFilterInGroupAtPosition(group, n) clicks the n-th checkbox,
and the first click re-sorts the group, so clicking position n again toggles a
different value. In this run a cmd_type: DELETE filter stayed applied, and
under it pdpgsql_pmm_patroni_17_1_3600 sorted to first in Service Name —
which is how it ended up in serviceLabels and got chosen. Clearing that filter
dropped it back to index 16.

Fix

  • Reset the filters between loop iterations instead of re-clicking a position,
    so a group's filter cannot leak into the next iteration.
  • Click Show selected before reading the checked filter. With showAll off,
    CheckboxGroup renders only checked items, so the selection is always present
    regardless of where it sorts. This is the same affordance PMM-T125 and
    PMM-T191 already exercise.
  • Match :checked instead of the checked attribute. React writes that
    attribute from the state the input was mounted in and does not update it on
    toggle, so it is not a reliable read of the current state.

No assertion was loosened: the test still requires a checked filter whose label
contains the selected service, and still requires rows after filtering.

Verification

On a throwaway Linode VM (perconalab/pmm-server:3.9.0-rc, client pmm3-rc,
--database mysql/pgsql/ps/psmdb pss+sharding/pxc, 21 services registered),
a probe that selects a Service Name value below the group's viewport:

service_name values returned by the API: 16
service_name checkboxes actually rendered in the DOM: 8
target (last in API order): rs102_8443
OLD locator matches (before Show selected): 0     <- the nightly failure
target still rendered anywhere:             0
OLD locator matches (after Show selected):  1
NEW locator matches (after Show selected):  1 -> ["rs102_8443"]

Tests run against that server on this branch — all pass:

test result
PMM-T269 — Verify QAN UI Elements are displayed @qan ✔ 272s
PMM-T125 — Show only selected / Show All filter values @qan ✔ 44s
PMM-T191 — Reset All and Show Selected filters @qan ✔ 62s
PMM-T1143 — columns and filters on copied QAN URL @qan (uses the shared checkedFilters() locator via verifyCheckedFilters) ✔ 54s

npx eslint is clean on both changed files apart from a prefer-destructuring
error that already exists on main at the same statement.

Only the next nightly can confirm the fix under the full 14-setup matrix; the
probe above reproduces the exact DOM condition that made it fail.


Generated by Claude Code

The nightly QAN job failed on PMM-T269 waiting for a checked filter
checkbox that was never in the DOM. QAN's filter groups are rendered
through react-viewport-list, so only the values inside a group's
viewport exist as elements. The trace of the failed run shows the
service that had just been selected, pdpgsql_pmm_patroni_17_1_3600,
sitting at index 16 of 32 in Service Name -- outside the ~9 rendered
rows -- while the getReport call still carried the filter, so the
product had applied it correctly.

The test picked that far-down service because the loop above it never
deselected: clicking the same nth position twice toggles a different
value once the first click re-sorts the group, so a stale cmd_type
filter stayed applied and re-ordered Service Name underneath the grab.

Reset the filters between loop iterations instead of re-clicking a
position, and click 'Show selected' before reading the checked filter.
The locator now matches ':checked' rather than the 'checked' attribute,
which React only writes with the state the input was mounted in.

Signed-off-by: Davi Travaglia <davi.travaglia@percona.com>
@travagliad travagliad closed this Aug 17, 2026
@travagliad
travagliad deleted the claude/elegant-cerf-k7a6lq branch August 17, 2026 09:00
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