paper-dynasty-discord/PRODUCTION_COGS.md
Cal Corum 021573bc65 DOCS: Add production cogs documentation for future reference
Created comprehensive documentation distinguishing between:
- Production cogs currently loaded (cogs.players, etc.)
- Work-in-progress refactored cogs (cogs/players_new)
- Which bug fixes apply to production vs future releases
- Migration checklist for when players_new goes live

This prevents confusion when making fixes - developers need to know
whether to update cogs/players.py (production) or cogs/players_new/
(WIP) or both.

Key insights:
- gauntlet commands are in cogs/players.py (production)
- cogs/players_new is NOT loaded in paperdynasty.py yet
- Recent fixes applied to both for consistency
- Migration requires updating COGS list in paperdynasty.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 09:46:11 -06:00

103 lines
3.1 KiB
Markdown

# Production Cogs vs Work-in-Progress
## Current Production Cogs (from `paperdynasty.py:47-53`)
The following cogs are loaded in production:
```python
COGS = [
'cogs.owner',
'cogs.admins',
'cogs.economy',
'cogs.players', # ← PRODUCTION gauntlet commands are HERE
'cogs.gameplay',
]
```
### Production Command Structure
**Gauntlet Commands** (in `cogs/players.py`):
- `/gauntlets start` - Line 942-1029
- `/gauntlets reset` - Line 1031-1081
- `/gauntlets status` - Other location in same file
**Key Production Functions:**
- `gauntlets.py` - Core gauntlet logic (draft, post_result, end_run)
- `helpers.py` / `helpers/utils.py` - Helper functions
- `utils.py` - Base utility functions
## Work-in-Progress: `cogs/players_new/` Package
**NOT LOADED IN PRODUCTION** - This is a refactored rebuild of the players cog.
Located in: `cogs/players_new/`
Structure:
```
cogs/players_new/
├── __init__.py # Package loader (not used yet)
├── gauntlet.py # Refactored gauntlet commands
├── player_lookup.py # Player search/display
├── paperdex.py # Collection tracking
├── standings_records.py # Standings/records
├── team_management.py # Team management
├── utility_commands.py # Misc utility commands
└── README.md # Documentation
```
### When `players_new` Goes Live
To activate the refactored cogs, update `paperdynasty.py`:
```python
COGS = [
'cogs.owner',
'cogs.admins',
'cogs.economy',
'cogs.players_new', # ← Load the package instead of 'cogs.players'
'cogs.gameplay',
]
```
The `__init__.py` will automatically load all submodules:
- Gauntlet
- Paperdex
- PlayerLookup
- StandingsRecords
- TeamManagement
- UtilityCommands
## Recent Bug Fixes (2025-11-10)
### Production Fixes (Active Now)
`utils.py` & `helpers/utils.py` - `get_roster_sheet()` handles both dict and Team objects
`gauntlets.py` - `end_run()` sends news-ticker messages for 2-loss completions
`cogs/players.py` - Updated to call fixed functions
### Future-Proofing Fixes (For When WIP Goes Live)
⏭️ `cogs/players_new/gauntlet.py` - Same fixes applied for future activation
⏭️ `cogs/players_new/team_management.py` - Uses `get_context_user()` helper
⏭️ `cogs/economy_new/` - Various hybrid command fixes
## Testing Checklist for `players_new` Activation
Before switching to `cogs/players_new`:
1. **Command Parity**: Verify all commands from `cogs/players` exist and work
2. **Database Compatibility**: Ensure Team object vs dict handling is consistent
3. **News-Ticker Messages**: Test gauntlet draft and completion announcements
4. **Hybrid Commands**: Test both prefix and slash command invocations
5. **Error Handling**: Verify all error messages work with Interaction objects
## Notes
- Keep both `cogs/players.py` and `cogs/players_new/` in sync for critical fixes
- When making fixes, check if they apply to both versions
- The refactored package provides better organization but same functionality
- Migration can happen gradually by testing individual submodules first
---
Last Updated: 2025-11-10
Branch: cogs-to-packages