Skip to content

Conversation

@DGoel1602
Copy link
Contributor

@DGoel1602 DGoel1602 commented Feb 8, 2026

Why

CRON logging was a little cluttered in some places and not enough in others

What

Issue(s): #348

  • Updated logging for role-sync and reminders.
  • Removed reminders/hack for now.
  • Fixed early return in reminders

Test Plan

Tested all crons and their logging locally.

Checklist

  • Database: No schema changes, OR I have contacted the Development Lead to run db:push before merging
  • Environment Variables: No environment variables changed, OR I have contacted the Development Lead to modify them on Coolify BEFORE merging.

Summary by CodeRabbit

  • New Features

    • Enhanced error tracking and aggregated error reporting for role synchronization
  • Bug Fixes

    • Improved runtime logging for reminder event grouping and processing
    • Suppressed noisy permission-change logs to reduce clutter
  • Chores

    • Removed unused hack-related reminder scheduling
    • Clarified Sunday vs. non‑Sunday reminder flow and date formatting for more predictable execution paths

@DGoel1602 DGoel1602 self-assigned this Feb 8, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

Adds logging and restructures Sunday vs. non‑Sunday control flow in the reminder cron, aggregates and reports non‑404 errors while removing noisy logs in role‑sync, and removes the unused hackReminders import/schedule call from the cron index. (50 words)

Changes

Cohort / File(s) Summary
Reminder Task
apps/cron/src/crons/reminder.ts
Added runtime logging of totalEvents and per‑group details. Reworked Sunday vs non‑Sunday control flow: removed early return after Sunday handling and moved non‑Sunday date formatting and reminder sending into an else branch; final per‑prefix/event send loop remains.
Role‑Sync Task
apps/cron/src/crons/role-sync.ts
Introduced errorCount and erroredUsers to accumulate non‑404 per‑user errors and report up to five usernames; removed two verbose permission change logs; final summary now includes error count and sample errored users.
Cron Index
apps/cron/src/index.ts
Removed hackReminders from the import list and deleted its scheduled invocation; left preReminders and reminders imports/scheduling intact.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

Bug

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows the required format with issue number [#348], is concise, describes the main changes (CRON logging updates and reminders hook fixes), and stays well under the 72-character limit at 47 characters.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
No Hardcoded Secrets ✅ Passed No hardcoded API keys, passwords, tokens, or secrets found in modified files. All sensitive credentials properly sourced from environment variables.
Validated Env Access ✅ Passed All modified files correctly use validated env imports instead of direct process.env access, adhering to codebase conventions.
No Typescript Escape Hatches ✅ Passed The pull request contains no TypeScript escape hatches (any, @ts-ignore, @ts-expect-error, or non-null assertions) across reminder.ts, role-sync.ts, and index.ts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch crons/logging

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@DGoel1602 DGoel1602 added CRON Change modifies code in CRON app Minor Small change - 1 reviewer required labels Feb 8, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/cron/src/crons/reminder.ts`:
- Around line 140-148: The code duplicates work by recalculating the total in a
new variable total_events; instead remove the total_events declaration and
accumulation loop and reuse the already-computed totalEvents (from lines where
totalEvents is calculated) when logging the final count, while keeping the
groupedPrefixes iteration only for printing group/event details (use
groupedPrefixes and event.name/event.name references as before and replace
console.log(`Found a total of ${total_events} events`) with console.log(`Found a
total of ${totalEvents} events`)).
🧹 Nitpick comments (3)
apps/cron/src/crons/role-sync.ts (1)

37-37: Add explicit type annotation for erroredUsers.

Without an explicit type, TypeScript infers never[] (strict mode) or any[], which can cause type errors or bypasses type checking. Since you're storing user names (strings), annotate it explicitly:

✏️ Proposed fix
-    let erroredUsers = [];
+    let erroredUsers: string[] = [];

As per coding guidelines: "No TypeScript escape hatches: Flag usage of 'any' type... suggest... proper typing instead"

apps/cron/src/crons/reminder.ts (1)

166-168: Consider wrapping webhook calls in try-catch to prevent crashes.

Per cron guidelines, "Discord webhook failures should not crash the service." Currently, if webhook.send() fails (network issue, rate limit, invalid webhook), the entire cron will throw and terminate.

🛡️ Example pattern for resilient webhook calls
try {
  await webhook.send({ content: `...` });
} catch (error) {
  console.error(`Failed to send webhook message:`, error);
  // Optionally continue or abort gracefully
}

As per coding guidelines: "Discord webhook failures should not crash the service"

Also applies to: 177-179, 254-254

apps/cron/src/index.ts (1)

21-23: Placeholder mention won't notify anyone — consider a TODO with issue tracking.

@WHOEVER_IS_DEV_LEAD_RN isn't a valid GitHub mention and won't alert anyone. If this needs manual re-enabling for hackathons, consider linking to an issue or adding a more actionable TODO:

✏️ Suggested improvement
-// Silencing for now, needs to be manually re-enabled for hacks `@WHOEVER_IS_DEV_LEAD_RN`
+// TODO(`#348`): Re-enable hackReminders before next hackathon - requires manual activation by Dev Lead
 // hackReminders.schedule();

Copy link
Contributor

@DVidal1205 DVidal1205 left a comment

Choose a reason for hiding this comment

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

lgtm

@DGoel1602 DGoel1602 added this pull request to the merge queue Feb 8, 2026
Merged via the queue into main with commit f1ef2b0 Feb 8, 2026
8 checks passed
@DGoel1602 DGoel1602 deleted the crons/logging branch February 8, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CRON Change modifies code in CRON app Minor Small change - 1 reviewer required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants