From 14e33103bc32934613523858e72d17fc9c9777cf Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 25 Feb 2026 16:27:03 -0600 Subject: [PATCH] relate: 2d704690 --RELATED_TO--> 09bb95a5 --- ...on-database-side-schema-router-changes-09bb95.md | 7 ++++++- ...TED_TO--fullcard-migration-database-si-d67682.md | 13 +++++++++++++ ...gsmodel-xcheck-defaults-must-be-zeroed-2d7046.md | 8 +++++++- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 graph/edges/fix-pitchingcardratingsmodel-x--RELATED_TO--fullcard-migration-database-si-d67682.md diff --git a/graph/decisions/fullcard-migration-database-side-schema-router-changes-09bb95.md b/graph/decisions/fullcard-migration-database-side-schema-router-changes-09bb95.md index 205783a136a..4f8f1416daa 100644 --- a/graph/decisions/fullcard-migration-database-side-schema-router-changes-09bb95.md +++ b/graph/decisions/fullcard-migration-database-side-schema-router-changes-09bb95.md @@ -6,13 +6,18 @@ tags: [paper-dynasty, database, db_engine, battingcardratings, pitchingcardratin importance: 0.8 confidence: 0.8 created: "2026-02-25T22:26:54.133040+00:00" -updated: "2026-02-25T22:27:03.842958+00:00" +updated: "2026-02-25T22:27:03.950479+00:00" relations: - target: c7623317-ea0a-4b8a-9375-65fc3aac5303 type: RELATED_TO direction: outgoing strength: 0.8 edge_id: 0b7eb89e-5ffa-4f42-9a07-b6f34c6d3990 + - target: 2d704690-8790-4f67-bf0d-1bd1e50460a9 + type: RELATED_TO + direction: incoming + strength: 0.8 + edge_id: d6768246-fb91-4568-b69c-00eafef8d6ea --- ## Branch\nfeature/fullcard-migration in the database repo.\n\n## Files Updated\n\n### db_engine.py\nAdded 9 nullable TextField columns to BattingCardRatings and PitchingCardRatings:\n- col_one_2d6, col_one_results, col_one_d20\n- col_two_2d6, col_two_results, col_two_d20\n- col_three_2d6, col_three_results, col_three_d20\n\n### routers_v2/battingcardratings.py + pitchingcardratings.py\nAdded 9 Optional[str] = None fields to Pydantic models. PUT handler uses x.dict() so it persists new fields automatically — no handler code changes needed.\n\n### card_creation.py\nget_batter_card_data() and get_pitcher_card_data() check if ratings_vl.col_one_2d6 is not None and ratings_vr.col_one_2d6 is not None — if so, return stored columns directly (skips full on-the-fly rebuild for backwards compat).\n\n## Migration SQL\nALTER TABLE battingcardratings ADD COLUMN col_one_2d6 TEXT (and 8 more) is INTENTIONALLY NOT RUN — documented but blocked until reviewed. diff --git a/graph/edges/fix-pitchingcardratingsmodel-x--RELATED_TO--fullcard-migration-database-si-d67682.md b/graph/edges/fix-pitchingcardratingsmodel-x--RELATED_TO--fullcard-migration-database-si-d67682.md new file mode 100644 index 00000000000..77ae943ca78 --- /dev/null +++ b/graph/edges/fix-pitchingcardratingsmodel-x--RELATED_TO--fullcard-migration-database-si-d67682.md @@ -0,0 +1,13 @@ +--- +id: d6768246-fb91-4568-b69c-00eafef8d6ea +type: RELATED_TO +from_id: 2d704690-8790-4f67-bf0d-1bd1e50460a9 +from_title: "Fix: PitchingCardRatingsModel xcheck defaults must be zeroed in new_ratings" +to_id: 09bb95a5-2b2f-43e5-93a6-6b96b881461f +to_title: "FullCard migration: database-side schema + router changes" +strength: 0.8 +created: "2026-02-25T22:27:03.950479+00:00" +updated: "2026-02-25T22:27:03.950479+00:00" +--- + +xcheck zeroing fix is in pitchers/card_builder.py, same code area as the schema migration work diff --git a/graph/fixes/fix-pitchingcardratingsmodel-xcheck-defaults-must-be-zeroed-2d7046.md b/graph/fixes/fix-pitchingcardratingsmodel-xcheck-defaults-must-be-zeroed-2d7046.md index d83a82d6699..6a6366367bd 100644 --- a/graph/fixes/fix-pitchingcardratingsmodel-xcheck-defaults-must-be-zeroed-2d7046.md +++ b/graph/fixes/fix-pitchingcardratingsmodel-xcheck-defaults-must-be-zeroed-2d7046.md @@ -6,7 +6,13 @@ tags: [paper-dynasty, card-creation, pitchers, card_builder, xcheck, pitchingcar importance: 0.7 confidence: 0.8 created: "2026-02-25T22:26:54.035955+00:00" -updated: "2026-02-25T22:26:54.035955+00:00" +updated: "2026-02-25T22:27:03.950479+00:00" +relations: + - target: 09bb95a5-2b2f-43e5-93a6-6b96b881461f + type: RELATED_TO + direction: outgoing + strength: 0.8 + edge_id: d6768246-fb91-4568-b69c-00eafef8d6ea --- ## Problem\nPitchingCardRatingsModel has non-zero default values for xcheck fields:\n- xcheck_p=1.0, xcheck_c=3.0, xcheck_1b=2.0, xcheck_2b=6.0, xcheck_3b=3.0\n- xcheck_ss=7.0, xcheck_lf=2.0, xcheck_cf=3.0, xcheck_rf=2.0\n\nWhen creating the tracking new_ratings object in build_pitcher_full_cards(), if these are not explicitly zeroed, the accumulated xcheck values will be wrong (seeded with defaults instead of starting from 0).\n\n## Fix: Always Initialize Explicitly\n```python\nnew_ratings = PitchingCardRatingsModel(\n pitchingcard_id=data.pitchingcard_id,\n pit_hand=data.pit_hand, vs_hand=vs_hand,\n hard_rate=data.hard_rate, med_rate=data.med_rate, soft_rate=data.soft_rate,\n xcheck_p=0.0, xcheck_c=0.0, xcheck_1b=0.0, xcheck_2b=0.0,\n xcheck_3b=0.0, xcheck_ss=0.0, xcheck_lf=0.0, xcheck_cf=0.0, xcheck_rf=0.0\n)\n```\n\n## Location\npitchers/card_builder.py → build_pitcher_full_cards()