Skip to content

Fix TomSelect test helper flake: search queries that can never match - #2874

Merged
mroderick merged 2 commits into
masterfrom
fix/tomselect-search-retry
Sep 13, 2026
Merged

mroderick merged 2 commits into
masterfrom
fix/tomselect-search-retry

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Summary

Fixes the recurring CI flake where select_from_tom_select fails with expected to find css ".ts-dropdown .option" but there were no matches (e.g. CI on #2851, previously #2740, #2803).

Root cause

Two problems compound:

  1. Queries that can never match. Member#full_name includes pronouns ("Jane Doe (she/her)"), and the helper typed it into TomSelect. /admin/members/search only matches CONCAT(name, ' ', surname) and email, so any query containing the pronoun suffix returns no members. Verified by dumping TomSelect state at failure: inputValue: "Ezequiel Bernier (she/her)", dropdown renders "No members found" despite the fetch succeeding.
  2. Poisoned query cache. TomSelect caches loads per query (loadedSearches in the vendored tom-select.complete.min.js), so once a query fails or returns empty, that exact query never re-fires. The old helper's 15-second wait could never recover from one bad fetch.

Fix

  • Strip the parenthetical from the display name before typing, so queries match what the server searches.
  • Wait briefly (5s) for the 3-character results; if none appear, retype the full name as a fresh query — a new cache key forces a new fetch — instead of waiting it out.
  • Added a regression scenario in managing_meeting_invitations_spec.rb that aborts the first search request via Playwright route interception, deterministically exercising the retry path.

Testing

  • New regression scenario fails on the old helper, passes with the fix.
  • parallel_rspec spec/ -n 6: 1342 examples, 0 failures.
  • Affected specs (managing_meeting_invitations_spec.rb, meeting_spec.rb) run 5× clean.

mroderick and others added 2 commits September 13, 2026 12:58
The helper typed member.full_name into TomSelect, but full_name includes
pronouns — "Jane Doe (she/her)" — while /admin/members/search only matches
CONCAT(name, ' ', surname) and email. Queries containing the pronoun
suffix matched nothing server-side, and TomSelect caches loads per query
(loadedSearches), so an empty or failed fetch poisoned that query string
permanently: options never appeared and the 15s wait could not recover.

Type a pronoun-free query, wait briefly for the 3-character results, and
if none appear retype the full name as a fresh query (new cache key, new
fetch). Adds a regression scenario that aborts the first search request
via Playwright routing to exercise the retry deterministically.
@mroderick
mroderick marked this pull request as ready for review September 13, 2026 12:12
@mroderick
mroderick merged commit 7f07f03 into master Sep 13, 2026
10 checks passed
@mroderick
mroderick deleted the fix/tomselect-search-retry branch September 13, 2026 12:23
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