Repository navigation
test(backend): unskip validateBody 400-on-invalid-body tests - #769
Conversation
Both tests were marked .skip with a comment claiming validateBody didn't catch errors in certain scenarios. Tracing the middleware chain (requireAuth → requireGuildModuleAccess → writeLimiter → validateParams → validateBody) against the fixture setup in beforeEach (MOCK_SESSION_DATA authenticated, MOCK_GUILD_CONTEXT with full manage access, guildAccessService.hasAccess → true), validateBody should reach the Zod safeParse and return 400 on type-mismatch / missing-required-fields. Unskipping to verify; if a real regression surfaces, CI will show the actual failure rather than a silent skip.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 46 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
…ce (#775) * docs(backlog): mark completed 2026-04-21 backlog items with PR evidence 10 of the 16 tasks in docs/specs/2026-04-21-backlog-map/tasks.md already shipped — the unchecked state was sending future agents down dead ends. Splits the list into Open / Completed, cites the landing PR for each done item, and promotes the truly-remaining work to the top. Completed: - A-R2 token aliases (#763) - A-R3 SectionHeader eyebrowIcon + statusBand (#765) - PR #729 webhook coverage (ef06904) - tar Dependabot alerts (#766, replacing #755 which was closed) - PR queue rebase sweep — 14 PRs landed 2026-04-22 - Shared Top.gg constants (already in packages/shared/src/constants/topgg.ts) - validateBody + unskipped tests (#769) - Frontend token/font decision (#763) - Sonar coverage on #737 and #740 (both merged) Still open: follow-redirects/hono lock refresh, release/tag drift (production-visible), autoplay diversity dedup, queueManipulation refactor, /integrations page collapse (B-R4), BRANDING_GUIDE update (D-R2), per-page ports (13 pages). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(backlog): normalize version prefix (v2.6.148) per CodeRabbit Use `v` prefix consistently alongside `v2.6.132`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both tests were marked .skip with a comment claiming validateBody didn't catch errors in certain scenarios. Tracing the middleware chain (requireAuth → requireGuildModuleAccess → writeLimiter → validateParams → validateBody) against the fixture setup in beforeEach (MOCK_SESSION_DATA authenticated, MOCK_GUILD_CONTEXT with full manage access, guildAccessService.hasAccess → true), validateBody should reach the Zod safeParse and return 400 on type-mismatch / missing-required-fields. Unskipping to verify; if a real regression surfaces, CI will show the actual failure rather than a silent skip.
…ce (#775) * docs(backlog): mark completed 2026-04-21 backlog items with PR evidence 10 of the 16 tasks in docs/specs/2026-04-21-backlog-map/tasks.md already shipped — the unchecked state was sending future agents down dead ends. Splits the list into Open / Completed, cites the landing PR for each done item, and promotes the truly-remaining work to the top. Completed: - A-R2 token aliases (#763) - A-R3 SectionHeader eyebrowIcon + statusBand (#765) - PR #729 webhook coverage (a8edbe8) - tar Dependabot alerts (#766, replacing #755 which was closed) - PR queue rebase sweep — 14 PRs landed 2026-04-22 - Shared Top.gg constants (already in packages/shared/src/constants/topgg.ts) - validateBody + unskipped tests (#769) - Frontend token/font decision (#763) - Sonar coverage on #737 and #740 (both merged) Still open: follow-redirects/hono lock refresh, release/tag drift (production-visible), autoplay diversity dedup, queueManipulation refactor, /integrations page collapse (B-R4), BRANDING_GUIDE update (D-R2), per-page ports (13 pages). * docs(backlog): normalize version prefix (v2.6.148) per CodeRabbit Use `v` prefix consistently alongside `v2.6.132`. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>



Summary
Two integration tests in `packages/backend/tests/integration/routes/management.test.ts` were marked `.skip` with a note that `validateBody` wasn't catching errors in certain scenarios. Backlog item (`.claude/plans/backlog-2026-04-21.md`) flagged them.
Evidence that unskipping is safe
Middleware chain for both endpoints:
```
requireAuth
→ requireGuildModuleAccess('settings'|'commands', 'manage')
→ writeLimiter
→ validateParams(guildIdParam)
→ validateBody(...) ← the check under test
→ asyncHandler
```
`beforeEach` (file line 76) sets up:
Given this, a request to `PATCH /api/guilds/:guildId/automod/settings` with `{ spamThreshold: 'not a number' }` should reach `validateBody` with the body parsed (`spamThreshold: z.number().int().min(1).max(100).optional()` in `schemas/management.ts:16`), fail Zod's type check, and return 400. Same for `POST /api/guilds/:guildId/commands` with empty body — `name` is required per `createCommandBody`.
The skip comment was likely a carryover from an earlier middleware state. Unskipping in this PR to verify; if CI surfaces a real failure, we get actionable evidence instead of a silent skip.
Test plan
Risk
Zero. If the tests fail, CI catches it and this PR doesn't merge. If they pass, we eliminate 2 skipped negative-path tests from the backlog.
🤖 Generated with Claude Code