Bugfix/replacement bonus tracking - #408
Merged
alopezlago merged 2 commits intoAug 14, 2026
Merged
Conversation
A bonus thrown out while later cycles already have recorded gameplay is a protest resolution: the affected bonus should be replaced by a spare bonus from the end of the packet, and the bonuses already read to other teams must stay put. alopezlago#407 restricted useExplicitProtestReplacement to tossups, so bonuses in the protest scenario were recorded with an undefined (sequential) replacement index. getBonusIndex shifts every subsequent cycle by one for sequential throw-outs, re-pointing later cycles at a different packet bonus while their bonusAnswer conversions stayed on the cycle -- corrupting the recorded data. It also made the confirmation message ("replaced with bonus N") contradict the actual sequential replacement. Dropping the questionType check restores the pre-alopezlago#407 behavior for bonuses: explicit replacement with the packet's last bonus, no downstream shift, and a message that matches what happens. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rewrites the two tests that encoded the alopezlago#407 behavior (bonus + later gameplay -> sequential shift) to assert the corrected protest behavior instead: - ThrowOutQuestionMessageTests: a bonus with recorded gameplay afterward now returns an explicit last-bonus replacement, and the confirmation message matches the bonus it names. - BonusQuestionControllerTests: a protest bonus throw-out records an explicit replacementQuestionIndex and leaves a later cycle's bonus index unchanged, guarding against the conversion-data corruption from the sequential shift. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
alopezlago
reviewed
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found a bug while evaluating PR #407.
Under the "protest" scenario (gameplay recorded after the bonus being thrown out), the bonus replacement is supposed to be explicit and non-shifting. Instead, MODAQ moves all subsequent bonuses up by one, even though the dialog names the last bonus in the packet as the replacement. This is not desired: the replacement bonus may be one teams already heard, and, more importantly, existing bonus points for later cycles become attached to the wrong bonus.
The cause is that #407 narrowed useExplicitProtestReplacement in ThrowOutQuestionMessage.ts to require questionType to be tossup, excluding bonuses. I dropped that requirement, which fixes the problem, and adjusted a couple of tests to monitor the corrected behavior.