Skip to content

[ENG-11524][ENG-11709] Project ENTER - #11803

Merged
cslzchen merged 32 commits into
developfrom
feature/project-enter
Aug 5, 2026
Merged

[ENG-11524][ENG-11709] Project ENTER#11803
cslzchen merged 32 commits into
developfrom
feature/project-enter

Conversation

@cslzchen

@cslzchen cslzchen commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Ticket

https://openscience.atlassian.net/browse/ENG-11709
https://openscience.atlassian.net/browse/ENG-11524

Purpose

Project Enter: see project requirements & documents

Changes

See child PRs

QA Notes

See QA testing plan

CE Notes

See release playbook

Documentation

N/A

Ostap-Zherebetskyi and others added 30 commits July 8, 2026 13:31
* Add blank notification type and template
* Respond to CR

---------

Co-authored-by: Longze Chen <cslzchen@gmail.com>
…TER - Part 1 (#11805)

* Implement notification campaign models and email handling
  - Add NotificationCampaign and NotificationCampaignRecipient models.
  - Introduce notification campaign status management.
  - Update OSFUser model to track received notification campaigns.
  - Enhance email templates for notification campaigns.
  - Create migration for new models and relationships.
* Remove notification settings table from blank email template
* Code clean-up and fixes

---------

Co-authored-by: Longze Chen <cslzchen@gmail.com>
…min Page (#11808)

* Add Notification Campaign management features including forms, views, and templates
* Add support for restarting failed notification campaigns and update progress metrics
* Prevent updating recipient count on campaign restart
…logging (#11814)

* Add developer reminder status and update notification campaign recipient status choices
* Handle campaign failure status and log execution time window in send_campaign_batch
* Add Sentry logging for campaign retries and execution time window
* Improve campaign logging

---------

Co-authored-by: Longze Chen <cslzchen@gmail.com>
…nd spam status (#11815)

* sort recipients by activity priority
* simplify filter; send campaign email tasks in 3 phases
* add global values to defaults and admin campaign metadata fields
* Add recipients list and preview views for notification campaigns
…nts; rework campaign workflow (#11825)

* Refactor notification campaign logic: create recipients in batches, add run_id to models, and improve filtering by activity score
* Update notification campaign logic
* Update sendgrid bulk
* Handle email sending errors in send_campaign_batch: log exceptions and update recipient statuses
* Improve error logging

---------

Co-authored-by: antkryt <ant.krytskyi@gmail.com>
* unit tests on ordering and filtering
* fix recipients ordering
* Add sendgrid_bulk field to NotificationCampaignCreateForm and handle errors in context and filters; update notification campaign views and templates for improved messaging and recipient handling
* Add sendgrid_bulk field to NotificationCampaignCreateForm and update notification campaign processing logic
* Fix campaign recipient query to filter only by FAILED status when restarting failed campaigns
* Refactor notification campaign recipient status handling and improve message display in templates
* Add functionality to restart stuck notification campaigns
* Add support for restarting stuck notification campaigns
…enter

Fixed conflicts for imports in osf/models/user.py
* Add unit tests for notification campaign flow and admin (part 1)
…#11836)

* Add time window field to NotificationCampaignCreateForm and update templates for campaign details and recipients
* Add cancel functionality to NotificationCampaign and update UI for campaign management
* Refactor process_campaign_retry to handle cancelled campaigns and improve retry logic
* Add run_id check to process_campaign_retry to prevent incorrect retries
* Fix unit tests
* Update notification campaign permissions in views and tests
* fix test_start_rejects_when_another_campaign_is_running
* Update notification campaign flow and admin unit tests
)

* Create confirmed test user with fake activity points
* Respond to CR with improvements
…rt 2 (#11840)

* Update command to create more users with different status and options
…ers to use a dynamic query builder + Bug fixes (#11842)

* Refactor notification campaign filters to use a dynamic query builder and streamline filter handling in the UI
* Refactor campaign recipient filters to use Q objects and dynamic query building
* Enhance notification campaign creation UI with improved group structure and styling
* Remove copy
* Refactor initial state handling in filter mode to improve readability
* Add manual filter validation and improve filter display in notification campaigns
* Change notification campaign time window to be in seconds
…11848)

* Additional user lookups for notification campaign
…mpaign and batches (#11850)

* Add and normalize logs and sentry messages for campaign and batches
* Fix type in logs
* Add time check and logging for each notification emit in batch
* Sort campaigns list by created time
* Keep developer reminder even if campaign is finished
* Enforce manual filters values cannot be none or empty
…o-migration

[ENG-11904][ENG-11910] Merge `develop` + redo migration + DevQA Fixes
@cslzchen cslzchen changed the title [TBD] Reference PR for Project ENTER [ENG-11524][ENG-11709] Project ENTER Aug 5, 2026
@cslzchen
cslzchen marked this pull request as ready for review August 5, 2026 13:06
…y tasks (#11857)

* Add separate queue for notification campaign tasks

@antkryt antkryt 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.

LGTM

@cslzchen cslzchen left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

2nd pass done

Comment thread admin/templates/notifications/notification_campaing_recipients_list.html Outdated
Comment thread admin/templates/notifications/notification_campaing_recipients_preview.html Outdated
Comment on lines +201 to +202
ESTIMATED_BATCH_RUN_TIME_THRESHOLD = DEFAULT_CAMPAIGN_WINDOW_TIME / (ESTIMATED_EIGHT_HOUR_WINDOW_USERS / DEFAULT_CAMPAIGN_BATCH_SIZE) # By default, 48 seconds per batch of 1000 requests
ESTIMATED_PER_REQUEST_THRESHOLD = ESTIMATED_BATCH_RUN_TIME_THRESHOLD / DEFAULT_CAMPAIGN_BATCH_SIZE # By default, 0.048 seconds (21 requests / second)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This threshold are estimates if we only had one worker working on one batch at the same time and we set them very high so that we can sentry log batch and request timing.

On production, after we verified the SendGrid request speed on production, we can override/loose both so we don't flood production sentry with 2M errors.

ESTIMATED_BATCH_RUN_TIME_THRESHOLD = 180  # 3 min, could lower to 2 min if production SendGrid is faster
ESTIMATED_PER_REQUEST_THRESHOLD = 0.2  # 200ms, could lower to 0.15 if production SendGrid is faster

Comment thread admin/templates/notifications/notification_type_preview.html
Comment thread admin/templates/notifications/notification_type_preview.html Outdated
Co-authored-by: Longze Chen <cslzchen@gmail.com>
@cslzchen
cslzchen force-pushed the feature/project-enter branch from ac3d839 to d52032c Compare August 5, 2026 19:28

@cslzchen cslzchen left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@cslzchen
cslzchen merged commit 209361a into develop Aug 5, 2026
16 checks passed
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.

4 participants