major-domo-v2/tests
Cal Corum 32cb5da632 CLAUDE: Refactor voice cleanup service to use @tasks.loop pattern
Problem:
- Voice cleanup service used manual while loop instead of @tasks.loop
- Did not wait for bot readiness before starting
- Startup verification could miss stale entries
- Manual channel deletions did not unpublish associated scorecards

Changes:
- Refactored VoiceChannelCleanupService to use @tasks.loop(minutes=1)
- Added @before_loop decorator with await bot.wait_until_ready()
- Updated bot.py to use setup_voice_cleanup() pattern
- Fixed scorecard unpublishing for manually deleted channels
- Fixed scorecard unpublishing for wrong channel type scenarios
- Updated cleanup interval from 60 seconds to 1 minute (same behavior)
- Changed cleanup reason message from "15+ minutes" to "5+ minutes" (matches actual threshold)

Benefits:
- Safe startup: cleanup waits for bot to be fully ready
- Reliable stale cleanup: startup verification guaranteed to run
- Complete cleanup: scorecards unpublished in all scenarios
- Consistent pattern: follows same pattern as other background tasks
- Better error handling: integrated with discord.py task lifecycle

Testing:
- All 19 voice command tests passing
- Updated test fixtures to handle new task pattern
- Fixed test assertions for new cleanup reason message

Documentation:
- Updated commands/voice/CLAUDE.md with new architecture
- Documented all four cleanup scenarios for scorecards
- Added task lifecycle information
- Updated configuration section

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 00:05:35 -05:00
..
__init__.py CLAUDE: Initial commit for discord-app-v2 rebuild 2025-08-15 00:04:50 -05:00
CLAUDE.md CLAUDE: Add comprehensive CLAUDE.md documentation files for AI agent guidance 2025-10-20 20:30:07 -05:00
factories.py CLAUDE: Add weather and charts commands with utility infrastructure 2025-10-10 09:59:49 -05:00
test_api_client.py CLAUDE: SUCCESSFUL STARTUP - Discord Bot v2.0 fully operational 2025-08-16 07:36:47 -05:00
test_commands_charts.py CLAUDE: Reorganize data storage and enhance team/roster displays 2025-10-15 19:05:51 -05:00
test_commands_dice.py CLAUDE: Refactor dice roll functions to use DiceRoll dataclass 2025-10-14 14:28:19 -05:00
test_commands_dropadd.py CLAUDE: Fix trade system issues and enhance documentation 2025-10-06 16:10:13 -05:00
test_commands_profile_images.py CLAUDE: Implement player image management system 2025-10-10 13:54:12 -05:00
test_commands_soak.py CLAUDE: Implement soak easter egg with disappointment GIFs and tracking 2025-10-13 23:25:22 -05:00
test_commands_transactions.py CLAUDE: Add pagination and move ID display to /mymoves command 2025-10-14 16:51:24 -05:00
test_commands_voice.py CLAUDE: Refactor voice cleanup service to use @tasks.loop pattern 2025-10-24 00:05:35 -05:00
test_commands_weather.py CLAUDE: Add weather and charts commands with utility infrastructure 2025-10-10 09:59:49 -05:00
test_config.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
test_constants.py CLAUDE: Remove constants.py and migrate to config-based constants 2025-10-16 10:52:05 -05:00
test_dropadd_integration.py CLAUDE: Comprehensive bot improvements and test infrastructure 2025-10-02 11:35:26 -05:00
test_exceptions.py CLAUDE: Initial commit for discord-app-v2 rebuild 2025-08-15 00:04:50 -05:00
test_models_custom_command.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
test_models_help_command.py CLAUDE: Add graceful error handling for missing creators in custom commands 2025-10-13 17:53:58 -05:00
test_models_trade.py CLAUDE: Fix trade system issues and enhance documentation 2025-10-06 16:10:13 -05:00
test_models_transaction.py CLAUDE: Complete dice command system with fielding mechanics 2025-09-24 22:30:31 -05:00
test_models.py Refactor x-check chart data 2025-10-22 20:41:21 -05:00
test_services_base_service.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
test_services_custom_commands.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
test_services_help_commands.py CLAUDE: Add graceful error handling for missing creators in custom commands 2025-10-13 17:53:58 -05:00
test_services_injury.py Clear Injury bug fix 2025-10-22 19:20:43 -05:00
test_services_integration.py CLAUDE: Initial commit for discord-app-v2 rebuild 2025-08-15 00:04:50 -05:00
test_services_league_service.py CLAUDE: Add logged_command decorator and migrate Discord commands to reduce boilerplate 2025-08-15 14:56:42 -05:00
test_services_player_service.py Fixing get_config replacement issue 2025-10-17 08:00:24 -05:00
test_services_team_service.py Fixing get_config replacement issue 2025-10-17 08:00:24 -05:00
test_services_trade_builder.py Fixing get_config replacement issue 2025-10-17 08:00:24 -05:00
test_services_transaction_builder.py CLAUDE: Comprehensive bot improvements and test infrastructure 2025-10-02 11:35:26 -05:00
test_services_transaction.py CLAUDE: Complete dice command system with fielding mechanics 2025-09-24 22:30:31 -05:00
test_tasks_custom_command_cleanup.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
test_tasks_transaction_freeze.py CLAUDE: Add automated weekly transaction freeze/thaw system 2025-10-20 12:16:13 -05:00
test_transactions_integration.py CLAUDE: Comprehensive bot improvements and test infrastructure 2025-10-02 11:35:26 -05:00
test_utils_autocomplete.py CLAUDE: Fix trade system issues and enhance documentation 2025-10-06 16:10:13 -05:00
test_utils_decorators.py CLAUDE: Add logged_command decorator and migrate Discord commands to reduce boilerplate 2025-08-15 14:56:42 -05:00
test_utils_logging.py CLAUDE: SUCCESSFUL STARTUP - Discord Bot v2.0 fully operational 2025-08-16 07:36:47 -05:00
test_views_custom_commands.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
test_views_transaction_embed.py CLAUDE: Comprehensive bot improvements and test infrastructure 2025-10-02 11:35:26 -05:00
TRANSACTION_TEST_COVERAGE.md CLAUDE: Complete dice command system with fielding mechanics 2025-09-24 22:30:31 -05:00