Skip to content

Conversation

Johnetordoff
Copy link
Contributor

@Johnetordoff Johnetordoff commented May 20, 2025

Purpose

This system is designed to formalize and consolidate OSF Notifications under one system in order to better facilitate collaboration between Product, Engineers and QA and end persistent problems with notification email related tech debt. This project is the result of an extensive audit of all OSF emails and combined email digests and seeks to move the NotificationSubscription model out of it's transitional state having been migrated from a document based model, into it's final data model which is more regular for a relation our current relational database (django's postgress db).

In order to do this I have taken @mfraezz design documents and implemented them with minor changes. This means the responsibility for sending notifications in osf.io is shared by three new models, which will have the old data migrated into them via a migration script and management command. The models are:

  • NotificationType

    • Similar to RegistrationSchemas or Waffle flags these are in db instrances which are poulated from static config documents in this case yaml.
    • Since these are synced on migration with notification.yaml a developer will be able to see at a glance if where a notification template is and what it's purpose is.
  • NotificationSubscription

    • This model is somewhat analogous to the earlier EmailDigest model, this holds references to potentially many Notifcations models that can be compiled into a single digest this is sent at a periodic basis.
  • Notification

    • Holds message information and context
    • Unlike earlier implementations this will record each Notification creation and sending for metrics purposes.

Changes

  • Combines worker with beat in docker-compose
  • creates notifications.yaml to contain all notification types info it is populated via postmigrate hook
  • creates new Notification NotificationSubscription and NotificationType
  • adds migrations to rename legacy tables and a managment command to populate the new ones.
  • Deletes old send_mails method and replaces it with emit of NotificationType
  • adds tests and updates old mocking
  • updates views and permission classed
  • A slight change to handle_boa_error to pass the already decanted user object.
  • adds new data model for Notification, NotificationTypes and Subscriptions
  • creates a notifications.yaml for data dependency notificationtypes
  • add migrations
  • updates notifications to use NotificationTypes
  • updates Admin app to control email templates
  • updates metrics reporter to count notifications sent etc.
  • updates tests to all use capture_notifications mocking util
  • Removes queued_mail
  • Removes EmailDigest
  • Removes detect_duplicates for duplicate subscriptions

QA Notes

Please make verification statements inspired by your code and what your code touches.

  • Verify
  • Verify

What are the areas of risk?

Any concerns/considerations/questions that development raised?

Documentation

Side Effects

Ticket

https://openscience.atlassian.net/browse/ENG-8064

@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch 4 times, most recently from 3a8b414 to 57b0bd1 Compare May 21, 2025 14:42
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from 2b8ba0d to c449599 Compare June 9, 2025 13:40
@Johnetordoff Johnetordoff changed the base branch from feature/pbs-25-10 to refactor-notifications June 13, 2025 14:40
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch 3 times, most recently from ad18e9d to 300524c Compare July 3, 2025 14:20
@Johnetordoff Johnetordoff marked this pull request as ready for review July 8, 2025 20:05
@Johnetordoff Johnetordoff force-pushed the refactor-notifications branch from 2dee1b2 to 2dbcbf7 Compare July 10, 2025 15:50
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch 4 times, most recently from 9238258 to 37b419a Compare July 10, 2025 20:24
@Johnetordoff Johnetordoff force-pushed the refactor-notifications branch from afc3815 to b6bbeed Compare July 11, 2025 13:02
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch 12 times, most recently from 7e0259f to 19c838d Compare July 17, 2025 14:46
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from 30a0392 to a6e3ee8 Compare July 17, 2025 19:29
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from 22e81be to 6816040 Compare September 1, 2025 17:58
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from 3ca708c to 5d0b6b4 Compare September 2, 2025 00:20
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from 5d0b6b4 to b8fdc80 Compare September 2, 2025 00:35
John Tordoff and others added 3 commits September 1, 2025 20:47
…/centerforopenscience/osf.io into add-new-notifications-data-model

* 'add-new-notifications-data-model' of https://github.com/centerforopenscience/osf.io:
  fix more test stuff

# Conflicts:
#	osf/models/schema_response.py
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch 2 times, most recently from 58799fc to beded5e Compare September 2, 2025 15:24
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from beded5e to 80ab307 Compare September 2, 2025 16:54
 into add-new-notifications-data-model

# Conflicts:
#	addons/boa/tests/test_tasks.py
#	api_tests/crossref/views/test_crossref_email_response.py
#	api_tests/draft_registrations/views/test_draft_registration_contributor_list.py
#	api_tests/draft_registrations/views/test_draft_registration_list.py
#	api_tests/institutions/views/test_institution_relationship_nodes.py
#	api_tests/mailhog/test_mailhog.py
#	api_tests/nodes/views/test_node_contributors_list.py
#	api_tests/nodes/views/test_node_forks_list.py
#	api_tests/nodes/views/test_node_relationship_institutions.py
#	api_tests/preprints/views/test_preprint_contributors_list.py
#	api_tests/providers/collections/views/test_collections_provider_moderator_list.py
#	api_tests/providers/preprints/views/test_preprint_provider_moderator_list.py
#	api_tests/providers/tasks/test_bulk_upload.py
#	api_tests/registrations/views/test_registration_detail.py
#	api_tests/requests/views/test_node_request_institutional_access.py
#	api_tests/requests/views/test_node_request_list.py
#	api_tests/requests/views/test_preprint_request_list.py
#	api_tests/requests/views/test_request_actions_create.py
#	api_tests/users/views/test_user_claim.py
#	api_tests/users/views/test_user_list.py
#	api_tests/users/views/test_user_message_institutional_access.py
#	api_tests/users/views/test_user_settings.py
#	api_tests/users/views/test_user_settings_detail.py
#	conftest.py
#	osf/models/__init__.py
#	osf_tests/management_commands/test_check_crossref_dois.py
#	osf_tests/management_commands/test_email_all_users.py
#	osf_tests/test_archiver.py
#	osf_tests/test_collection.py
#	osf_tests/test_collection_submission.py
#	osf_tests/test_comment.py
#	osf_tests/test_institution.py
#	osf_tests/test_queued_mail.py
#	osf_tests/test_registration_moderation_notifications.py
#	osf_tests/test_reviewable.py
#	osf_tests/test_schema_responses.py
#	osf_tests/test_user.py
#	scripts/tests/test_deactivate_requested_accounts.py
#	scripts/tests/test_send_queued_mails.py
#	scripts/tests/test_triggered_mails.py
#	tests/test_adding_contributor_views.py
#	tests/test_auth.py
#	tests/test_auth_views.py
#	tests/test_misc_views.py
#	tests/test_notifications.py
#	tests/test_preprints.py
#	tests/test_registrations/test_embargoes.py
#	tests/test_registrations/test_retractions.py
#	tests/test_spam_mixin.py
#	tests/test_user_profile_view.py
#	tests/test_webtests.py
#	website/conferences/views.py
#	website/mails/listeners.py
#	website/mails/mails.py
#	website/notifications/constants.py
#	website/notifications/utils.py
#	website/project/views/contributor.py
#	website/settings/defaults.py
#	website/templates/contributor_added_default.html.mako
@Johnetordoff Johnetordoff changed the base branch from refactor-notifications to develop September 2, 2025 18:00
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch 2 times, most recently from 14ca2e3 to f0e5a91 Compare September 2, 2025 18:45
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from f0e5a91 to 6244b56 Compare September 2, 2025 18:46
@Johnetordoff Johnetordoff force-pushed the add-new-notifications-data-model branch from bf6dd1b to 02d0b13 Compare September 3, 2025 00:14
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.

6 participants