feat: implement feed url updated notification#1739
Draft
davidgamez wants to merge 16 commits into
Draft
Conversation
davidgamez
commented
Jun 23, 2026
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| _DEFAULT_SENDER_EMAIL = "noreply@mobilitydatabase.org" |
Member
Author
There was a problem hiding this comment.
[out-of-scope]: Configurations should be more dynamic, avoiding the need for redeployment when they are changed.
davidgamez
commented
Jun 23, 2026
| return get_rate_limiter(_BREVO_RATE_LIMITER_NAME, _configured_brevo_rps()) | ||
|
|
||
|
|
||
| _DIGEST_EMAIL_SUBJECT_DICTIONARY = { |
Member
Author
There was a problem hiding this comment.
[out-of-scope]: internationalization messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This PR introduces the feed URL update notification. The URL update notification has two variants: URL replacement and feed redirect. Added helpers to emit notifications, rate limiting, and Brevo integration.
Expected behavior:
feed.url_updated => feed_redirectedevent is logged into the notification_event tablefeed.url_updated => url_replacedevent is logged into the notification_event table.Testing tips:
[Internal team]
For integrated tests, use DEV environment. As the notification endpoints are not implemented, notification-related entities need to be created via SQL.
notification_subscriptiontable; replace with the target user id(REPLACE_ME_WITH_USER_ID)notifications_dispatch_plantask from retool(DEV)rawemail(not from a template)From our AI friend
This pull request introduces a new notification event system for tracking and emitting feed URL changes and feed redirections, as well as a reusable rate limiter utility. The main changes include the addition of a generic rate limiter, the implementation of fire-and-forget notification event writers, and the integration of these notification triggers into the GTFS and GBFS database population scripts. This enhances observability and user notification when critical feed properties change.
Notification event system:
notification_event_servicemodule withemit_url_replacedandemit_feed_redirectedfunctions for writing notification events to the users DB in a fire-and-forget manner. Includes helpers for URL normalization and difference detection.notification_constantsmodule containing namespaced string constants for notification types, event subtypes, roles, cadences, statuses, and sources, ensuring consistency across the notification system.__init__.pyto theshared.notificationspackage to document and expose notification utilities.Integration with feed population scripts:
populate_db_gtfs.pyandpopulate_db_gbfs.pyto emit notification events when:emit_url_replaced).emit_feed_redirected), including relevant metadata. [1] [2] [3] [4] [5]Utility and infrastructure:
RateLimiterclass and a process-wide registry for managing outbound API call rates, with full documentation and testability hooks.Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything