From b469c47c366e0a5bd92fde2f99499419699bbace Mon Sep 17 00:00:00 2001 From: Patrick Lacey Date: Thu, 6 Aug 2026 00:01:27 -0400 Subject: [PATCH] fix(voting): clear submission state on vote reset --- arena/state/voting.py | 3 +++ tests/unit/state/test_voting.py | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/arena/state/voting.py b/arena/state/voting.py index 8f58fec..4d75b9c 100644 --- a/arena/state/voting.py +++ b/arena/state/voting.py @@ -238,5 +238,8 @@ def reset_vote(round_state: dict[str, Any] | None): "second_choice": None, "third_choice": None, "vote_stage": "pick_first", + "log_warning": None, + "submission_status": None, + "submission_message": None, } return updated_state, *_vote_ui_updates(updated_state) diff --git a/tests/unit/state/test_voting.py b/tests/unit/state/test_voting.py index 100d1ac..ea4c156 100644 --- a/tests/unit/state/test_voting.py +++ b/tests/unit/state/test_voting.py @@ -71,3 +71,27 @@ def test_reset_vote_clears_rankings_for_active_round() -> None: assert updated_state["second_choice"] is None assert updated_state["third_choice"] is None assert updated_state["vote_stage"] == "pick_first" + + +def test_reset_vote_clears_failed_submission_status_banner() -> None: + state = { + "round_id": "round-1", + "ready_for_vote": True, + "submitted": False, + "first_choice": "Response A", + "second_choice": "Response B", + "third_choice": "Response C", + "vote_stage": "ready_submit", + "log_warning": "disk full", + "submission_status": "error", + "submission_message": "Vote could not be saved: disk full", + } + + updated_state, *updates = reset_vote(state) + status_update = updates[-1] + + assert updated_state["log_warning"] is None + assert updated_state["submission_status"] is None + assert updated_state["submission_message"] is None + assert status_update.visible is False + assert status_update.value == ""