strat-gameplay-webapp/.claude/HANDOFF_PROMPT_CLEANUP.md
Cal Corum 197d91edfb CLAUDE: Remove defensive alignment field completely
Removed the unused alignment field from DefensiveDecision model and all
related code across backend and frontend.

Backend changes:
- models/game_models.py: Removed alignment field and validator
- terminal_client/display.py: Removed alignment from display
- core/ai_opponent.py: Updated log message
- tests/unit/models/test_game_models.py: Removed alignment tests
- tests/unit/core/test_validators.py: Removed alignment validation test

Frontend changes:
- types/game.ts: Removed alignment from DefensiveDecision interface
- components/Decisions/DefensiveSetup.vue:
  * Removed alignment section from template
  * Removed alignment from localSetup initialization
  * Removed alignmentOptions array
  * Removed alignmentDisplay computed property
  * Removed alignment from hasChanges comparison
  * Removed alignment from visual preview (reorganized to col-span-2)

Rationale: Defensive alignment is not active in the game and will not be
used. Per Cal's decision, remove completely rather than keep as dead code.

Tests: All 728 backend unit tests passing (100%)

Session 1 Part 3 - Change #6 complete
Part of cleanup work from demo review

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-14 13:02:22 -06:00

7.4 KiB

Context Window Handoff - Cleanup Work in Progress

Date: 2025-01-14 Current Session: Cleanup of proposed changes from demo review Status: Session 1 Part 1 Complete (2/11 changes done)


Copy This Prompt to New Context Window

I'm continuing cleanup work on the Paper Dynasty / SBA web app. We're making changes based on a review of the frontend demo pages.

Current status: Session 1 Part 1 complete (removed 4 unused config fields). Now need to continue with Session 1 Part 2 and beyond.

Please read these files for full context:
- @.claude/PROPOSED_CHANGES_2025-01-14.md (master list of all 11 changes)
- @.claude/TODO_CLEANUP_COMPLETE.md (what we just finished)
- @backend/app/config/base_config.py (we just modified this)
- @backend/tests/unit/config/test_league_configs.py (we just modified this)

Key decisions from Cal:
1. Remove supports_manual_result_selection() - DONE ✅
2. Pitching change player ID - Will use league-independent polymorphic Player ID
3. Remove defensive alignment & offensive approach - DONE, remove completely
4. Offensive workflow refactor - YES, do before Phase F6 (last thing in cleanup)
5. Hit location fix - Only needed for: GROUNDOUT, FLYOUT, LINEOUT, SINGLE_UNCAPPED, DOUBLE_UNCAPPED, ERROR

Current TODO list (in TodoWrite):
- [completed] Remove strikes_for_out and balls_for_walk fields
- [completed] Remove supports_manual_result_selection() method
- [pending] Fix hit location requirements
- [pending] Remove defensive alignment from DefensiveDecision model
- [pending] Remove offensive approach from OffensiveDecision model
- [pending] Add infield depth validation (infield_in, corners_in, normal)
- [pending] Add outfield depth validation (normal, shallow with walk-off rules)
- [pending] Refactor offensive decision workflow (swing_away, check_jump, hit_and_run, sac_bunt, squeeze_bunt)
- [pending] Add check jump validation (lead runner only)

