Skip to content

Added escalation email function with the help of Github Copilot#183

Open
Aulakh1881 wants to merge 16 commits intoramfam101:developfrom
Aulakh1881:develop
Open

Added escalation email function with the help of Github Copilot#183
Aulakh1881 wants to merge 16 commits intoramfam101:developfrom
Aulakh1881:develop

Conversation

@Aulakh1881
Copy link
Copy Markdown

@Aulakh1881 Aulakh1881 commented Apr 9, 2026

(Please remove this line only before submitting your PR. Ensure that all relevant items are checked before submission.)

Describe your changes

Briefly describe the changes you made and their purpose.

Write your issue number after "Fixes "

Fixes #123

Please ensure all items are checked off before requesting a review. "Checked off" means you need to add an "x" character between brackets so they turn into checkmarks.

  • (Do not skip this or your PR will be closed) I deployed the application locally.
  • (Do not skip this or your PR will be closed) I have performed a self-review and testing of my code.
  • I have included the issue # in the PR.
  • I have added i18n support to visible strings (instead of <div>Add</div>, use):
const { t } = useTranslation();
<div>{t('add')}</div>
  • I have not included any files that are not related to my pull request, including package-lock and package-json if dependencies have not changed
  • I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application).
  • I made sure font sizes, color choices etc are all referenced from the theme. I don't have any hardcoded dimensions.
  • My PR is granular and targeted to one specific feature.
  • I ran npm run format in server and client directories, which automatically formats your code.
  • I took a screenshot or a video and attached to this PR if there is a UI change.

Created escalation automation feature with the help of Github Copilot, as described in the assignment requirements.

Copilot AI review requested due to automatic review settings April 9, 2026 00:11
Copy link
Copy Markdown

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 an “escalation after N minutes” capability for monitors so that, if a monitor remains down long enough, additional notification channels can be alerted. This extends the monitor model (DB + types + validation), updates notification message building, and adds a Create Monitor UI section + translations.

Changes:

  • Add escalation configuration fields (escalateAfterMinutes, escalationNotifications) and a statusChangedAt timestamp to support time-based escalation.
  • Add a new notification message type (escalation_alert) and route escalation notifications via NotificationsService.
  • Update the Create Monitor form + English locale strings to configure escalation rules.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
server/src/validation/monitorValidation.ts Accepts escalation-related fields in create/edit monitor validation.
server/src/types/notificationMessage.ts Adds escalation_alert notification message type.
server/src/types/monitor.ts Adds statusChangedAt, escalateAfterMinutes, escalationNotifications to the monitor shape.
server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts Adds an additional “escalation check” notification path during monitor jobs.
server/src/service/infrastructure/statusService.ts Persists statusChangedAt whenever status changes.
server/src/service/infrastructure/notificationsService.ts Adds escalation routing logic and introduces a Telegram provider path.
server/src/service/infrastructure/notificationProviders/email.ts Adds email subject handling for escalation_alert.
server/src/service/infrastructure/notificationMessageBuilder.ts Adds escalation-specific message building logic.
server/src/repositories/monitors/MongoMonitorsRepository.ts Maps escalation fields + statusChangedAt between Mongo docs and entities.
server/src/db/models/Monitor.ts Adds schema fields for escalation + statusChangedAt.
server/package-lock.json Updates lockfile (adds pg, bumps super-simple-scheduler, and other dependency changes).
client/src/Validation/monitor.ts Adds Zod validation for escalation fields on the client.
client/src/Types/Monitor.ts Adds escalation fields to client monitor type.
client/src/Pages/CreateMonitor/index.tsx Adds an “Escalation Rules” section to the Create Monitor form.
client/src/locales/en.json Adds translations for escalation rules + Telegram configuration strings.
client/src/Hooks/useMonitorForm.ts Adds default form values for escalation fields.
Files not reviewed (1)
  • server/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

server/src/service/infrastructure/notificationsService.ts:55

  • NotificationsService now requires a telegramProvider constructor parameter, but the service wiring needs to be updated accordingly (e.g., server/src/config/services.ts currently constructs new NotificationsService(...) without this argument). As-is, this change will break compilation/runtime initialization.
	constructor(
		notificationsRepository: INotificationsRepository,
		monitorsRepository: IMonitorsRepository,
		webhookProvider: INotificationProvider,
		emailProvider: INotificationProvider,
		slackProvider: INotificationProvider,
		discordProvider: INotificationProvider,
		pagerDutyProvider: INotificationProvider,
		matrixProvider: INotificationProvider,
		teamsProvider: INotificationProvider,
		telegramProvider: INotificationProvider,
		settingsService: ISettingsService,
		logger: ILogger,
		notificationMessageBuilder: INotificationMessageBuilder
	) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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