Roster validation doesn't include org affiliate transactions (trades invisible to MiL count) #49

Closed
opened 2026-03-01 16:41:30 +00:00 by cal · 0 comments
Owner

Bug Description

When a team (e.g., POR) uses /dropadd to schedule a move for next week, the roster validation loads existing transactions to project the future roster state. However, load_existing_transactions() only queries for transactions matching the base team abbreviation (e.g., POR), missing transactions involving organizational affiliates (PORMIL, PORIL).

Steps to Reproduce

  1. Team POR makes a trade that sends a MiL player away next week (transaction has oldteam=PORMIL)
  2. POR tries to move Jeffrey Springs from IL to MiL next week via /dropadd
  3. Validation says "Minor League roster would have 7 players (limit: 6)" — it doesn't see the outgoing trade clearing a spot

Root Cause

In services/transaction_builder.py, load_existing_transactions() calls:

transaction_service.get_team_transactions(team_abbrev=self.team.abbrev, ...)

This sends team_abbrev=POR to the API. The API endpoint (database/app/routers_v3/transactions.py:46-51) does exact matching on Team.abbrev, so transactions with oldteam=PORMIL or newteam=PORMIL are NOT returned.

Fix

  1. Modify transaction_service.get_team_transactions() to accept a list of abbreviations
  2. Modify load_existing_transactions() to include all org affiliates (POR, PORMIL, PORIL)

Impact

Any team with pending trades involving MiL or IL affiliates will get false "too many players" errors when trying to schedule roster moves for next week.

## Bug Description When a team (e.g., POR) uses `/dropadd` to schedule a move for next week, the roster validation loads existing transactions to project the future roster state. However, `load_existing_transactions()` only queries for transactions matching the base team abbreviation (e.g., `POR`), missing transactions involving organizational affiliates (`PORMIL`, `PORIL`). ## Steps to Reproduce 1. Team POR makes a trade that sends a MiL player away next week (transaction has `oldteam=PORMIL`) 2. POR tries to move Jeffrey Springs from IL to MiL next week via `/dropadd` 3. Validation says "Minor League roster would have 7 players (limit: 6)" — it doesn't see the outgoing trade clearing a spot ## Root Cause In `services/transaction_builder.py`, `load_existing_transactions()` calls: ```python transaction_service.get_team_transactions(team_abbrev=self.team.abbrev, ...) ``` This sends `team_abbrev=POR` to the API. The API endpoint (`database/app/routers_v3/transactions.py:46-51`) does exact matching on `Team.abbrev`, so transactions with `oldteam=PORMIL` or `newteam=PORMIL` are NOT returned. ## Fix 1. Modify `transaction_service.get_team_transactions()` to accept a list of abbreviations 2. Modify `load_existing_transactions()` to include all org affiliates (`POR`, `PORMIL`, `PORIL`) ## Impact Any team with pending trades involving MiL or IL affiliates will get false "too many players" errors when trying to schedule roster moves for next week.
cal closed this issue 2026-03-01 20:50:22 +00:00
Sign in to join this conversation.
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#49
No description provided.