Workflow:
- Session 1: Quick wins (Changes #1-5) - IN PROGRESS
- Session 2: Standard changes (Changes #6-7) - NOT STARTED
- Session 3: Major refactor (Changes #8-11) - NOT STARTED

Dev server is running at http://localhost:3005 with demo pages.

Please continue from Session 1 Part 2: Fix hit location requirements.

Files Modified So Far (Session 1 Part 1)

backend/app/config/base_config.py

Changes: Removed 3 items

  • Line 27: strikes_for_out field
  • Line 28: balls_for_walk field
  • Lines 41-48: supports_manual_result_selection() method

Current state: Clean, tests passing

backend/tests/unit/config/test_league_configs.py

Changes: Updated 2 test methods

  • test_sba_basic_rules: Removed assertions for strikes/balls
  • test_sba_supports_auto_mode: Renamed from manual_selection, tests auto mode
  • test_pd_basic_rules: Removed assertions for strikes/balls
  • test_pd_supports_auto_mode: Renamed from manual_selection, tests auto mode

Current state: 28/28 tests passing


Next Steps (Session 1 Part 2)

Change #5: Fix Hit Location Requirements

Current Problem: frontend-sba/components/Gameplay/ManualOutcomeEntry.vue:152 has:

const outcomesNeedingHitLocation = [
  'GROUNDOUT',
  'FLYOUT',
  'LINEOUT',
  'SINGLE_1',        // ❌ Too broad
  'SINGLE_2',        // ❌ Too broad
  'SINGLE_UNCAPPED', // ✅ Correct
  'DOUBLE_2',        // ❌ Too broad
  'DOUBLE_3',        // ❌ Too broad
  'DOUBLE_UNCAPPED', // ✅ Correct
  'TRIPLE',          // ❌ Too broad
  'ERROR',           // ✅ Correct
]

Correct List (per Cal):

  • GROUNDOUT (all groundouts)
  • FLYOUT (all flyouts)
  • LINEOUT (all lineouts)
  • SINGLE_UNCAPPED
  • DOUBLE_UNCAPPED
  • ERROR

Files to Update:

  1. frontend-sba/components/Gameplay/ManualOutcomeEntry.vue:152 - Update array
  2. Verify PlayOutcome.requires_hit_location() matches in backend (if it exists)

Expected outcome: Only outcomes that affect defensive plays require hit location


Remaining Work After Session 1

Session 2: Standard Changes (2-4 hours)

Change #6: Remove defensive alignment

  • File: backend/app/models/game_models.py - DefensiveDecision model
  • File: frontend-sba/components/Decisions/DefensiveSetup.vue
  • Action: Remove alignment field completely

Change #7: Remove offensive approach

  • File: backend/app/models/game_models.py - OffensiveDecision model
  • File: frontend-sba/components/Decisions/OffensiveApproach.vue
  • Action: Remove approach field completely (will be replaced in Change #10)

Change #8: Add infield depth validation

  • Valid values: "infield_in", "corners_in", "normal"
  • Rule: infield_in and corners_in only legal with R3
  • Files: validators.py, DefensiveSetup.vue

Change #9: Add outfield depth validation

  • Valid values: "normal", "shallow"
  • Rule: shallow only legal when walk-off possible (home team, bottom 9+, trailing/tied, runner on base)
  • Files: validators.py, DefensiveSetup.vue

Session 3: Major Refactor (4+ hours)

Change #10: Refactor offensive decision model

  • Replace approach field with specific actions
  • New actions: swing_away, check_jump, hit_and_run, sac_bunt, squeeze_bunt
  • Validation rules:
    • squeeze_bunt only with R3 and bases not loaded
    • check_jump only with runner on base
  • Files: OffensiveDecision model, OffensiveApproach.vue, tests
  • Impact: Will break 213 Phase F3 tests - need to update

Change #11: Check jump validation

  • Rule: Only lead runner or both if 1st and 3rd
  • No trail runners
  • Bundle with Change #10

Git Status

Branch: implement-phase-3 Last Commit: eab61ad - "Phases 3.5, F1-F5 Complete" Working Tree: Clean (all previous work committed)

Commits This Session:

  • Will need to commit cleanup work when done

Test Status Baseline

Before cleanup started:

  • Backend: 731/731 passing (100%)
  • Frontend: 446/446 passing (100%)

After Session 1 Part 1:

  • Backend config tests: 28/28 passing (100%)
  • Need to verify full suite still passing

Expected after Session 3:

  • Backend tests: Will need updates for offensive decision refactor
  • Frontend tests: 213 F3 tests will need updates

Key Context Files

Master tracking:

  • .claude/PROPOSED_CHANGES_2025-01-14.md - All 11 changes with analysis
  • .claude/TODO_VERIFICATION_RESULTS.md - What TODOs were already resolved
  • .claude/TODO_SUMMARY.md - Quick reference

Implementation docs:

  • backend/app/config/CLAUDE.md - Config system docs
  • backend/app/models/CLAUDE.md - Game models docs (will need for Changes #6-11)
  • frontend-sba/CLAUDE.md - Frontend docs

Modified files so far:

  • backend/app/config/base_config.py
  • backend/tests/unit/config/test_league_configs.py

Important Notes

  1. Dev server running: http://localhost:3005 for testing frontend changes
  2. Always run tests after each change
  3. Commit frequently - don't batch all changes into one commit
  4. Session 3 is complex - offensive decision refactor affects many files
  5. Follow workflow - Don't skip to Session 3, do Session 1 & 2 first

Questions Already Answered

Q: Remove or keep supports_manual_result_selection()? A: Remove completely

Q: What identifier for pitching change? A: League-independent polymorphic Player ID

Q: Remove alignment and approach? A: Yes, remove completely

Q: When to do offensive refactor? A: Before Phase F6, as last part of cleanup

Q: Hit location requirements? A: Only GROUNDOUT, FLYOUT, LINEOUT, SINGLE_UNCAPPED, DOUBLE_UNCAPPED, ERROR


Ready to continue! Start with Session 1 Part 2: Fix hit location requirements.