diff --git a/graph/workflows/pr-review-major-domo-v262-maintenance-mode-flag-in-admin-mai-5cdfc0.md b/graph/workflows/pr-review-major-domo-v262-maintenance-mode-flag-in-admin-mai-5cdfc0.md new file mode 100644 index 00000000000..8456635909e --- /dev/null +++ b/graph/workflows/pr-review-major-domo-v262-maintenance-mode-flag-in-admin-mai-5cdfc0.md @@ -0,0 +1,33 @@ +--- +id: 5cdfc099-7916-440a-a711-1a47ad8dc3bd +type: workflow +title: "PR review: major-domo-v2#62 — maintenance mode flag in /admin-maintenance" +tags: [pr-reviewer, major-domo, discord-bot, python, discord.py, maintenance-mode, tree-interaction-check, approved] +importance: 0.4 +confidence: 0.8 +created: "2026-03-03T18:33:25.436987+00:00" +updated: "2026-03-03T18:33:25.436987+00:00" +--- + +## Verdict: APPROVED (posted as COMMENT due to Gitea self-approval restriction) + +### PR Summary +Fixes #28. `/admin-maintenance` previously showed a success embed but never changed state. This PR implements the actual flag. + +### Files Reviewed +- `bot.py` — added `self.maintenance_mode: bool = False` to `SBABot.__init__`; registered `@self.tree.interaction_check` inside `setup_hook` to block non-admin users when flag is set +- `commands/admin/management.py` — wired `self.bot.maintenance_mode = is_enabling`, added logger.info, removed no-op comment; rest is formatting cleanup + +### Key Findings +- Pattern is correct: nested function in `setup_hook` captures `self` via closure, always reads live flag value +- Admin bypass uses `isinstance(interaction.user, discord.Member) and interaction.user.guild_permissions.administrator` — mirrors existing `AdminCommands.interaction_check` pattern +- No double-response risk: ephemeral message sent before returning `False` +- `self.bot.maintenance_mode` typed as `commands.Bot` not `SBABot` — runtime safe, would fail strict mypy (pre-existing pattern, not blocked) +- No new tests added; acceptable for simple boolean flag feature + +### Patterns Noted +- `@self.tree.interaction_check` inside `setup_hook` is idiomatic discord.py for global interaction gates +- `EmbedTemplate.create_base_embed()` correctly used when title contains custom emoji (per CLAUDE.md rule) + +### Meta +- Gitea blocks self-approval on own PRs — reviewer must post as COMMENT in this case