[READY][Gameplay] #310 Host transition idempotency and error catalog for scoreboard -> next round / finish #320

Merged
agw merged 45 commits from dev/issue-310-host-transition-idempotency-v2 into main 2026-03-18 06:52:04 +01:00
Showing only changes of commit 702f130de2 - Show all commits

View File

@@ -107,6 +107,30 @@ class LobbyGameplayExtractionTests(TestCase):
self.assertNotIn("build_reveal_scoreboard_response", source) self.assertNotIn("build_reveal_scoreboard_response", source)
self.assertNotIn("build_scoreboard_phase_event", source) self.assertNotIn("build_scoreboard_phase_event", source)
def test_issue_310_transition_views_keep_gameplay_logic_out_of_lobby(self):
transition_sources = {
"reveal_scoreboard": inspect.getsource(inspect.unwrap(lobby_views.reveal_scoreboard)),
"start_next_round": inspect.getsource(inspect.unwrap(lobby_views.start_next_round)),
"finish_game": inspect.getsource(inspect.unwrap(lobby_views.finish_game)),
}
forbidden_snippets = (
"select_round_question(",
"reset_round_question_bootstrap_state(",
"build_start_next_round_response(",
"build_start_next_round_phase_event(",
"build_finish_game_response(",
"build_finish_game_phase_event(",
"build_reveal_scoreboard_response(",
"build_scoreboard_phase_event(",
"ScoreEvent.objects.filter(",
"Player.objects.filter(",
)
for view_name, source in transition_sources.items():
for snippet in forbidden_snippets:
self.assertNotIn(snippet, source, msg=f"{view_name} leaked gameplay snippet: {snippet}")
def test_session_detail_view_source_stays_http_thin(self): def test_session_detail_view_source_stays_http_thin(self):
source = inspect.getsource(inspect.unwrap(lobby_views.session_detail)) source = inspect.getsource(inspect.unwrap(lobby_views.session_detail))