Enable viewing other players' Yahtzee scoresheets#243
Conversation
|
Review generated by Claude (Anthropic's coding assistant), posted at the repo owner's request. Thanks for this — being able to inspect any player's sheet is a nice quality-of-life win for Yahtzee. Claude tested the PR end-to-end (real A few things worth discussing. UX concernCommon case is now slower. Pressing
Worth picking one before merging. Picker also blocks all other keybinds while open. Pre-existing behavior — Code-quality issues1. def _handle_transient_display_selection(self, player, selection_id):
super()._handle_transient_display_selection(player, selection_id)
state = self._get_transient_display_state(player)
if not state:
return
if state.kind == "scoresheet_player_select":
...This works today only because the base implementation doesn't mutate state for unknown kinds. If anyone later adds a new kind to the base that does mutate state, the override will dispatch on the wrong state. The robust pattern is to check kind first, handle locally, and delegate to super for unknown kinds: state = self._get_transient_display_state(player)
if state and state.kind == "scoresheet_player_select":
self._close_transient_display(player)
target = self.get_player_by_id(selection_id)
if target:
self._show_player_scoresheet(player, target)
return
super()._handle_transient_display_selection(player, selection_id)2. Brittle blind cast ( 3. 4. 5. Trailing whitespace at lines 554 and 632. Smaller observations6. Spectators still can't view scoresheets. The TestingThe PR description describes manual testing only. Claude wrote 8 targeted tests in |
|
Done.
|
What the code actually does
Test results
Issues1. PR description contradicts the implementationThe summary says "Modified 2. No tests added70 lines of new behavior, zero test coverage. Per 3. Localization gaps
4. Two chord keybinds for one feature is overheadFor screen-reader users, fewer chords is better. The single-keybind design implied by the PR description (one RecommendationPick one design and align code, description, and tests:
Either way, please add tests covering the picker flow, the spectator path, and the Back item. |
|
I can't work with this anymore. Claude just confuses the hell out of me and is wasting my time at this point. It suggested separate keybinds for viewing your own sheet vs getting a list of players to view their sheets which I did implement, and it was a good idea actually. One I should've done from the start. It's also confusing the testing notes that I wrote when I first submitted the PR vs the comments which cover the current progress. Other than that, I should've added tests for sure, but I honestly can't work with this at this point. I won't close the PR from my end, but I won't be updating it either |
|
That is understandable. I’ll see how much I can understand of this manually, and get input from Rory. I’ll ask claude to look at it as a last resort. But it has definitely messed up here. |
|
I've taken some time away from the project since this situation occurred. I blindly followed what claude was saying, and that is entirely on me for causing your frustration. I won't hide the fact that I don't know what I'm doing, but the worst thing that I can do is give up. Mohammad — an apology owed, from both Claude and me. Looking back at the two reviews together:
My piece in this: I posted both reviews without checking whether they were internally consistent before they reached you. I should have caught the flip and the unsubstantiated screen-reader claim before they went out. I'm sorry — that's on me, not on you. The current implementation is the design Claude's first review endorsed. The second review's keybind-design pushback is withdrawn; what you shipped stays. The cleanup is mine, not yours. I'll push a follow-up commit to your branch covering: updated PR description, localized |
|
It's alright. Most of us use AI. I didn't know that Claude is that bad at code review though. Anyways, yeah feel free to go with those changes. |
The view_all_scoresheets action is Visibility.HIDDEN, so its label is never rendered to players, which means yahtzee-check-all-scoresheets had no live consumer. Drop the entry and point the action's label at the existing yahtzee-check-scoresheet key so the resolution still succeeds. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers the dual-keybind layout introduced in PR XGDevGroup#243: - c shows the active player's own scoresheet directly - shift+c opens the player picker (scoresheet_player_select) - Picker excludes spectators and ends with a Back item - Selecting a player renders their sheet via status_box - Back closes the picker without opening a sheet - Spectators pressing c fall back to the picker - Empty active-players list and stale selection IDs both speak "Player not found." rather than silently dropping the action - Re-pressing shift+c while a sheet is open reopens the picker Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Lets a Yahtzee player view any other active player's scoresheet without leaving the game. Adds a separate keybind for the picker so the common case (viewing your own sheet) stays a single keystroke.
Keybind layout
c— show your own scoresheet immediately (active players). Spectators have no own sheet, socfalls back to the picker.shift+c— open a transient player picker listing every active player + Back; selecting a player renders their scoresheet.d(view dice),c, andshift+care all nowinclude_spectators=True, so spectators can inspect dice and scoresheets too.Code changes
_action_view_all_scoresheetsthat opens thescoresheet_player_selecttransient display with the active players + Back._show_player_scoresheethelper that renders a target player's sheet to the viewer (viewer's locale, target's data)._action_view_scoresheet(own sheet) now routes spectators to the picker._handle_transient_display_selectionhandlesscoresheet_player_selectlocally before delegating to the base class (kind-first dispatch, not super-then-state).yahtzee-check-all-scoresheets; theview_all_scoresheetsaction is hidden, so its label is never rendered.Tests
server/tests/test_yahtzee_scoresheet_select.py(9 tests):con an active player shows their own scoresheet directly (not the picker).shift+copens the picker with all active players + Back item.status_box.cfalls back to the picker.shift+cwhile a sheet is open reopens the picker.Testing notes
uv run pytest tests/test_yahtzee.py tests/test_yahtzee_scoresheet_select.pyuv run cli.py simulate yahtzee --bots 3 --validate-keybinds