Skip to content

Wait for the accept to reach the log with round_trip, not a wait that returns at once - #158

Merged
max-sixty merged 1 commit into
mainfrom
fix/round-trip-before-reading-accept-log
Aug 31, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/round-trip-before-reading-accept-log

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_accepting_a_suggestion_settles_it_and_reaches_claude guarded its event-log read with a wait_for_function whose predicate fetched /api/state and returned a promise resolving to whether the log holds the accept. A falsy resolution ends that wait rather than polling again, so it returned False on the first poll and the read_events assertion under it ran unguarded — a wait that proves nothing, which is the class tests/CLAUDE.md opens on. This replaces it with round_trip(page), the boundary that file names for reading the log ("Read the event log only after round_trip"), and the one the module's other log reads already use.

Verified: tests/test_render_widgets.py green (65 passed), and the named test passes at -n0. Surfaced by the review on #154; it belongs here rather than in that diff.

The falsy-resolution semantics, measured

Not documented, so probed against the pinned Playwright (1.62.0) with the repo's own .venv:

pg.evaluate("() => { globalThis.flag = false; setTimeout(() => globalThis.flag = true, 800); }")
h = pg.wait_for_function("() => Promise.resolve().then(() => globalThis.flag)")
# elapsed 0.02s  value: False  flag now: False

The predicate's promise is awaited, but the wait returns on the first resolution whatever its truthiness — it raises nothing and does not poll again. The site here is the only one of this shape left in the suite: the harness's margins_laid_out wait resolves true explicitly (#154), and no other wait_for_function predicate in tests/ returns a promise.

… returns at once

The accept test read the event log behind a wait_for_function whose predicate returned a promise resolving to whether the log holds the accept. A falsy resolution ends that wait rather than polling again, so it returned False on the first poll and the read_events assertion under it ran unguarded. round_trip(page) is the boundary tests/CLAUDE.md names for reading the log, and is what the module's other log reads already use.
@max-sixty
max-sixty merged commit 053d6d5 into main Aug 31, 2026
3 checks passed
@max-sixty
max-sixty deleted the fix/round-trip-before-reading-accept-log branch August 31, 2026 05:01
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.

2 participants