fix: use archetype role ratings in pitcher card creation (#11) #46
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-card-creation#46
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-card-creation#11"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #11
Summary
starter_rating,relief_rating, andcloser_ratingwere hardcoded stubs (5/5/None) increate_pitching_card, making every custom pitcher card identical regardless of archetypePitcherArchetypealready carries these values (e.g. Ace: 9/3/None, Closer: 2/9/9)card_datawhen the pitcher workflow initialises its dict (alongsideratings), then reads them increate_pitching_cardwhen writing to the databaseFiles changed
custom_cards/interactive_creator.py— two-site change: populatecard_datawith archetype role ratings; consume them increate_pitching_cardOther observations
+spacing) on unrelated lines; these are cosmetic and do not affect behaviour.None-subscriptable issues fromdb_get/db_postreturn values.AI Code Review
Files Reviewed
custom_cards/interactive_creator.py(modified)Findings
Correctness
PitcherArchetypedeclaresstarter_rating: int,relief_rating: int, andcloser_rating: int | None = None— all three attributes are valid and present on every archetype instance.card_dataat initialisation (Step 3 ofcreate_player), survive thereview_and_tweakloop unchanged (bothtweak_archetypeandmanual_adjustmentsare stubs that returncard_dataunmodified), and are correctly consumed increate_pitching_cardwhen building the API payload.closer_rating=Noneis handled correctly — the API payload always acceptedNonehere (the original stub used it as the default), so no schema change is needed.Security
PITCHER_ARCHETYPES), not from user input, so there is no injection or validation concern.Style & Conventions
+→+) are cosmetic PEP 8 corrections and do not affect behaviour.create_pitching_cardstill reads "For now, use defaults — can be enhanced later" after the TODO stubs have been replaced. This is a stale comment worth cleaning up but it does not affect correctness.Suggestions
create_pitching_card(lines 572–573) could be updated to "Role ratings sourced from archetype" to reflect the new behaviour.Verdict: COMMENT (LGTM)
Minimal, targeted fix that correctly wires the archetype role ratings through the pipeline. The only follow-up is the stale comment, which is not a blocker.
Automated review by Claude PR Reviewer
AI Code Review
Files Reviewed
custom_cards/interactive_creator.py(modified)Findings
Correctness
No issues found. The fix is precise and complete:
Population site (line ~182):
card_datafor the pitcher branch now storesstarter_rating,relief_rating, andcloser_ratingdirectly from the chosenPitcherArchetypeinstance, alongside the existingratingskey.Consumption site (line ~583-585): The three hardcoded TODO stubs are replaced with reads from
card_data, which is guaranteed to be populated beforecreate_pitching_cardis called (the flow is linear: Step 3 buildscard_data, Step 4 runs the review/tweak loop, Step 5 callscreate_database_recordswhich callscreate_pitching_card).Attribute existence confirmed:
PitcherArchetype(defined incustom_cards/archetype_definitions.pylines 119-121) declares all three fields as typed dataclass attributes. Every archetype instance in the file carries concrete values — no attribute access can fail.Position assignment downstream is also correct: The CLAUDE.md notes that pitcher positions are assigned based on
starter_rating >= 4(SP) andcloser_ratingpresence (CP). The archetype values follow the same convention (Ace: SR=9, Closer: SR=2/CR=9), so cards created via this path will receive the correct position assignments automatically.Security
No issues found. No user input reaches the archetype fields — values are read from an immutable dataclass populated at archetype selection time.
Style & Conventions
+→+) are cosmetic formatter output (Ruff/Black). They are accurate and do not affect behaviour.# For now, use defaults - can be enhanced laterat line 570-571 ofcreate_pitching_cardis now misleading — the method no longer uses defaults. This is a minor leftover but does not affect correctness.Suggestions
# Determine starter/relief/closer ratings based on archetype / # For now, use defaults - can be enhanced later) should be updated to reflect that values now come fromcard_data. Low priority — cosmetic only, not a blocker.pd_cards/commands/custom.pylines 826-828 contain identical hardcodedstarter_rating: 5 / relief_rating: 5 / closer_rating: Nonestubs in a separate YAML-based custom card path. That path is out of scope for this PR but worth tracking as a follow-up.Verdict: APPROVED
The fix is correct, targeted, and complete. The two-site change properly threads archetype role ratings from selection through to database write, resolving all three TODO stubs. No regressions to existing batter path, no security concerns, and the diff matches the PR description exactly.
Automated review by Claude PR Reviewer
Approved. Using the archetype's actual role ratings instead of hardcoded stubs is the correct fix — every pitcher card will now reflect its archetype properly.
31f577e465to50ee2d0446