playwright: fix wait_for_hover false-pass on missing widget + cover both #186 sync primitives#187
Merged
Merged
Conversation
…oth #186 primitives Copilot review on PR #186: - wait_for_hover(ident, expected=false) false-passed when the widget was missing or had no `hover` field: the predicate `find_widget(...)?["hover"] ?? false == expected` coalesced a null hover to false, so a typo'd / unregistered ident read as a successful "not hovered" and masked a real sync failure. Guard with widget_exists (the same load-bearing check widget_rendered uses for the identical daslib/json ?[] quirk): the widget must actually be present before its hover state is compared. - Add tests/integration/test_recording_sync.das covering both primitives #186 added (no dasImgui-side test exercised either): wait_for_hover registers on move-onto / clears on move-away / does NOT false-pass a missing ident (the regression above), and record_check returns its `ok` and accumulates-without-panicking on false (the teardown-panic surfacing is exercised transitively by the record_* driver suite). Verified: test_recording_sync green headless; lint + format clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a correctness edge case in imgui_playwright.wait_for_hover(expected=false) where a missing/misspelled widget ident could incorrectly “pass” as “not hovered”, and adds an integration test covering both wait_for_hover and record_check (introduced in #186).
Changes:
- Fix
wait_for_hover(..., expected=false)to requirewidget_exists(...)before comparing hover state, preventing false positives on missing widgets. - Add
tests/integration/test_recording_sync.dasto exercisewait_for_hover(hover set/clear + missing-ident regression) andrecord_check’s return behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
widgets/imgui_playwright.das |
Adds a widget_exists guard inside wait_for_hover to avoid false-passing on missing widget idents. |
tests/integration/test_recording_sync.das |
New integration test covering wait_for_hover hover transitions and the missing-ident regression, plus basic record_check behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot review on PR #187: the negative-case regression check waited out a full 2s every run (the widget is guaranteed missing, so it always times out). A tiny timeout still separates the two implementations — the old false-pass returned non-null on the first poll, the fixed version times out — without spending the wall-clock. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Follow-up to the #186 Copilot review — a real correctness fix plus the regression coverage it asked for.
Fix —
wait_for_hover(expected=false)false-pass (#186 review)wait_for_hover(ident, expected=false)returned the first snapshot when the widget was missing or had nohoverfield: the predicatefind_widget(...)?["hover"] ?? false == expectedcoalesces a null hover tofalse, so a typo'd / unregistered ident reads as a successful "not hovered" and masks a real sync failure.Guard with
widget_exists— the same load-bearing checkwidget_renderedalready uses for the identical daslib/json?[]quirk (find_widget(...) != nullis unreliable there; only a non-emptykindproves a real entry). The widget must actually be present before its hover state is compared:Same false-positive discipline as
widget_rendered/wait_for_series_shown. Onlyexpected=falseon a missing ident changes behavior (now times out →null→ loud failure, instead of an immediate false pass); no existing caller relied on the old path.Coverage —
tests/integration/test_recording_sync.das(#186 review)No dasImgui-side test exercised either primitive #186 added. New test (one app spawn,
color_button_hoverfeature — CBH_RED carries the per-widgetIsItemHoveredtelemetry):wait_for_hover: registers hover aftermove_toonto the swatch; clears after moving away (expected=falseon a present widget); does NOT false-pass a missing ident (the regression above).record_check: returns itsokargument, and accumulates without panicking onfalse— the accumulate-don't-panic discipline. (The teardown-panic surfacing is exercised transitively by everyrecord_*driver in the suite, which all share theg_record_failures→with_recording_appteardown path.)Verification (local)
test_recording_syncgreen headless.🤖 Generated with Claude Code