Repository navigation
Conversation
selection_mode has been stored, normalized and published since the feature landed, and nothing has ever read it. A "vote" room behaved exactly like a host_pick one: members could suggest and vote, the tally was recorded and broadcast, and then the host promoted whatever they liked regardless of it. In a vote room the host now starts the winner rather than choosing it. Promoting anything other than the leading suggestion is refused, because being able to overrule the tally makes the mode host_pick with extra steps and turns the vote counts on everyone else's screen into decoration. The winner is the head of the repository's existing ordering (vote_count DESC, created_at ASC): most votes, ties to whoever suggested first — deterministic, and re-suggesting a title cannot jump the queue. A room where nobody has voted has no winner and says so, rather than quietly promoting the oldest suggestion as though a vote had happened. host_pick rooms are untouched: the host still promotes freely. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Db4dSxN9tH8yN7uUP549tK
Gating PromoteSuggestion left SelectItem wide open: it is host-only but was not gated by selection mode, so the host of a vote room could set any title directly and bypass the vote entirely. Enforcing the tally on one path and not the other makes the vote counts on everyone else's screen decoration. A vote room now refuses a direct selection outright. The winner is the only way in. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Db4dSxN9tH8yN7uUP549tK
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughVote-mode winner selection now returns a dedicated no-vote error, computes the ordered winner, tests tie and no-vote behavior, and maps the error to an HTTP 409 response. ChangesVote winner selection
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/watchtogether/service.go`:
- Around line 1910-1912: The winner-promotion path in
VoteWinner/HandlePromoteSuggestion must not call the public SelectItem method,
because its vote-room guard rejects every promotion. After validating the
winning suggestion, route promotion through a private selection-finalization
method that bypasses the direct-selection guard, while preserving SelectItem’s
existing protection; add a regression test confirming promotion of the current
winner succeeds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: be689586-5748-4cdc-863e-d1ef435b4378
📒 Files selected for processing (3)
internal/api/handlers/watch_together.gointernal/watchtogether/service.gointernal/watchtogether/vote_winner_test.go
| return s.SelectItem(ctx, roomID, userID, profileID, SelectItemInput{ | ||
| ContentID: suggestion.ContentID, | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Winner promotion is unconditionally rejected.
VoteWinner can successfully return the requested suggestion, but this then calls SelectItem, whose new vote-mode guard returns ErrVoteRoomSelection for every vote room. Consequently, no vote-room suggestion can be promoted; HandlePromoteSuggestion falls through to a 500 for this unexpected error. Route promotion through a private selection-finalization method after winner validation, while retaining the public direct-selection guard. Add a regression test that promoting the current winner succeeds.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/watchtogether/service.go` around lines 1910 - 1912, The
winner-promotion path in VoteWinner/HandlePromoteSuggestion must not call the
public SelectItem method, because its vote-room guard rejects every promotion.
After validating the winning suggestion, route promotion through a private
selection-finalization method that bypasses the direct-selection guard, while
preserving SelectItem’s existing protection; add a regression test confirming
promotion of the current winner succeeds.
Reverses the winner-only restriction. The tally is advisory now: the host may promote any suggestion, and may set the room's selection directly. Both gates go — promotion and the raw selection path — because leaving either one would produce a room where the host can override through one door and not the other, which is harder to explain than either rule on its own. VoteWinner stays and keeps its tests. It is still the room's answer, and both clients use it for the WINNING badge and the one-press "Start winner" action; it simply no longer binds the host. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Db4dSxN9tH8yN7uUP549tK
|
Semantics changed on review of the actual UX: the host can now override the vote. The original rule here was that the host starts the winner but cannot choose something else — the reasoning being that a host who can ignore the tally makes the vote decoration. On reflection that is too rigid for a living room: the person hosting is usually the one holding the remote, and a room can perfectly well vote and then have someone say "actually, let's watch the other one". So the tally is advisory now. Concretely, on top of the two commits already here:
I removed both gates rather than one, because leaving either would produce a room where the host can override through one door and not the other — harder to explain than either rule on its own.
Client side follows in Silo-Server/silo-android#106 — the per-row "Pick" returns in vote rooms, where it had been hidden precisely because the server used to refuse it. Note this also makes the PR title slightly overstated: vote rooms do now vote, and the tally drives the default action, but it is a recommendation rather than a constraint. |
|
Closing because this branch has been superseded by the binding vote-room implementation now on main. The final commit changes the semantics to advisory voting with a host override, while the PR title and body still describe winner-only enforcement; resolving the conflicts would therefore silently reverse the current behavior. If advisory voting is still desired, please open a fresh, focused PR against current main with the updated rationale and tests. Thanks for the work here. |
Problem
selection_modehas been stored, normalized and published on every room snapshot since Watch Together landed, and nothing has ever read it. Avoteroom behaved exactly like ahost_pickone: members could suggest and vote, the tally was recorded and broadcast to everyone, and then the host promoted whatever they liked regardless of it.So the mode was a label on an unimplemented feature, and the vote counts on everyone's screen were decoration.
What a vote room does now
The host starts the winner rather than choosing it. Promoting anything other than the leading suggestion is refused (
409 not_vote_winner), because a host who can overrule the tally makes the mode host_pick with extra steps.The winner is the head of the repository's existing ordering —
vote_count DESC, created_at ASC. Most votes; ties to whoever suggested first. Deterministic, and re-suggesting a title cannot jump the queue.A room where nobody has voted has no winner and says so (
409 no_votes_cast), rather than quietly promoting the oldest suggestion as though a vote had happened.host_pickrooms are untouched: the host still promotes freely.Both doors, not one
PromoteSuggestionis not the only way into a room's selection.SelectItem(PUT /rooms/{room_id}/selection) is host-only but was not gated by mode at all, so a host could set any title directly and bypass the vote entirely. Enforcing the tally on one path and not the other is the same as not enforcing it. A vote room now refuses a direct selection (409 vote_room_selection).I got this wrong in the first commit here and caught it while working through the host's options — worth a look in review, since "is that every path into this state?" is exactly the question this change lives or dies on.
Testing
The winner rule is split out from the database (
winnerFrom) and unit tested: most-voted wins, ties go to the earlier suggestion, and an unvoted room yieldsErrNoVotesCastrather than a default.internal/watchtogetherandinternal/api/handlersgreen;make lintclean for the touched files.Running on my server. Not yet exercised with real participants — the rule has tests on both sides, but nobody has had two devices in a room voting against each other.
Client side
Silo-Server/silo-android#106 carries the client half: hosting offers a vote room, the lobby marks the leader WINNING, and the host gets a single "Start winner" action. The client mirrors this winner rule exactly so its idea of who is leading cannot drift from the server's.
Note the clients also had to stop pre-selecting a title when creating a vote room — doing so set the room playing immediately and the vote never happened.
AI-use disclosure
Written by Claude Opus 5 (Claude Code) working with @RXWatcher, who specified the semantics (anyone suggests and votes, host starts the winner, host cannot override) and whose question about the host's options surfaced the
SelectItemgap.Summary by CodeRabbit
New Features
Bug Fixes
Tests