Repository navigation
Commit 053d6d5
authored
Wait for the accept to reach the log with round_trip, not a wait that returns at once (#158)
`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.
<details><summary>The falsy-resolution semantics, measured</summary>
Not documented, so probed against the pinned Playwright (1.62.0) with
the repo's own `.venv`:
```python
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.
</details>
Co-authored-by: leaf-agent <[email protected]>1 parent 8bf0a0b commit 053d6d5
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1362 | 1362 | | |
1363 | 1363 | | |
1364 | 1364 | | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
1369 | 1371 | | |
1370 | 1372 | | |
1371 | 1373 | | |
| |||
0 commit comments