Skip to content

#4412 Slack Delayed Meeting Messages - #4541

Open
Santiordon wants to merge 19 commits into
developfrom
#4412-slack-delayed-messages
Open

Santiordon wants to merge 19 commits into
developfrom
#4412-slack-delayed-messages

Conversation

@Santiordon

Copy link
Copy Markdown
Contributor

Changes

Slack messages now split into daily and hourly notifications.
Hourly activates event reminder notifications which sends a reminder to teams 48, 24, and 1 hour before the event.

Notes

Any other notes go here

Test Cases

  • Postman test to make sure events only fire once on 48, 24 and 1 hour intervals
  • Tests to make sure teams are collected correctly

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4412 (issue #)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Slack delivery can be reported successful before completion, and failed sends can permanently lose reminders.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 1 Low severity

Open (3)
What changed in this PR

Adds separate daily/hourly Slack workflows with persistent reminders at 48, 24, and 1 hour before events.

Changes:

  • Adds reminder tiers, persistence, routes, controllers, and hourly scheduling.
  • Updates notification helpers and daily workflow.
  • Adds channel collection tests.
File Description
src/​backend/​tests/​unit/​notifications.test.ts Tests channel collection helpers.
src/​backend/​src/​utils/​notifications.utils.ts Adds reminder and channel helpers.
src/​backend/​src/​transformers/​notifications.transformer.ts Defines reminder query relations.
src/​backend/​src/​services/​notifications.services.ts Implements hourly event reminders.
src/​backend/​src/​routes/​notifications.routes.ts Adds daily and hourly routes.
src/​backend/​src/​prisma/​schema.prisma Adds reminder models and tiers.
src/​backend/​src/​prisma/​migrations/​20260924202925_event_reminders/​migration.sql Creates reminder database structures.
src/​backend/​src/​controllers/​notifications.controllers.ts Handles notification endpoints.
.github/​workflows/​notifications-hourly.yml Schedules hourly notifications.
.github/​workflows/​notifications-daily.yml Updates the daily notification route.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/backend/src/services/notifications.services.ts Outdated
Comment thread src/backend/src/services/notifications.services.ts Outdated
Comment thread src/backend/src/utils/notifications.utils.ts Outdated

@wavehassman wavehassman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the root cause is GitHub scheduler. The new hourly workflow still uses GitHub's scheduler, so it'll be delayed too. Late runs won't send reminders after the meeting anymore, but they'll skip reminders: any 1-hour reminder whose run is more than about an hour late gets dropped. Can you look into other ways to do this? I'm thinking of triggering /notifications/hourly and /notifications/daily from AWS EventBridge Scheduler instead of GitHub cron, since the backend is already on AWS, but lmk if you find something different

teamSlackIds.add(team.slackId);
}
});
console.log(candidates);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove this

}
}

// /**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you can just delete all this

import { HttpException } from '../utils/errors.utils.js';
import { Reimbursement_Status_Type } from '@prisma/client';
import { scheduleTimesTransformer } from '../transformers/calendar.transformer.js';
import { HOUR_MS } from '../prisma/dates.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this the seed data file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I went ahead and moved it to a more general file. I am editing the seed data files to use the more general one too.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/backend/src/integrations/slack.ts Outdated
Comment thread src/backend/src/services/notifications.services.ts Outdated
Comment thread src/backend/src/utils/auth.utils.ts Outdated
Comment thread src/backend/src/utils/auth.utils.ts Outdated
Comment thread src/cron/Dockerfile
Comment thread src/cron/src/jobs/hourly-notifications.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/backend/src/services/notifications.services.ts Outdated
Comment thread src/backend/src/utils/notifications.utils.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical reminder delivery, claim, and retry issues remain unresolved, along with workflow and seed determinism fixes.

3 open findings
2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Seed helper uses nondeterministic wall-clock defaults

src/​backend/​src/​prisma/​dates.ts:9

This makes the seed helper silently fall back to the wall clock whenever a caller omits either bound. The seed-time contract explicitly says generation is anchored to SEED_REFERENCE_DATE and that only realNow() may use the real clock, so a future unbounded call would make CI data nondeterministic. Keep from and to required and pass them directly to Faker.

🧠 Review effort: Lite

Comment thread src/backend/src/services/notifications.services.ts Outdated
Comment thread src/backend/src/services/notifications.services.ts Outdated
Comment thread src/backend/src/services/notifications.services.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Three moderate review findings remain unresolved.

0 open findings

3 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Ensure notification curl fails on HTTP errors

.github/​workflows/​notifications-daily.yml:14

Plain curl exits successfully for HTTP 401/500 responses, so a failed daily notification request will be recorded as a successful workflow run and will not be surfaced for retry. Use the same fail-on-HTTP-error behavior as the hourly workflow.

Medium severity Keep seed date bounds required for deterministic behavior

src/​backend/​src/​prisma/​dates.ts:10

This makes the seed date helper silently fall back to wall-clock time whenever a caller omits a bound, reintroducing the nondeterminism that seed-time.ts explicitly forbids. The previous signature required both dates, and all current callers already pass them; keep both parameters required instead of using Date.now().

🧠 Review effort: Lite

@wavehassman
wavehassman self-requested a review October 14, 2026 01:55

@wavehassman wavehassman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this schedule is back after the revert, once the bay container is live, won't every message will go out twice. Can we switch it to workflow_dispatch?

Also, should figure out if the bay compose file has restart: unless-stopped, and whether it come back up after a reboot, since it'll be the only thing sending notifications now


export default class NotificationsService {
static async sendDailySlackNotifications() {
await NotificationsService.sendTaskDeadlineSlackNotifications();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we move sendEventSlackNotifications() above this? Events are more time-sensitive, so they shouldn't wait on task deadline sends if Slack is slow

export default defineJob({
name: 'daily-notifications',
schedule: '0 9 * * *',
endpoint: '/notifications/task-deadlines'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The endpoint does all its Slack sends before it responds, and the default timeout is 60s. On a slow Slack day this logs FAILED even though the messages went out. Make it timeoutMs: 10 * 60_000?

This branch has not been deployed

No deployments
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.

[Maintenance] - Slack Delayed Meeting Message

3 participants