Skip to content

Add backend Slack alert support with change-stream service and Team UI wiring#162

Draft
vkarpov15 wants to merge 1 commit intomainfrom
codex/add-change-stream-alerting-with-slack-integration
Draft

Add backend Slack alert support with change-stream service and Team UI wiring#162
vkarpov15 wants to merge 1 commit intomainfrom
codex/add-change-stream-alerting-with-slack-integration

Conversation

@vkarpov15
Copy link
Member

Motivation

  • Persist workspace alert configurations in the studio DB so alerts survive restarts and can be managed via the Team UI.
  • Route Slack test messages through the backend rather than calling the mothership directly from the frontend.
  • Deliver change-stream-driven Slack notifications in a concurrency-safe way to avoid duplicate sends when multiple processes are running.

Description

  • Added a studio-backed Alert model (backend/db/alertSchema.js) and CRUD/test actions under backend/actions/Alert (createAlert, updateAlert, listAlerts, deleteAlert, sendTestAlert).
  • Implemented backend/alerts/alertUtils.js for template rendering and mothership notification, and backend/alerts/startAlertService.js which listens to the MongoDB change stream, caches enabled alerts, and delivers Slack notifications; leader leasing is implemented via a studio__alertLeases collection to ensure a single leader process handles deliveries.
  • Wired service startup in backend/index.js to register the __Studio_Alert model and start the alert service when options.changeStream is enabled, and switched db.watch() to db.watch([], { fullDocument: 'updateLookup' }) to get full documents on updates.
  • Frontend changes: added Alert methods to frontend/src/api.js, and updated the Team alert wizard (frontend/src/team/team.js and frontend/src/team/team.html) to load/save alerts from the backend, send test alerts via Alert.sendTestAlert, show save/test status, and disable UI while saving.
  • Updated backend/authorize.js to include required roles for the new Alert.* actions.

Testing

  • Rebuilt frontend CSS with npm run tailwind, which completed successfully.
  • Built frontend bundle with node build.js (webpack compiled successfully).
  • Launched a simple local express stub for API endpoints and used a Playwright script to open /#/team and capture a screenshot of the alert wizard, which ran and produced an artifact.
  • No automated integration tests were added; manual smoke tests above passed.

Codex Task

@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio Ready Ready Preview, Comment Feb 3, 2026 11:09am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant