Repository navigation
Fix flaky test_single_query_terminated_with_semicolon - #1175
Merged
Merged
Conversation
Owner
Author
|
Generated by Claude Code |
The test focused the editor as soon as a results table was mounted, while load_tables was still running; its later results_viewer.focus() took focus back, so the next ctrl+j landed on the Results Viewer and submitted nothing. Add wait_for_results, which waits for ResultsFetched and for the Results Viewer to stop loading, and use it wherever the test moves focus or reads tab_count after a query. test_multiple_queries had the same pattern. Closes #1174 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016SvJmAXqxMtxPYcygLwinH
tconbeer
force-pushed
the
claude/affectionate-clarke-n4i88p
branch
from
October 1, 2026 19:29
7085322 to
fb03fb4
Compare
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.
Closes #1174
What are the key elements of this solution?
test_single_query_terminated_with_semicolon[sqlite]failed all three Windows retries in this run. The test focused the editor as soon as a results table was mounted. At that pointHarlequin.load_tablescould still be running, and its trailingresults_viewer.focus()took focus back. The nextctrl+jthen went to the Results Viewer, which doesn't bind it, so no secondQuerySubmittedwas posted.wait_for_results(pilot, app, messages, count=n)totests/functional_tests/helpers.py. It waits for the n-thResultsFetched, then waits forresults_viewer.loadingto clear. The message hook fires before the handler runs, andloadingclears in the same synchronous tail ofload_tablesthat moves focus to the Results Viewer.test_single_query_terminated_with_semicolon, uses it in place ofwait_for_any_tableand the twowait_for_workerscalls. The test readstab_countand moves focus right after those waits.test_multiple_queries, which has the same wait →editor.focus()→ctrl+jpattern.Why did you design your solution this way? Did you assess any alternatives? Are there tradeoffs?
It waits on the condition the test actually depends on, rather than a sleep or retry, per
tests/waiting.py's conventions. I reproduced the race locally by injecting a 0.3s delay beforeResultsFetchedis posted and a 0.5s delay afteradd_paneinpush_table. With those delays the old test failed every run with the CI error (timed out … waiting for 2 QuerySubmitted messages, saw 1), and the new test passed every run. The delays were not committed.test_multiple_queriesdidn't fail under those delays, so that change is preventive.Does this PR require a change to Harlequin's docs?
Did you add or update tests for this change?
Please complete the following checklist:
CHANGELOG.md, under the[Unreleased]section heading. That entry references the issue closed by this PR. — Not added: test-only change, nothing user-facing.Locally:
pytest -m "not online"2131 passed; ruff, mypy, and lint-imports clean.🤖 Generated with Claude Code
https://claude.ai/code/session_016SvJmAXqxMtxPYcygLwinH
Generated by Claude Code