Repository navigation
Wait out bookkeeping posts in round_trip - #1016
Conversation
`round_trip` judged a trip over when the outbox held no attempt, but a bookkeeping event such as `read` never enters the outbox (PR #987). So `sending` around a gesture whose own event is a read returned as soon as the read's POST was issued, and the log read behind it raced the server's append. That is how `test_opening_threads_acknowledges_the_first_visible_answer` failed once on PR #1010 with no read in the log. `round_trip` now also requires every issued post to have ended (`acked == sends`), through a `heard_back` predicate on one ledger reading. The outbox half still covers a failed post the page will retry. The read-state test now holds the read before the server appends it, so every run puts the log read on that edge; it asserts the ledger reads as not heard back while the read is on the wire, which the old predicate failed deterministically. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Three tests route /api/event into a list, inject a presentation failure, and continue only the first held request. The page reports that failure with its own `error` post, which the route also held and nobody released. `round_trip` now counts every post until it ends, so that stranded report made the final wait run out. Each test now continues every request it held. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The release loops read a list nothing has pinned yet. Each of the three repaired tests now needs every held /api/event request released, because round_trip no longer returns while a post is outstanding — but for route in held reads that list at a moment no stated fact covers. holding(page, held, 1, …) guarantees one entry, and the page issues two posts: the gesture's event and the page's own error report (measured on this head: ['action', 'error'] in both widget tests, ['resolve', 'error'] in the conversations one). The error report is issued a beat after the gesture and its route reaches the driver later still — the gap holding exists to close. If it lands after the loop, page.unroute leaves it paused for good, acked never reaches sends, and round_trip spends its whole 30s deadline and fails: the same load-dependent shape this PR removes. One holding call states the count instead of taking it as it comes.
The new contract names a narrower rule than the code. read is the only kind carrying "bookkeeping": true in registry.json's $events.kinds, and it is not the only post that skips the outbox — reportPageError reaches postEvent directly ("sent bare rather than through post()", in layer-client.js), and so does uploadMedia. All three count sends and acked, and none of them enters pending. The three tests this PR had to repair were broken by the error report rather than by a bookkeeping event, so a reader who follows tests/AGENTS.md or the traffic.js header to work out why their round_trip now hangs is sent looking for the wrong kind.
The change itself holds up: I ran the four touched tests against the merged tree and they pass, and test is green on this head.
The paint-failure tests now wait for both held requests before releasing them, and the round_trip contract names the error report and media uploads beside bookkeeping events. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
test_opening_threads_acknowledges_the_first_visible_answerfailed once on #1010's first CI attempt with noreadevent in the log. The cause is the harness wait, not the runtime.round_triptreated a trip as over once the outbox held no attempt. Some posts skip the outbox: a bookkeeping event such asread(#987,delivery.js), the page's ownerrorreport, and a media upload (layer-client.js). Sosendingaround a gesture whose event is a read returned as soon as the read's POST went out, and the log read behind it raced the server's append. Holding the read's POST for 300ms reproduces the CI failure every time (IndexErroron_read_events(...)[-1]). 80 copies under-n 12did not reproduce it on a Mac.round_tripalso requires every issued post to have ended (acked == sends), through aheard_backpredicate on one ledger reading. The outbox condition still covers a failed post that the page will retry.test_a_failed_ask_banner_paint…,test_a_failed_ask_list_paint…,test_a_failed_thread_list_update_retries…) held/api/eventand released only the first request. The page's ownerrorreport of the injected failure was also held and never ended. The stricterround_tripexposed this. Those tests now wait withholdingfor both requests, then release both.traffic.js's header, theround_tripcomment, andtests/AGENTS.mdnow describe the wait as both conditions and list the posts that skip the outbox.🤖 Generated with Claude Code