Skip to content

Bugfix/replacement bonus tracking - #408

Merged
alopezlago merged 2 commits into
alopezlago:masterfrom
victorprieto2265:bugfix/replacement-bonus-tracking
Aug 14, 2026
Merged

Bugfix/replacement bonus tracking#408
alopezlago merged 2 commits into
alopezlago:masterfrom
victorprieto2265:bugfix/replacement-bonus-tracking

Conversation

@victorprieto2265

Copy link
Copy Markdown
Contributor

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.

victorprieto2265 and others added 2 commits August 10, 2026 21:23
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>
Comment thread tests/unit/BonusQuestionControllerTests.ts
@alopezlago
alopezlago merged commit b3f13f7 into alopezlago:master Aug 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants