cleanup: remove dead maintenance mode artifacts in bot.py (#104) #105
No reviewers
Labels
No Label
ai-changes-requested
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
in-next-release
status/in-progress
status/pr-open
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-v2#105
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/major-domo-v2-104"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #104
Changes
Two small deletions in
bot.py— no behavioral change.1. Remove duplicate
self.maintenance_modeassignmentself.maintenance_mode: bool = Falsewas assigned twice inSBABot.__init__(lines 121 and 123), a merge artifact from PR #83. Removed the second (lower) assignment.2. Delete dead
@self.tree.interaction_checkblockThe 16-line decorator block in
setup_hookis dead code:MaintenanceAwareTree.interaction_check()already handles maintenance gating via thetree_cls=MaintenanceAwareTreekwarg. Keeping it also generated aRuntimeWarningat startup (discord.py warns wheninteraction_checkis assigned via decorator on a subclassed CommandTree).Tests
tests/test_bot_maintenance_tree.py: 8/8 passedOther observations
The auto-formatter (ruff) applied two cosmetic reformats on edited lines:
RotatingFileHandler(...)args andbot.latency * 1000. These are incidental to the linter hook, not intentional changes.AI Code Review
Files Reviewed
bot.py(modified)Findings
Correctness
Both targeted removals are correct and complete.
Duplicate
self.maintenance_modeassignment — the diff removes line 123 (self.maintenance_mode: bool = False), leaving exactly one assignment at line 121. The PR branch head confirms only a single assignment remains. This was a clean merge artifact from PR #83 with no semantic effect, but it generated amypy/type-checker warning and was confusing to read.Dead
@self.tree.interaction_checkblock — the 16-line decorator block insetup_hookis correctly removed.MaintenanceAwareTree.interaction_check()(lines 82–102 of the final file) already owns this responsibility viatree_cls=MaintenanceAwareTreeinsuper().__init__. The decorator assignment was not only redundant — in discord.py, assigning via decorator tointeraction_checkon aCommandTreesubclass generates aRuntimeWarningat startup. The removal is clean and the maintenance gate remains fully functional.The PR is
mergeable: true— no conflicts withmain. This is the correct outcome of the action requested in the PR #84 review.Security
No issues. No new code introduced, only deletions.
Style & Conventions
Ruff reformats — two incidental reformats were applied by the pre-commit linter hook:
RotatingFileHandler(...)args expanded to one-per-line (lines 44–47 of final file). Cosmetic, valid.bot.latency*1000→bot.latency * 1000with argument expansion (health command embed). Cosmetic, valid.Both are linter-enforced style corrections on lines the diff touched. They do not affect behavior and follow the project's ruff configuration.
Test Coverage
tests/test_bot_maintenance_tree.py(8 tests) covers:maintenance_modeattribute safe fallback viagetattrTestSBABotMaintenanceModeAttribute.test_maintenance_mode_default_is_false— patchescommands.Bot.__init__to a no-op and callsSBABot.__init__directly, asserting exactly onemaintenance_mode = Falseassignment exists and holds the correct valueThe last test directly validates the fix in this PR: it would catch any regression that re-introduced the duplicate assignment or changed the default value.
Suggestions
None. This PR is a targeted two-deletion cleanup with no new logic. It is exactly what PR #84's review requested and nothing more.
Verdict: COMMENT (APPROVED)
Correct, minimal, and complete. Both dead-code artifacts tracked since PR #83 are removed. The
MaintenanceAwareTreesubclass continues to handle maintenance gating correctly. The ruff reformats are cosmetic and linter-enforced. All 8 maintenance tree tests pass. Ready to merge.Automated review by Claude PR Reviewer