feat: ISSUE-399 — per-guild role names from guild_configs for verification#406
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a guild_configs persistence layer and updates verification/role provisioning to use per-guild configured role names (instead of env-derived constants), including startup seeding and updated tests.
Changes:
- Introduces
guild_configstable + repository/service APIs, plus an env-based seeder to bootstrap missing rows. - Updates verification role assignment/removal and default role creation to take role names from
GuildConfig(or skip when missing). - Adjusts startup + interaction handlers and updates unit/integration tests; adds a separate integration-test Jest script.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/role.services.ts | Role assignment/removal now takes verifiedRoleName; default role creation reads names from `GuildConfig |
| src/services/tests/role.services.test.ts | Updates tests to be param-based and adds null-config warn/skip coverage. |
| src/interactions/verifyButton.ts | Loads guild config per interaction and passes verifiedRoleName through to role services. |
| src/interactions/tests/verifyButton.test.ts | Mocks getGuildConfigOrNull and adds guild id to the interaction stub. |
| src/index.ts | Seeds guild configs on startup and uses per-guild config when ensuring roles on startup/guild join. |
| src/domain/guild-config/guild-config.service.ts | Adds getGuildConfigOrNull and isFeatureEnabledForGuild. |
| src/domain/guild-config/guild-config.seeder.ts | Adds env → DB seeding for missing guild config rows. |
| src/domain/guild-config/guild-config.repository.ts | Adds DB read/upsert APIs and row→domain mapping for guild_configs. |
| src/domain/guild-config/tests/guild-config.service.test.ts | Unit tests for service wrapper and feature flag helper. |
| src/domain/guild-config/tests/guild-config.seeder.test.ts | Unit tests for env seeding behavior and patch construction. |
| src/domain/guild-config/tests/guild-config.repository.test.ts | Unit tests for repository SQL shape and mapping. |
| src/domain/guild-config/tests/guild-config.repository.integration.test.ts | Adds optional integration tests requiring real Postgres + migrations. |
| src/config/roles.config.ts | Removes VERIFIED_ROLE_NAME export and trims other role exports per new approach. |
| src/tests/index.startup-readonly.test.ts | Mocks guild-config modules for startup wiring tests. |
| package.json | Adjusts test scripts to exclude integration tests by default and adds test:integration. |
| migrations/1776961242514_add-guild-configs.cjs | Adds guild_configs table with defaults. |
| CLAUDE.md | Adds implementation protocol guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ation Replace static DEFAULT_ROLES env reads with per-guild GuildConfig values. addMissingDefaultRoles accepts GuildConfig | null (warn+skip when null); assignVerifiedRole and removeVerifiedRole accept an explicit verifiedRoleName param; verifyButton loads guild config and passes the name through.
6bf0806 to
1328be5
Compare
demianseiler
approved these changes
May 15, 2026
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.
Summary
addMissingDefaultRolesnow acceptsGuildConfig | null; when null it logs a warning and skips instead of throwingassignVerifiedRoleandremoveVerifiedRoleaccept an explicitverifiedRoleName: stringparam instead of reading a static env-derived constantverifyButton.tsloads guild config viagetGuildConfigOrNulland passesguildConfig.verifiedRoleNamethrough to both role functionsindex.tsloads guild config per guild on startup and onguildCreate, passing it toaddMissingDefaultRolesroles.config.tsstripped ofVERIFIED_ROLE_NAME,DEFAULT_ROLE_NAMES, andREQUIRED_ROLESexports — onlyTEMP_MEMBER_ROLE_NAMEandPOTENTIAL_APPLICANT_ROLE_NAMEremain (purge job, cleaned up in feat: ISSUE-396 — guild config refactor — purge job + .env.template cleanup #402)Test plan
role.services.test.ts— updated: 3 env-var-based tests replaced with param-based equivalents; null guildConfig warn+skip test addedverifyButton.test.ts—getGuildConfigOrNullmock added; guild id added to interaction stubindex.startup-readonly.test.ts—guild-config.service.jsmock added to all 3 test setupsnpm run qualitypasses (700 tests, 48 suites)Closes #399