From b0d79ef7efc51e358707696d15627f2f7b18b17c Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 14 Nov 2025 15:09:03 -0600 Subject: [PATCH] CLAUDE: Fix squeeze_bunt validation - remove bases loaded restriction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed the incorrect restriction that squeeze bunt cannot be used with bases loaded. The only requirements for squeeze bunt are: - Runner on third base - Not with 2 outs Updated validator and test to reflect correct rule. Test results: 739/739 passing (100%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/app/core/validators.py | 4 +--- backend/tests/unit/core/test_validators.py | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/backend/app/core/validators.py b/backend/app/core/validators.py index fe671f7..f9c72f5 100644 --- a/backend/app/core/validators.py +++ b/backend/app/core/validators.py @@ -128,12 +128,10 @@ class GameValidator: if not decision.steal_attempts: raise ValidationError("Steal action requires steal_attempts to specify which bases to steal") - # Validate squeeze_bunt - requires R3 and bases NOT loaded + # Validate squeeze_bunt - requires R3, not with 2 outs if decision.action == 'squeeze_bunt': if not state.is_runner_on_third(): raise ValidationError("Squeeze bunt requires a runner on third base") - if len(occupied_bases) == 3: # Bases loaded - raise ValidationError("Squeeze bunt cannot be used with bases loaded") if state.outs >= 2: raise ValidationError("Squeeze bunt cannot be used with 2 outs") diff --git a/backend/tests/unit/core/test_validators.py b/backend/tests/unit/core/test_validators.py index 793dbcd..f1b2e96 100644 --- a/backend/tests/unit/core/test_validators.py +++ b/backend/tests/unit/core/test_validators.py @@ -732,8 +732,8 @@ class TestOffensiveDecisionValidation: assert "squeeze bunt requires a runner on third" in str(exc_info.value).lower() - def test_validate_offensive_decision_action_squeeze_bunt_bases_loaded_fails(self): - """Test squeeze bunt with bases loaded fails""" + def test_validate_offensive_decision_action_squeeze_bunt_bases_loaded_succeeds(self): + """Test squeeze bunt with bases loaded succeeds (no restriction on bases loaded)""" validator = GameValidator() state = GameState( game_id=uuid4(), @@ -748,10 +748,8 @@ class TestOffensiveDecisionValidation: ) decision = OffensiveDecision(action="squeeze_bunt") - with pytest.raises(ValidationError) as exc_info: - validator.validate_offensive_decision(decision, state) - - assert "squeeze bunt cannot be used with bases loaded" in str(exc_info.value).lower() + # Should not raise - squeeze bunt is allowed with bases loaded + validator.validate_offensive_decision(decision, state) def test_validate_offensive_decision_action_squeeze_bunt_two_outs_fails(self): """Test squeeze bunt with 2 outs fails"""