Skip to content

Fix the Versions rollback test and four other tests broken by partial state answers - #5321

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-5191
Nov 4, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-5191

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_a_failed_state_keeps_focus_in_the_open_versions_menu had two separate causes of failure, and this PR fixes both. Four other tests in test_render_pages.py had the second cause and now get past it too.

Neither change touches product code.

Verification

Run locally with uv run pytest:

Test Current main This branch
test_a_failed_state_keeps_focus_in_the_open_versions_menu fails at line 601 (Versions container inactive) passes
test_a_failed_agent_root_restores_the_focused_first_message_composer (2 cases) KeyError: 'browser', console wait times out passes
test_a_reply_notice_survives_a_failed_state_and_keeps_its_agent KeyError: 'browser' passes
test_a_failed_resolution_restores_a_focused_inline_reply, test_failed_resolve_candidate_restores_focused_reply KeyError: 'browser' get past the handler, then fail expecting Resolved where the page shows 1 new. That separate cause is tracked in #5128.

test_render_floating_panel.py's aged_state also rewrites a state answer (state["now"]). It doesn't index browser, and I didn't check whether a Tail carries now, so it is unchanged here.

Closes #5191 — automated triage

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
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

The red test job at b1f6884 fails only test_a_failed_resolution_restores_a_focused_inline_reply and test_failed_resolve_candidate_restores_focused_reply (2 failed, 2223 passed). On main they fail at the route handler with KeyError: 'browser'. On this branch they get past it and fail on expected to have text 'Resolved' / Actual value: 1 new, the same assertion and value as #5128's test_a_remote_resolve_disarms_the_open_reply_list_it_takes_away. This PR doesn't claim to fix them. The tests it does claim to fix pass in that job: the Versions rollback test, both cases of the agent-root composer test, and the reply-notice test.

@leaf-agent
leaf-agent merged commit 6f7aaaa into main Nov 4, 2026
5 of 6 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5191 branch November 4, 2026 09:01
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]>
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.

Resume the preserved Versions rollback focus test repair

1 participant