Repository navigation
feat(bot)!: serve one guild through guild-scoped commands and Discord's own permissions - #184
Merged
Merged
Conversation
TheMeinerLP
force-pushed
the
docs/openspec-single-guild-native
branch
from
October 14, 2026 19:55
5abaaa9 to
6818de8
Compare
…'s own permissions Sturnus serves a single team, so one installation now serves one guild named by STURNUS_GUILD_ID. Commands are registered for that guild only and the old global ones are cleared. /config, /queue, /setup and /audio-purge default to Manage Server and Discord enforces it, replacing the in-process require_admin check; /audio purge becomes the top-level /audio-purge because Discord sets default permissions per top-level command. reconcile_guild and the tick refuse any other guild and log the two ids. admin_role_id and the console mirror are untouched. BREAKING CHANGE: STURNUS_GUILD_ID is required for the bot; /audio purge is now /audio-purge; access to /config, /queue, /setup and /audio-purge is governed by Manage Server and Server Settings > Integrations instead of the admin role.
TheMeinerLP
force-pushed
the
docs/openspec-single-guild-native
branch
from
October 14, 2026 20:00
6818de8 to
a5f992b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes one Sturnus installation serve one guild, and lets Discord itself decide who may run the administrative commands.
Depends on #183 and must merge after it. This branch contains #183's commits, so GitHub shows them here until #183 is merged; the diff of this PR is the last three commits only (two
docs(openspec)commits and thefeat(bot)!implementation).What it does
Sturnus is used by one team, so the scope decision of 2026-09-19 stands (one installation, one guild) and its reason is now simply that a single team has a single guild. The earlier reason, isolation promised to external customers, is void, and so is the machinery that was built to back that promise. This change replaces self-built mechanisms with the ones Discord already has:
default_member_permissionsplus Server Settings > Integrations./config,/queue,/setupand/audio-purgerequire Manage Server by default;/consent,/link,/aboutand/audio deletestay open. Discord does not deliver the interaction to a member without the permission, and the team's admins adjust it per role, user and channel in Integrations. The in-processrequire_admin()check is removed from those commands.docs/operations.mdanddocs/first-deployment.md.reconcile_guild, which is the chokepointon_guild_join,on_shard_ready,_tick_guild,/config applyand/setupall pass through. A foreign guild is reconciled into nothing and the refusal is logged with the two guild ids only, never a name.Why it is shaped this way
The failure this prevents is narrow: today nothing stops the bot being invited to a second guild and reconciling it, which would create configuration and write recordings of people who never consented to this installation into the team's database and bucket. The platform setting is the real protection; the guard exists so that a portal checkbox flipped by mistake costs a log line instead of a foreign recording. That is also why
STURNUS_GUILD_IDhas no default, for the same reasonSTURNUS_TRANSCRIPTION_BASE_URLhas none: it is a consent boundary./audio purgebecomes the top-level/audio-purgebecause Discord applies default permissions per top-level command. A subcommand cannot be stricter than its siblings, and/audio deletehas to stay available to every member, so purge had to leave the group.There is no Administrator fallback after the move. A second authority would disagree with Integrations the moment an admin restricted a command there: Discord would hide the command while the code admitted the same person by another route.
What it deliberately refuses to do
STURNUS_GUILD_IDwould otherwise make it leave the guild it is meant to serve.STURNUS_GUILD_ID.admin_role_idstays, with its mirror intoadmin_member: the console signs in through Outline OAuth and authorizes through that table, and its login is unchanged. Only the commands stop reading the role.OpenSpec
The branch carries the change
single-guild-instance(implemented here, tasks 1 to 4 and 5.1 done) andremove-multi-guild-machinery(proposed only, not implemented: gateway sharding and per-guild OAuth clients, to ship after this one is deployed). It also fixes the markdownlint configuration the specs needed.Still open after deployment
bot_public: falsemeans for a Team, so this needs a real check, recorded indocs/first-deployment.md.Checks
pytest -q2752 passed ·ruff check·ruff format --check·mypy(296 files) · consolevitest run1719 passed (56 files) ·vue-tsc --noEmit— all clean.BREAKING CHANGE:
STURNUS_GUILD_IDis required for the bot;/audio purgeis now/audio-purge; access to/config,/queue,/setupand/audio-purgeis governed byManage Server and Server Settings > Integrations instead of the admin role.