Repository navigation
test(ui): wait for bubblezone to settle before a test clicks - #30
Merged
Merged
Conversation
TestClickingCurrentKindLeavesDescribe fails now and then on main, with "mode = 1, want the table" (runs 42427888597 and 42428228663, one Go version each time): the sidebar click lands on another zone. bubblezone's Scan hands a frame's zones to a goroutine one at a time, in screen order, and then a marker that deletes the zones the frame does not draw. waitZone returns as soon as the zone it wants has a position, so the click can come while zones further down the frame, or zones an earlier test drew (TestMain makes one manager for the whole test binary), are still where they were, and handleMouse checks a dozen of them before the sidebar rows. clickZone now renders again through renderSettled, which plants a zone with a scan of its own and returns once the next frame's marker has deleted it: every zone of that frame is then in place, and no other is left. TestDoubleClickOpensRow, which clicks right after View(), uses it too. On one CPU, with another such run beside it, the internal/ui package failed this way 2 times in 150 runs before and 0 in 150 after. With bubblezone's worker slowed to 50us per zone, the test failed in 40 of 40 runs before and 0 of 40 after, and TestDoubleClickOpensRow in 40 of 40 before and 0 of 40 after. Signed-off-by: Adao Oliveira Jr <[email protected]>
pierreneter
approved these changes
Nov 8, 2026
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.
TestClickingCurrentKindLeavesDescribefailed onmainright after #20 and again after #21 merged (one Go version each time, "mode = 1, want the table"), though both pull requests passed. It is a race in the test helpers, not in either change.bubblezone's
Scanhands a frame's zones to a goroutine one at a time, in screen order, and then a marker that deletes the zones the frame does not draw.waitZonereturns as soon as the zone it wants has a position, so a click can come while zones further down the frame, or zones an earlier test drew (TestMainmakes one manager for the whole test binary), are still where they were.handleMousechecks about a dozen zones before the sidebar rows, and one of them takes the click.clickZonenow renders again throughrenderSettled, which plants a zone with a scan of its own and returns once the next frame's marker has deleted it, so every zone of that frame is in place and no other is left.TestDoubleClickOpensRow, which clicks right afterView(), uses it too.Measured in golang:1.27 containers, one CPU each:
internal/ui, 150 runs, with a second run beside itTestClickingCurrentKindLeavesDescribeTestDoubleClickOpensRowgofmt,
go vet ./...,go test -short ./...and the fullinternal/uitests pass on Go 1.26.10 and 1.27.3.Not covered here:
TestPluginConfirmationExecutesTheDisplayedVariableSnapshotfailed once in 150 runs in the same setup. It does not click; it polls a file that a backgroundshwrites, so it is a different race.