Fix QAN search page-object race with debounced search - #1189
Closed
claude[bot] wants to merge 1 commit into
Closed
Conversation
The QAN Overview search became search-as-you-type (debounced) in PMM-14848 (percona/pmm#5537). searchByValue()/click() cleared the field before clicking it, which kicks off an empty-search reload of the Overview panel; the panel unmounts the search input while it reloads, so the immediately following I.click() -- which asserts existence without waiting for it -- fails with ElementNotFound (PMM-T1061, PMM-T1790, and any @qan spec that searches). Click the already-loaded grid first and let I.fillField clear+type (Playwright fill clears the field), then wait for the panel to settle. Apply the same settle to clearSearchValue(). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dtd6vCp2nyWfx2T8VdfnJj Signed-off-by: Claude <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.
Failures fixed (investigator)
main@37a003d, serverperconalab/pmm-server:3-dev-latest), jobtest execution / @qan|@menu|@valkey-nightly|@permissions-nightly|@pt-summary-nightly|@pbm-nightly. Same two tests also failed in the previous night's run (31852756475) — not a one-off.codeceptjs-e2e/tests/QAN/details_explain_test.js/@qan— PMM-T1790 "Verify that there is any no error on Explains after switching between queries from different DB servers"codeceptjs-e2e/tests/QAN/overview_test.js/@qan— PMM-T1061 "Verify Plan and PlanID with pg_stat_monitor"What failed
Both tests died on the same page-object step, with the same error:
The input is visible at
:155and gone by:158.Root cause — a race in our page object, not the product
QAN Overview search is search-as-you-type (debounced) since PMM-14848 / percona/pmm#5537.
I.clearFieldfires a change on the debounced field, which kicks off an empty-search reload of the Overview panel. The panel unmounts the search input while it reloads.I.click(proceedClick→assertElementExists) asserts existence without waiting for it, so if it lands inside that window it fails immediately.Whether it lands there is purely a matter of how long the reload takes. Codecept's
waitForAction: 500sits between the two steps, so a reload shorter than ~500 ms is invisible and a longer one is fatal — which is why this is deterministic on the nightly (14 client shards feeding one server) and invisible on a small setup.Evidence — throwaway Linode VM, PMM
3.9.1-v3-0c89674a1(3-dev-latest), Chrome 151.0.7922.34 (same as CI)Setups:
--database ps --database psmdb --database pdpgsql(the services these two specs filter on:ps-dev,mongodb,pdpgsql_pmm).1. The unmount is real. Instrumented the DOM across a
clearFieldon an idle server — the input detaches for ~200 ms:~200 ms is under
waitForAction: 500, so both specs pass individually on an idle box — exactly why this doesn't show up in light environments.2. With a CI-like reload duration it fails deterministically. Same page, same session,
POST /v1/qan/metrics:getReportdelayed 3 s, replaying both step sequences verbatim (clearField=fill(''),click= existence assert with no wait,waitForAction: 500between steps):3. Unforced reproduction + no regressions. Full
@qantag run twice on the same VM, back to back,mainvs this branch:main(37a003d)Failing-test diff:
@qan), PMM-T215 (@qan)pgsql_pgss_pmm,mysql_pmm_,pxc_node__1,pxc-dev-cluster, pagination counts) — identical on both runsThe
mainrun failed PMM-T1790 with the CI error verbatim, atqueryAnalyticsData.js:158, with no throttling involved.The fix
Don't clear before clicking. Click the already-loaded grid first and let
I.fillFieldclear-and-type (Playwrightfillclears the field) — one debounce cycle instead of two, and no click against a reloading panel. Settle withwaitForLoaded()afterwards, and apply the same settle toclearSearchValue().Notes
0b2c040, written during the 3.9.0-rc dry-run and described in RC dry-run test fixes: QAN search race + RC CLI version resolution #1184 — that branch was later rewritten and the commit is no longer in it, so nothing onmainor in any open PR carries the fix.resetAllFilters()). It fails in CI with the identical error at the identical page-object line, and evidence 2 reproduces its exact failure deterministically. Only the next real nightly can confirm it end-to-end under the full 14-shard load.🤖 Generated with Claude Code
https://claude.ai/code/session_01Dtd6vCp2nyWfx2T8VdfnJj
Generated by Claude Code