Skip to content

feat: ISSUE-399 — per-guild role names from guild_configs for verification#406

Merged
GitAddRemote merged 1 commit into
mainfrom
feature/ISSUE-399
May 15, 2026
Merged

feat: ISSUE-399 — per-guild role names from guild_configs for verification#406
GitAddRemote merged 1 commit into
mainfrom
feature/ISSUE-399

Conversation

@GitAddRemote
Copy link
Copy Markdown
Collaborator

Summary

  • addMissingDefaultRoles now accepts GuildConfig | null; when null it logs a warning and skips instead of throwing
  • assignVerifiedRole and removeVerifiedRole accept an explicit verifiedRoleName: string param instead of reading a static env-derived constant
  • verifyButton.ts loads guild config via getGuildConfigOrNull and passes guildConfig.verifiedRoleName through to both role functions
  • index.ts loads guild config per guild on startup and on guildCreate, passing it to addMissingDefaultRoles
  • roles.config.ts stripped of VERIFIED_ROLE_NAME, DEFAULT_ROLE_NAMES, and REQUIRED_ROLES exports — only TEMP_MEMBER_ROLE_NAME and POTENTIAL_APPLICANT_ROLE_NAME remain (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 added
  • verifyButton.test.tsgetGuildConfigOrNull mock added; guild id added to interaction stub
  • index.startup-readonly.test.tsguild-config.service.js mock added to all 3 test setups
  • npm run quality passes (700 tests, 48 suites)

Closes #399

Copilot AI review requested due to automatic review settings April 23, 2026 17:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_configs table + 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.

Comment thread src/index.ts Outdated
Comment thread package.json Outdated
Comment thread src/interactions/verifyButton.ts
…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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@GitAddRemote GitAddRemote requested a review from demianseiler May 15, 2026 22:01
@GitAddRemote GitAddRemote merged commit 3c05998 into main May 15, 2026
4 checks passed
@GitAddRemote GitAddRemote deleted the feature/ISSUE-399 branch May 15, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: guild config refactor — verification and role names

3 participants