fix: drop dead guild-guard entry for nonexistent features route

Merged
LU
3mo ago
+3-32

Summary

  • `/api/guilds/:id/features` had a guard registered in `guildGuardConfigs` but no matching route handler anywhere — the real feature-toggle endpoint is the global `/api/features`, not per-guild.
  • Harmless at runtime (an app.use() guard on a path nothing registers just never fires), but paired with a stale `WEBAPP_SETUP.md` documenting per-server toggle endpoints that don't exist.
  • Found during a security review of the guild-authorization guard table (verified every other guild-scoped route file is genuinely covered by `guildGuardConfigs`; this was the one orphan).

Changes

  • Remove the dead entry from `guildGuardConfigs` (routes/index.ts)
  • Correct `docs/WEBAPP_SETUP.md` to describe the actual (global-only) feature toggle API
  • Drop the two test assertions in `index.test.ts` that were locking in the orphaned guard registration

Test plan

  • `npm run type:check --workspace=packages/backend`
  • `npm run lint --workspace=packages/backend` (0 errors, pre-existing unrelated warnings only)
  • `npm run test --workspace=packages/backend -- --ci` — 85/85 suites, 1352/1352 tests passing

Fixes #2029


Summary by cubic

Removes the orphaned guild guard for /api/guilds/:id/features and updates docs to reflect the actual global feature-toggle API. Old behavior: guard registered for a route that doesn’t exist. New behavior: guard removed, docs corrected; no runtime behavior change.

  • Drops the dead entry from guildGuardConfigs in packages/backend/src/routes/index.ts.
  • Updates docs/WEBAPP_SETUP.md to remove per-guild toggles and document /api/toggles/global and /api/features (authenticated, read-only).
  • Removes two test assertions in packages/backend/tests/unit/routes/index.test.ts that locked in the orphaned guard.
  • Confirms other guild-scoped routes remain guarded; no authorization coverage regression.
  • Satisfies Linear #2029. No migrations; clients already use the global endpoints.