fix: correct get_of() opposite-field direction for switch hitters #40

Merged
Claude merged 3 commits from ai/paper-dynasty-card-creation#5 into main 2026-03-23 03:52:38 +00:00
Collaborator

Summary

  • Fixes copy-paste bug in get_of() (creation_helpers.py:689-693) where both pull_side=True and pull_side=False returned the same outfield direction for switch hitters
  • vs LHP: switch hitter bats right-handed → pull=lf, oppo=rf (was rf/rf)
  • vs RHP: switch hitter bats left-handed → pull=rf, oppo=lf (was lf/lf)

Closes #5

Test plan

  • Read back creation_helpers.py:689-693 to confirm both branches now differ
  • Verify switch-hitter cards generate correct opposite-field results after a live-series update
## Summary - Fixes copy-paste bug in `get_of()` (`creation_helpers.py:689-693`) where both `pull_side=True` and `pull_side=False` returned the same outfield direction for switch hitters - vs LHP: switch hitter bats right-handed → pull=`lf`, oppo=`rf` (was `rf`/`rf`) - vs RHP: switch hitter bats left-handed → pull=`rf`, oppo=`lf` (was `lf`/`lf`) Closes #5 ## Test plan - [ ] Read back `creation_helpers.py:689-693` to confirm both branches now differ - [ ] Verify switch-hitter cards generate correct opposite-field results after a live-series update
Claude added 1 commit 2026-03-21 05:02:13 +00:00
Switch hitters batting vs LHP hit right-handed (pull=lf, oppo=rf).
Switch hitters batting vs RHP hit left-handed (pull=rf, oppo=lf).
Copy-paste error had both pull_side branches returning the same value.

Closes #5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude added the
ai-reviewing
label 2026-03-21 05:15:48 +00:00
Claude reviewed 2026-03-21 05:16:44 +00:00
Claude left a comment
Author
Collaborator

AI Code Review

Files Reviewed

  • creation_helpers.py (modified)

Findings

Correctness

The core fix at lines 688–694 is correct. Switch hitters bat opposite-hand against pitchers:

  • vs LHP (bats right-handed): pull_side=True"lf", pull_side=False"rf"
  • vs RHP (bats left-handed): pull_side=True"rf", pull_side=False"lf"

This now matches the established pattern for "R" and "L" batter branches above it. The copy-paste bug (both branches returning the same value, making the pull_side parameter meaningless for switch hitters) is cleanly resolved.

The remainder of the diff is cosmetic f-string reformatting (f'{"..."}f"{'...'}" with swapped quote styles). Both forms are valid Python and produce identical output — no behavioral change.

Security

No issues found.

Style & Conventions

F-string style changes are consistent with the rest of the file and produce cleaner-reading code. No convention violations.

Suggestions

  • A unit test covering get_of("S", "L", pull_side=True)"lf" and get_of("S", "L", pull_side=False)"rf" (and the RHP variants) would prevent regression. The function is pure and trivial to test. Not a blocker.

Verdict: COMMENT (LGTM)

Correct fix for an obvious copy-paste bug. The switch-hitter direction logic now matches the R/L batter pattern as expected. Ready to merge.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `creation_helpers.py` (modified) ### Findings #### Correctness The core fix at lines 688–694 is correct. Switch hitters bat opposite-hand against pitchers: - **vs LHP** (bats right-handed): `pull_side=True` → `"lf"`, `pull_side=False` → `"rf"` ✓ - **vs RHP** (bats left-handed): `pull_side=True` → `"rf"`, `pull_side=False` → `"lf"` ✓ This now matches the established pattern for `"R"` and `"L"` batter branches above it. The copy-paste bug (both branches returning the same value, making the `pull_side` parameter meaningless for switch hitters) is cleanly resolved. The remainder of the diff is cosmetic f-string reformatting (`f'{"..."}` → `f"{'...'}"` with swapped quote styles). Both forms are valid Python and produce identical output — no behavioral change. #### Security No issues found. #### Style & Conventions F-string style changes are consistent with the rest of the file and produce cleaner-reading code. No convention violations. #### Suggestions - A unit test covering `get_of("S", "L", pull_side=True)` → `"lf"` and `get_of("S", "L", pull_side=False)` → `"rf"` (and the RHP variants) would prevent regression. The function is pure and trivial to test. Not a blocker. ### Verdict: COMMENT (LGTM) Correct fix for an obvious copy-paste bug. The switch-hitter direction logic now matches the R/L batter pattern as expected. Ready to merge. --- *Automated review by Claude PR Reviewer*
Claude added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-21 05:17:12 +00:00
Claude added 1 commit 2026-03-23 03:51:00 +00:00
cal approved these changes 2026-03-23 03:51:48 +00:00
cal left a comment
Owner

Approved — safe bug fix per PO triage.

Approved — safe bug fix per PO triage.
Claude added 1 commit 2026-03-23 03:52:34 +00:00
Claude merged commit ecc62a0521 into main 2026-03-23 03:52:38 +00:00
Claude deleted branch ai/paper-dynasty-card-creation#5 2026-03-23 03:52:39 +00:00
Sign in to join this conversation.
No reviewers
cal
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-card-creation#40
No description provided.