Repository navigation
Keep a typed alert argument search when the source search is rebuilt - #35683
chirag-madlani wants to merge 2 commits into
Conversation
Adding a filter re-asks the server what the selection supports, which hands the argument autocomplete a new sourceSearch. debouncedSearch depended on it, so it was rebuilt and the cleanup cancelled the search the user was still typing: the text stayed in the input but no search request was ever sent. Read the search params through a ref so the debounced function is created once and only cancelled on unmount. This is the cause of the intermittent NotificationAlerts > Multiple Filters Alert timeouts in the merge queue.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
Code Review ✅ Approved🟡 Medium risk · Preserving pending alert-argument searches across source rebuilds changes option lookup timing, which could display an incorrect set of rule choices. Fixes a race in the alert form's searchable rule arguments where a search typed right after adding a filter was silently dropped. The debounced search now reads its parameters through a ref, so it is only cancelled on unmount rather than on every rebuild. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
❌ UI Checkstyle Failed❌ ESLint + Prettier + Organise Imports (src)One or more source files have linting or formatting issues. Affected files
🔍 ESLint findings in this PR's files — 0 error(s), 2 warning(s)Errors block the build. Warnings do not yet — they are rules whose backlog is still 0 error(s), 2 warning(s) across 2 changed file(s).
All findings
Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
|



Describe your changes:
Fixes a race in the alert form's searchable rule arguments (e.g. the Updater Name user picker): a search typed right after adding a filter could be silently dropped. The text stays in the input, but no search request is ever sent, so the list keeps showing the unfiltered defaults.
Cause. In
AiArgumentAutocomplete(AlertAiRuleSection.component.tsx),debouncedSearch(500 ms) was memoized on[argument, selectedSource, sourceSearch, stableContainerEntities], and an effect cancels it on cleanup. Adding a filter changes the form input →useAlertCapabilitiesre-asks the server → when it answers,useAlertSelectionhands out a newsearchobject →debouncedSearchis rebuilt and the pending typed search is.cancel()led.Fix. Read those params through a ref (the component already does this for
selectedValues), so the debounced function is created once and only cancelled on unmount.This is what blocked the merge queue for #35678 on
Flow/NotificationAlerts.spec.ts › Multiple Filters Alert(run 39030428697). The retry trace shows only twoindex=user&q=(empty query) requests about 950 ms apart, the second being the dependency change re-running the initial load, and never the typed name. The first attempt timed out on the same form with the filter option detaching.Testing
AlertAiFormFields.component.test.tsx,keeps a typed search when the source search is rebuilt during the debounce. It types, rerenders with a newsourceSearch, and advances the debounce. Before the fix it fails with the onlysearchQuerycall beingquery: "", the same thing CI showed. Both alert suites now pass 50/50 (AlertAiFormFields.component.test.tsx,ClassicAlertRuleSection.test.tsx).PLAYWRIGHT_RETRIES=0:Flow/NotificationAlerts.spec.ts+Flow/ObservabilityAlerts.spec.ts: all 17 tests pass (the 4 webhook tests withPLAYWRIGHT_WEBHOOK_HOST=host.docker.internal).Multiple Filters Alertwith--repeat-each=3: 3/3 pass.Type of change:
Checklist:
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Keeps a pending alert argument search when search settings change.
Reviews (1) · Last reviewed commit: "chore(playwright): auto-refresh impact-m..." · Reviewed by Greptile