Skip to content

[dev] [claudfuen] fix/suppress-inactive-org-emails#2494

Merged
tofikwest merged 3 commits intomainfrom
fix/suppress-inactive-org-emails
Apr 10, 2026
Merged

[dev] [claudfuen] fix/suppress-inactive-org-emails#2494
tofikwest merged 3 commits intomainfrom
fix/suppress-inactive-org-emails

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

This is an automated pull request to merge fix/suppress-inactive-org-emails into dev.
It was created by the [Auto Pull Request] action.

Skip organizations where no member has logged in within 90 days.
Prevents sending emails to dead/abandoned addresses that may have
become spam traps, which contributes to domain reputation damage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Apr 10, 2026 3:07pm
comp-framework-editor Ready Ready Preview, Comment Apr 10, 2026 3:07pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Apr 10, 2026 3:07pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 10, 2026

PR Summary

Medium Risk
Changes the org-selection query for a scheduled email job, which could unintentionally exclude eligible organizations or increase DB load due to deeper relational filtering on sessions.updatedAt.

Overview
Weekly task reminder emails are now suppressed for inactive organizations by filtering to orgs with hasAccess, onboardingCompleted, and at least one non-deactivated member with a session updated within the last ORG_INACTIVITY_DAYS (90).

Logging was updated to reflect the new “active org” filtering and the inactivity window.

Reviewed by Cursor Bugbot for commit 16adc03. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds hasAccess and onboardingCompleted filters alongside the 90-day
session check. This excludes ~4,087 orgs (831 ghost + 3,256 churned)
from receiving weekly digest emails.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest left a comment

Choose a reason for hiding this comment

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

Looks good overall, clean change, correct logic, safe to merge

One request: add deactivated: false to the members.some filter in the where clause, so it matches the same member scope used in the select:

The select.members.where already excludes deactivated members when building email payloads, but the org-level activity check doesn't

Per Tofik's review - match the same member scope used in the
select clause so deactivated members don't count as active.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@claudfuen claudfuen left a comment

Choose a reason for hiding this comment

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

Added deactivated:false to members.some in 16adc03. Good catch.

@vercel vercel bot temporarily deployed to Preview – portal April 10, 2026 15:05 Inactive
@tofikwest tofikwest merged commit 65a5e7a into main Apr 10, 2026
11 checks passed
@tofikwest tofikwest deleted the fix/suppress-inactive-org-emails branch April 10, 2026 15:15
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.20.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants