fix: roster validation includes org affiliate transactions #50

Merged
cal merged 2 commits from fix/roster-validation-org-affiliates into next-release 2026-03-01 20:50:22 +00:00
Owner

Summary

Fixes #49 — Team POR was getting a false "too many players" error when trying to move Jeffrey Springs from IL to MiL next week, despite a pending trade that would clear a MiL spot.

Root cause: load_existing_transactions() only queried for transactions matching the base team abbreviation (e.g., POR). The database API does exact matching on Team.abbrev, so trade transactions involving affiliates (PORMIL, PORIL) were invisible to roster validation.

Fix:

  • get_team_transactions() now accepts Union[str, List[str]] for team_abbrev
  • load_existing_transactions() queries all org affiliates: ["POR", "PORMIL", "PORIL"]

Changes

  • services/transaction_service.py — Accept list of abbreviations (backwards compatible)
  • services/transaction_builder.py — Query org affiliates in load_existing_transactions()
  • tests/test_roster_validation_org_affiliates.py — 5 new tests covering the exact POR scenario

Test plan

  • All 930 existing tests pass
  • 5 new tests verify: org abbreviation querying, trade-clearing-MiL-spot scenario, baseline rejection without trade, list/string backwards compatibility
## Summary Fixes #49 — Team POR was getting a false "too many players" error when trying to move Jeffrey Springs from IL to MiL next week, despite a pending trade that would clear a MiL spot. **Root cause:** `load_existing_transactions()` only queried for transactions matching the base team abbreviation (e.g., `POR`). The database API does exact matching on `Team.abbrev`, so trade transactions involving affiliates (`PORMIL`, `PORIL`) were invisible to roster validation. **Fix:** - `get_team_transactions()` now accepts `Union[str, List[str]]` for `team_abbrev` - `load_existing_transactions()` queries all org affiliates: `["POR", "PORMIL", "PORIL"]` ## Changes - `services/transaction_service.py` — Accept list of abbreviations (backwards compatible) - `services/transaction_builder.py` — Query org affiliates in `load_existing_transactions()` - `tests/test_roster_validation_org_affiliates.py` — 5 new tests covering the exact POR scenario ## Test plan - [x] All 930 existing tests pass - [x] 5 new tests verify: org abbreviation querying, trade-clearing-MiL-spot scenario, baseline rejection without trade, list/string backwards compatibility
cal added 2 commits 2026-03-01 16:45:57 +00:00
Merge pull request 'next-release' (#47) from next-release into main
All checks were successful
Build Docker Image / build (push) Successful in 46s
a80addc742
Reviewed-on: #47
load_existing_transactions only queried for the base team abbreviation
(e.g. "POR"), missing trades involving MiL/IL affiliates ("PORMIL",
"PORIL"). This caused false "too many players" errors when a pending
trade would have cleared a roster spot.

- get_team_transactions now accepts Union[str, List[str]] for team_abbrev
- load_existing_transactions queries all org affiliates [BASE, BASEMiL, BASEIL]
- Added 5 tests covering the fix and backwards compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cal merged commit 46afbf25e0 into next-release 2026-03-01 20:50:22 +00:00
cal deleted branch fix/roster-validation-org-affiliates 2026-03-01 20:50:22 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 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/major-domo-v2#50
No description provided.