feat: seed team contract configs + audit player overrides (#322) #339

Merged
forgejo_admin merged 1 commit from 322-seed-contract-configs into main 2026-04-04 22:55:03 +00:00

Summary

Two Alembic data migrations that populate structured JSONB for the data-driven contract rendering system. Migration 034 seeds contract_config on all 7 teams. Migration 035 sets contract_overrides on players with custom deals and cleans up internal flags in custom_notes.

Changes

  • alembic/versions/034_seed_team_contract_configs.py -- Populates contract_config JSONB for all 7 teams with tournament schedules, practice times, payment schedules, section toggles, and static content text. Three variants: boys-travel (teams 1-3), girls-travel (teams 4-5), local (teams 6-7, with 17U/16U practice schedule differences).
  • alembic/versions/035_set_player_contract_overrides.py -- Sets contract_overrides for 3 players with custom rendering needs (Kiana Sikander: tournament filter + 1 practice; Kelsie Stevens + Sophie Furse: local variant override). Cleans up internal flags ("Custom contract needed", "Going to be local") from custom_notes while preserving display-only notes (eligibility, gas stipend).

Test Plan

  • Both migrations compile cleanly (py_compile)
  • ruff check and ruff format pass
  • pytest tests/ requires live DB (not available locally) -- tests are unaffected by data migrations
  • Verify after deploy: SELECT id, contract_config->'variant' FROM teams shows correct variants
  • Verify: SELECT id, contract_overrides FROM players WHERE id IN (184, 190, 107) shows overrides
  • Verify: alembic upgrade head and alembic downgrade -1 both clean

Review Checklist

  • Migrations compile cleanly
  • ruff check + ruff format pass
  • Tournament IDs are stable kebab-case (referenced by player overrides)
  • Queens practice schedule uses Wednesday Granger (not Friday BWill)
  • Local 17U vs 16U have distinct practice schedules per Svelte template
  • Display-only custom_notes (eligibility, gas stipend) preserved
  • Internal flags ("Custom contract needed") cleared after override set
  • Both migrations reversible (downgrade sets columns back to NULL)
  • Source of truth for tournament/practice/payment data: westside-contracts src/routes/contract/[token]/+page.svelte
  • Closes #322
  • Parent: forgejo_admin/westside-contracts#34 (data-driven contract rendering)
  • Depends on: #319 (contract_config column), #321 (contract_overrides column), #320 (email types)
## Summary Two Alembic data migrations that populate structured JSONB for the data-driven contract rendering system. Migration 034 seeds `contract_config` on all 7 teams. Migration 035 sets `contract_overrides` on players with custom deals and cleans up internal flags in `custom_notes`. ## Changes - `alembic/versions/034_seed_team_contract_configs.py` -- Populates `contract_config` JSONB for all 7 teams with tournament schedules, practice times, payment schedules, section toggles, and static content text. Three variants: boys-travel (teams 1-3), girls-travel (teams 4-5), local (teams 6-7, with 17U/16U practice schedule differences). - `alembic/versions/035_set_player_contract_overrides.py` -- Sets `contract_overrides` for 3 players with custom rendering needs (Kiana Sikander: tournament filter + 1 practice; Kelsie Stevens + Sophie Furse: local variant override). Cleans up internal flags ("Custom contract needed", "Going to be local") from `custom_notes` while preserving display-only notes (eligibility, gas stipend). ## Test Plan - Both migrations compile cleanly (`py_compile`) - `ruff check` and `ruff format` pass - `pytest tests/` requires live DB (not available locally) -- tests are unaffected by data migrations - Verify after deploy: `SELECT id, contract_config->'variant' FROM teams` shows correct variants - Verify: `SELECT id, contract_overrides FROM players WHERE id IN (184, 190, 107)` shows overrides - Verify: `alembic upgrade head` and `alembic downgrade -1` both clean ## Review Checklist - [x] Migrations compile cleanly - [x] ruff check + ruff format pass - [x] Tournament IDs are stable kebab-case (referenced by player overrides) - [x] Queens practice schedule uses Wednesday Granger (not Friday BWill) - [x] Local 17U vs 16U have distinct practice schedules per Svelte template - [x] Display-only custom_notes (eligibility, gas stipend) preserved - [x] Internal flags ("Custom contract needed") cleared after override set - [x] Both migrations reversible (downgrade sets columns back to NULL) ## Related Notes - Source of truth for tournament/practice/payment data: `westside-contracts src/routes/contract/[token]/+page.svelte` ## Related - Closes #322 - Parent: `forgejo_admin/westside-contracts#34` (data-driven contract rendering) - Depends on: #319 (contract_config column), #321 (contract_overrides column), #320 (email types)
feat: seed team contract configs + audit player overrides (#322)
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
a1759d0dad
Migration 034: Populate contract_config JSONB for all 7 teams with
structured tournament, practice, payment, and section data extracted
from the westside-contracts Svelte template. Three variants: boys-travel,
girls-travel, local.

Migration 035: Set contract_overrides for players with custom deals
(Kiana tournament filter, Kelsie/Sophie local variant) and clean up
internal flags in custom_notes while preserving display-only notes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Owner

QA Review -- PR #339

Data Accuracy (cross-checked against westside-contracts Svelte template)

Boys Travel (teams 1-3):

  • Utah State Invitational: April 17-18, $70 local -- matches template line 238
  • Seal Beach: May 14-17, travel $395 (75+100+30+190) -- matches template lines 244-254
  • Vegas+Championship: July 9-19, travel $945 (223+110+562+50) with per-tournament notes -- matches template lines 256-267
  • Circuit registration: $186 Power 32 -- matches template lines 231-235
  • Practices: Sunday Kongo 2-4, Tuesday West High 6-8, Thursday LCA optional -- matches template lines 278-282
  • Payments: 6 items including circuit reg and trip dates -- matches template lines 288-295

Girls Travel (teams 4-5):

  • Utah Girls Invitational: April 10-11, $70 local -- matches template line 313
  • Denver: May 7-10, entry $60, travel $320 (50+40+50+178) -- matches template lines 315-326
  • Mesa AZ: May 28-31, entry $63, travel $360 (65+65+40+190) -- matches template lines 328-339
  • Mighty Five Meltdown: June 27-28, $44 local -- matches template line 343
  • Nike Vegas: July 9-13, entry $140, travel TBD with note -- matches template lines 345-351
  • Practices: Tuesday West High, Thursday LCA optional, Wednesday Granger 6:30-7:30 -- matches template lines 358-362
  • Payments: 8 items with correct dates -- matches template lines 379-388

Local (teams 6-7):

  • 17U: Monday BWill 7-9, Tuesday West High 6-8 -- matches template lines 404-406
  • 16U: Monday BWill 7-9, Friday BWill 7-9 -- matches template lines 409-411
  • Empty tournaments array + tournaments_and_leagues static text -- matches template lines 420-423
  • Payments: 3 items (jersey, prorated, monthly) -- matches template lines 425-429

Player Overrides (migration 035)

  • Player 184 (Kiana): tournaments ["mesa-az", "nike-vegas"], 1 practice (Wednesday Granger), simplified payments, custom note
  • Players 190 + 107 (Kelsie, Sophie): variant "local" override
  • Player 128 (Natalie): overrides=None, clears "Custom contract needed" flag only
  • Players 186, 111, 112 (Apaisa sisters): documented as no-ops, notes stay
  • Players 100, 115, 110, 138, 158 (gas stipend): documented as no-ops, notes stay
  • custom_notes cleanup uses case-insensitive line-by-line filtering

Migration Chain

  • 034 down_revision = "033" (correct, follows 033_add_contract_email_type_enum_values)
  • 035 down_revision = "034" (correct chain)
  • Both reversible (downgrade sets columns to NULL)

Potential Concern

  • Downgrade of 035 is lossy for custom_notes (cleared flags are not restored). This is documented in the docstring and acceptable since the flags are internal markers.

VERDICT: APPROVED

Clean data migration. All tournament/practice/payment data cross-verified against the Svelte template source of truth. Player overrides match the issue spec. Migration chain is correct.

## QA Review -- PR #339 ### Data Accuracy (cross-checked against `westside-contracts` Svelte template) **Boys Travel (teams 1-3):** - [x] Utah State Invitational: April 17-18, $70 local -- matches template line 238 - [x] Seal Beach: May 14-17, travel $395 (75+100+30+190) -- matches template lines 244-254 - [x] Vegas+Championship: July 9-19, travel $945 (223+110+562+50) with per-tournament notes -- matches template lines 256-267 - [x] Circuit registration: $186 Power 32 -- matches template lines 231-235 - [x] Practices: Sunday Kongo 2-4, Tuesday West High 6-8, Thursday LCA optional -- matches template lines 278-282 - [x] Payments: 6 items including circuit reg and trip dates -- matches template lines 288-295 **Girls Travel (teams 4-5):** - [x] Utah Girls Invitational: April 10-11, $70 local -- matches template line 313 - [x] Denver: May 7-10, entry $60, travel $320 (50+40+50+178) -- matches template lines 315-326 - [x] Mesa AZ: May 28-31, entry $63, travel $360 (65+65+40+190) -- matches template lines 328-339 - [x] Mighty Five Meltdown: June 27-28, $44 local -- matches template line 343 - [x] Nike Vegas: July 9-13, entry $140, travel TBD with note -- matches template lines 345-351 - [x] Practices: Tuesday West High, Thursday LCA optional, **Wednesday Granger 6:30-7:30** -- matches template lines 358-362 - [x] Payments: 8 items with correct dates -- matches template lines 379-388 **Local (teams 6-7):** - [x] 17U: Monday BWill 7-9, Tuesday West High 6-8 -- matches template lines 404-406 - [x] 16U: Monday BWill 7-9, Friday BWill 7-9 -- matches template lines 409-411 - [x] Empty tournaments array + tournaments_and_leagues static text -- matches template lines 420-423 - [x] Payments: 3 items (jersey, prorated, monthly) -- matches template lines 425-429 ### Player Overrides (migration 035) - [x] Player 184 (Kiana): tournaments ["mesa-az", "nike-vegas"], 1 practice (Wednesday Granger), simplified payments, custom note - [x] Players 190 + 107 (Kelsie, Sophie): variant "local" override - [x] Player 128 (Natalie): overrides=None, clears "Custom contract needed" flag only - [x] Players 186, 111, 112 (Apaisa sisters): documented as no-ops, notes stay - [x] Players 100, 115, 110, 138, 158 (gas stipend): documented as no-ops, notes stay - [x] custom_notes cleanup uses case-insensitive line-by-line filtering ### Migration Chain - [x] 034 down_revision = "033" (correct, follows 033_add_contract_email_type_enum_values) - [x] 035 down_revision = "034" (correct chain) - [x] Both reversible (downgrade sets columns to NULL) ### Potential Concern - Downgrade of 035 is lossy for custom_notes (cleared flags are not restored). This is documented in the docstring and acceptable since the flags are internal markers. ### VERDICT: APPROVED Clean data migration. All tournament/practice/payment data cross-verified against the Svelte template source of truth. Player overrides match the issue spec. Migration chain is correct.
forgejo_admin deleted branch 322-seed-contract-configs 2026-04-04 22:55:03 +00:00
Sign in to join this conversation.
No description provided.