Read PMM-T269's selected filter through Show selected - #1186
Closed
claude[bot] wants to merge 1 commit into
Closed
Conversation
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>
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.
Failures fixed (investigator)
test execution / @qan|@menu|@valkey-nightly|@permissions-nightly|@pt-summary-nightly|@pbm-nightly(94793857462)codeceptjs-e2e/tests/QAN/common_test.js:12/@qan— PMM-T269 "Verify QAN UI Elements are displayed"What failed
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:
service_namevalues in the lastmetrics:getFiltersresponsefilter-checkboxelements in the DOM at the failing steppdpgsql_pmm_patroni_17_1_3600metrics:getReportrequestlabels: [{"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: DELETEfilter stayed applied, andunder it
pdpgsql_pmm_patroni_17_1_3600sorted to first in Service Name —which is how it ended up in
serviceLabelsand got chosen. Clearing that filterdropped it back to index 16.
Fix
so a group's filter cannot leak into the next iteration.
showAlloff,CheckboxGrouprenders only checked items, so the selection is always presentregardless of where it sorts. This is the same affordance PMM-T125 and
PMM-T191 already exercise.
:checkedinstead of thecheckedattribute. React writes thatattribute 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, clientpmm3-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:
Tests run against that server on this branch — all pass:
@qan@qan@qan@qan(uses the sharedcheckedFilters()locator viaverifyCheckedFilters)npx eslintis clean on both changed files apart from aprefer-destructuringerror that already exists on
mainat 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