[18India] Fix connection bonus fires on visited but unpaid cities#12712
Open
ddaybell wants to merge 1 commit into
Open
[18India] Fix connection bonus fires on visited but unpaid cities#12712ddaybell wants to merge 1 commit into
ddaybell wants to merge 1 commit into
Conversation
… trains) connection_bonus was using route.visited_stops instead of the paid stops argument, causing the R+ route bonus to fire when both endpoint cities were merely visited rather than counted among the train's paid cities. A 4E train visiting Karachi and Chennai but only paying for 4 other cities would incorrectly receive the R+80 bonus. Fixes tobymao#11512 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
perwestling
previously approved these changes
Jun 14, 2026
perwestling
left a comment
Collaborator
There was a problem hiding this comment.
PR Review: #12712 - [18India] Fix connection bonus fires on visited but unpaid cities
Reviewed with AI assistance by Mistral Vibe
✅ Strengths
- Fixes documented bug (#11512)
- Minimal, surgical change (2 lines)
- Correct root cause: was using
route.visited_stopsinstead of paidstops - All 18India fixtures pass (43/43)
💡 Strong Recommendation
Since 18India has existing fixtures, please add a test case for this fix. State-based fixture preferred, but a unit test for the connection_bonus method is also acceptable.
✅ Verdict: Approve
The fix is correct. Adding a test is strongly recommended but not blocking.
| def connection_bonus(route, _stops) | ||
| visited_location_names = route.visited_stops.map { |stop| stop.tile.location_name }.compact | ||
| def connection_bonus(_route, stops) | ||
| visited_location_names = stops.map { |stop| stop.tile.location_name }.compact |
Collaborator
There was a problem hiding this comment.
Strongly recommend: Add state-based fixture test
Since 18India has existing fixtures, please add a test case that:
- Runs a 4E train that visits but does not pay for both cities of a bonus pair
- Confirms R+ does not appear
- Runs a 4E that pays for both cities
- Confirms R+ appears
Alternative: If setting up the game state is complex, a unit test for connection_bonus method verifying it uses the stops parameter (not route.visited_stops) would also work.
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.
Summary
connection_bonuswas usingroute.visited_stopsinstead of thestops(paid stops) argumentFixes #11512
This will very likely require pinning games, as it changes the amounts awarded for many E train runs.
Test plan