Skip to content

feat(alerting): add Sentry integration configuration to dashboard#1038

Merged
aaight merged 1 commit intodevfrom
feature/sentry-alerting-dashboard
Mar 24, 2026
Merged

feat(alerting): add Sentry integration configuration to dashboard#1038
aaight merged 1 commit intodevfrom
feature/sentry-alerting-dashboard

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 24, 2026

Summary

  • Adds an Alerting tab to the Integrations page (alongside PM and SCM) with a full Sentry configuration UI
  • Expands the projects.integrations tRPC endpoints to accept 'alerting' as a valid category (previously only 'pm' and 'scm')
  • Adds a new verifySentry mutation to integrationsDiscovery router that validates an API token + org slug against the Sentry API
  • Implements the AlertingTab component with organization slug field, credential fields (SENTRY_API_TOKEN, SENTRY_WEBHOOK_SECRET), inline verification, copyable webhook URL, save and delete integration

Card: https://trello.com/c/69c29137d68698a9e8549cbb

Changes

Backend (src/api/routers/projects.ts)

  • Updated integrations.upsert, integrations.updateTriggers, and integrations.delete to accept z.enum(['pm', 'scm', 'alerting']) instead of z.enum(['pm', 'scm'])

Backend (src/api/routers/integrationsDiscovery.ts)

  • Added verifySentry mutation: accepts { apiToken, organizationSlug }, raw-fetches https://sentry.io/api/0/organizations/{slug}/ with Bearer auth, returns { id, name, slug } on success, wraps errors via wrapIntegrationCall() per existing pattern

Frontend (web/src/components/projects/integration-form.tsx)

  • Extended IntegrationCategory type to include 'alerting'
  • Added Alerting TabButton to the tab bar
  • Added AlertingTab component following SCM tab patterns:
    • Organization slug text input (pre-populated from existing config)
    • ProjectSecretField for SENTRY_API_TOKEN with inline verification (shows org name on success)
    • ProjectSecretField for SENTRY_WEBHOOK_SECRET (optional)
    • Read-only copyable Sentry webhook URL: <BASE_URL>/sentry/webhook/<projectId>
    • Save button → calls projects.integrations.upsert with category: 'alerting', provider: 'sentry'
    • Delete button → calls projects.integrations.delete with category: 'alerting'
  • Wired alertingIntegration data via findIntegrationByCategory(integrations, 'alerting') for pre-population

Tests

  • tests/unit/api/routers/projects.test.ts: Added tests for alerting category in upsert and delete, plus rejection of unknown categories
  • tests/unit/api/routers/integrationsDiscovery.test.ts: Added full verifySentry test suite (success, missing fields, 401 error, network failure, URL-encoding, UNAUTHORIZED, empty input validation)

Test plan

  • All 6837 unit tests pass
  • TypeScript type checks pass (backend + frontend)
  • Biome lint passes with no issues
  • Manual: Navigate to Integrations → Alerting tab → enter org slug + API token → click Verify → confirm org name appears → Save → reload → confirm pre-populated → copy webhook URL → Delete

Notes

  • No DB migration needed — project_integrations.category is a TEXT column, not a DB enum
  • Sentry credential roles (SENTRY_API_TOKEN, SENTRY_WEBHOOK_SECRET) and the 'alerting' category were already pre-registered in src/config/integrationRoles.ts
  • Only SaaS Sentry (sentry.io) is supported; self-hosted support can be added later via an optional baseUrl field

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

LGTM — Clean, well-structured addition that follows established codebase patterns consistently.

The verifySentry backend mutation mirrors the existing verifyGithubToken/verifyTrello/verifyJira pattern (protectedProcedure + wrapIntegrationCall + input validation). The Zod enum expansion across upsert/updateTriggers/delete is correct and minimal. The frontend AlertingTab follows the same conventions as SCMTab (mutation/query patterns, ProjectSecretField usage, query invalidation). Sentry credential roles and the 'alerting' category were already pre-registered in integrationRoles.ts, so no migration or schema changes are needed. Test coverage is thorough across all new code paths. All CI checks pass.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit 47f5a60 into dev Mar 24, 2026
9 checks passed
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.

2 participants