fix: dynamic roster type detection in /trade add-player (#29) #61

Closed
cal wants to merge 1 commits from ai/major-domo-v2-29 into next-release
Owner

Summary

Fixes #29/trade add-player hardcoded RosterType.MAJOR_LEAGUE for both from_roster and to_roster, making it impossible to correctly trade a player from/to a Minor League roster.

Changes

  • from_roster: Now detected from player.team.roster_type(). If the search endpoint returns only a team_id (no nested team object), fetches the full team via team_service.get_team() to determine the roster type. Falls back to MAJOR_LEAGUE for free agents.
  • to_roster: Now derived from dest_team.roster_type(), which uses the team's abbreviation suffix (e.g. NYYMILMINOR_LEAGUE, NYYILINJURED_LIST).

Files Changed

  • commands/transactions/trade.py — replaced hardcoded roster defaults with dynamic detection; added team_service import

Test Results

930 passed, 3 skipped

## Summary Fixes #29 — `/trade add-player` hardcoded `RosterType.MAJOR_LEAGUE` for both `from_roster` and `to_roster`, making it impossible to correctly trade a player from/to a Minor League roster. ### Changes - **`from_roster`**: Now detected from `player.team.roster_type()`. If the search endpoint returns only a `team_id` (no nested team object), fetches the full team via `team_service.get_team()` to determine the roster type. Falls back to `MAJOR_LEAGUE` for free agents. - **`to_roster`**: Now derived from `dest_team.roster_type()`, which uses the team's abbreviation suffix (e.g. `NYYMIL` → `MINOR_LEAGUE`, `NYYIL` → `INJURED_LIST`). ### Files Changed - `commands/transactions/trade.py` — replaced hardcoded roster defaults with dynamic detection; added `team_service` import ## Test Results 930 passed, 3 skipped ✅
cal added 1 commit 2026-03-03 06:07:50 +00:00
fix: dynamic roster type detection in /trade add-player (#29)
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m7s
5bdf0a02f2
Replaces hardcoded RosterType.MAJOR_LEAGUE for from_roster and to_roster
with detection based on player.team.roster_type() and dest_team.roster_type().
If player.team is not populated (search endpoint returns team_id only),
fetches full team via team_service.get_team() to obtain roster type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal added the
ai-reviewing
label 2026-03-03 06:33:41 +00:00
cal added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-03 06:37:47 +00:00
cal changed target branch from main to next-release 2026-03-03 16:58:25 +00:00
Author
Owner

Closing as superseded by PR #56 (fix/trade-from-roster-detection), which is already merged into next-release.

Both PRs fix the same issue (hardcoded RosterType.MAJOR_LEAGUE in /trade add-player), but #56 also fixes /trade supplementary with auto-detection from team_service.get_team(), which this PR left using the old heuristic.

Closing as superseded by PR #56 (`fix/trade-from-roster-detection`), which is already merged into `next-release`. Both PRs fix the same issue (hardcoded `RosterType.MAJOR_LEAGUE` in `/trade add-player`), but #56 also fixes `/trade supplementary` with auto-detection from `team_service.get_team()`, which this PR left using the old heuristic.
cal closed this pull request 2026-03-03 17:07:28 +00:00
cal deleted branch ai/major-domo-v2-29 2026-03-08 16:30:44 +00:00
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m7s

Pull request closed

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#61
No description provided.