Repository navigation
Fix the Versions rollback test and four other tests broken by partial state answers - #5321
Merged
Merged
Conversation
The keyboard route now focuses the first version as chosen in #5039. Remove the stale container-focus expectation and extra ArrowDown so this test reaches its failed-state rollback assertion while keeping the focused row guarantee.
Since #5307 a tab names the reading it holds in `Leaf-Held-Basis` and the server answers with a `Tail`, a patch with no `browser.views`. Five tests in test_render_pages.py corrupt a state answer by appending to a view's projection entries, so each handler raised `KeyError: 'browser'` and the page never logged the "read failed" the test waited for. They now fetch through `fetch_whole_state`, which drops the header so the server answers whole, and the corrupted reading reaches the page as before. Closes #5191
Collaborator
Author
|
The red |
This was referenced Nov 4, 2026
This was referenced Nov 4, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 5, 2026
…#5307 broke (#5520) Six browser tests have failed on main since #5307 (`5423c8110`). None of them caught a regression; each still expected the server's old answer shape. #5307 meant for a tab that names its held reading in `Leaf-Held-Basis` to receive only a patch against it (`served_state.tail`), and for event answers to go out through `_json_body` rather than `_json`. This PR keeps both of those and updates the tests. - Five tests read `reading` or `taken` straight off an event or state answer. That answer is now a patch, so their route handler raised `KeyError` and never fulfilled the request. The tests then waited out a console message that never came, or hit `KeyError: 'taken'`. They now fetch through the harness's existing `fetch_whole_state`, which drops `Leaf-Held-Basis` so the server answers whole. #5321 used the same fix for the tests #5307's predecessor broke. The helper now also passes `Route.fetch` overrides, which the read-state test needs for its rewritten `post_data`. One outbox test had inlined the same header strip, and it now calls the helper too. - `test_a_reload_mid_flight_never_wedges_round_trip` held the first event answer by patching `PageEndpoint._json`, which that answer no longer passes through. It now patches `_json_body`. No product code changes. With `uv run pytest --run-main`, each of the six fails on `be273426d` and passes on this branch, along with `test_undo_waits_while_the_candidate_is_applying_then_reads_accepted_truth`, which now uses the helper. The read-state and undo tests also pass after rebasing onto `a6fefaa77`. Closes #5477 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
test_a_failed_state_keeps_focus_in_the_open_versions_menuhad two separate causes of failure, and this PR fixes both. Four other tests intest_render_pages.pyhad the second cause and now get past it too.g Shift+Vnow focuses the Versions view's first version, as Open threads in the panel on a phone, and seven more thread-surface fixes from a Firefox pass #5039 made every view a key opens do ("the Versions view's tests expectedg Vfrom the page to focus the view, and now expect its first version"). The test still expected the container to take focus and then pressed ArrowDown, so it failed at line 601. This takes the prior session's preserved commit fromfix/versions-rollback-focus: it removes those two lines and keeps the check that the focused row survives the failed reading.Leaf-Held-Basis, and the server replies with aTailpatch instead of the whole reading. The tests that corrupt a state answer append tostate["browser"]["views"][…]["document"]["projection"]["entries"], which aTaildoesn't have. Each handler raisedKeyError: 'browser', so the page never logged the "read failed" the test waits for. The newfetch_whole_statehelper intests/render_harness.pydrops that header, so the server sends the whole reading and the handler can corrupt it as before. All five handlers now use it.Neither change touches product code.
Verification
Run locally with
uv run pytest:maintest_a_failed_state_keeps_focus_in_the_open_versions_menutest_a_failed_agent_root_restores_the_focused_first_message_composer(2 cases)KeyError: 'browser', console wait times outtest_a_reply_notice_survives_a_failed_state_and_keeps_its_agentKeyError: 'browser'test_a_failed_resolution_restores_a_focused_inline_reply,test_failed_resolve_candidate_restores_focused_replyKeyError: 'browser'Resolvedwhere the page shows1 new. That separate cause is tracked in #5128.test_render_floating_panel.py'saged_statealso rewrites a state answer (state["now"]). It doesn't indexbrowser, and I didn't check whether aTailcarriesnow, so it is unchanged here.Closes #5191 — automated triage