Repository navigation
Read a fresh tree on every poll of wait, waitUntil, scrollUntil and stable - #162
Merged
Merged
Conversation
bitomule
force-pushed
the
worktree-t-mav-148-wait-cached-tree
branch
from
December 2, 2026 23:49
8d8a492 to
0734130
Compare
bitomule
force-pushed
the
worktree-t-mav-148-wait-cached-tree
branch
2 times, most recently
from
December 3, 2026 10:03
42087f7 to
9f09d1b
Compare
bitomule
force-pushed
the
worktree-t-mav-148-wait-cached-tree
branch
from
December 3, 2026 10:43
9f09d1b to
9ba5362
Compare
…table Inside a run the tree cache is only dirtied on the way into and out of a step, so a polling step kept being handed the tree its first poll stored until it timed out. Invalidate between polls (never before the first one, so a passing assert still reuses the cached tree). Fixes #148
bitomule
force-pushed
the
worktree-t-mav-148-wait-cached-tree
branch
from
December 3, 2026 10:46
9ba5362 to
db53096
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.
Fixes #148.
Problem
Inside
mav runthe tree cache is only invalidated on the way into and out of a step. A polling step (wait,waitUntil,assert) polls many times inside one step, so after its first poll stored a tree every later poll got that same tree back until the timeout, even though the screen had changed.Change
treeCache.freshPoll()(an invalidate under the name of the reason), called between polls inwaitForConditionSet(coverswait,waitUntil,assert), after each swipe inscrollUntil, between iterations ofwhileNotVisible, and between the two reads of astablecondition (two reads of one cache entry were equal by construction, so every screen was "stable").assertstill reuses the tree a previous read-only step left (covered by a test).tree_cache.go, one-line calls incli.go, tests in a new file.Tests (new
flow_poll_fresh_test.go)Without the fix, on a fake driver whose tree changes on the second read:
TestWaitUntilSeesAChangeThatArrivesAfterTheFirstPoll: FAIL (wait_timeout)TestWaitAfterAFailedPollReadsAgain: FAIL (wait_timeout)TestStableConditionComparesTwoRealReads: FAIL (declared stable)TestScrollUntilReadsAFreshTreeAfterEachSwipe: FAIL (scroll_until_timeout)TestAFirstPollStillUsesTheCachedTree: passes before and after (guard against over-invalidating)With the fix, all pass, and
go test ./...is green.whileNotVisiblegot the same one-line invalidation but has no dedicated test: its children normally dirty the cache themselves, so the stale case needs a read-only child.