Skip to content

Feature Flags for SMS Queueing (Rate Limiter)#2827

Draft
P0NDER0SA wants to merge 15 commits intomainfrom
rate-limiter
Draft

Feature Flags for SMS Queueing (Rate Limiter)#2827
P0NDER0SA wants to merge 15 commits intomainfrom
rate-limiter

Conversation

@P0NDER0SA
Copy link
Copy Markdown
Contributor

@P0NDER0SA P0NDER0SA commented Apr 2, 2026

This pull request introduces a new "SMS control lane" feature, allowing all SMS notifications to be routed through a single fair queue (send-sms-fair) when the FF_SMS_CONTROL_LANE feature flag is enabled. This helps centralize SMS delivery and provides more granular control over SMS traffic. The changes include updates to queue selection logic, task dispatching, queue definitions, and tests to support and verify this new behavior.

Core features and logic for SMS control lane:

  • Added a new queue, SEND_SMS_FAIR, to QueueNames and included it in all queue lists and Celery worker scripts. [1] [2] [3] [4]
  • Introduced the FF_SMS_CONTROL_LANE feature flag in Config to enable or disable the SMS control lane.
  • Updated SMS queue selection logic in choose_queue, choose_deliver_task, and related functions to route SMS notifications to SEND_SMS_FAIR when the flag is enabled, except for research mode. [1] [2] [3] [4] [5] [6]
  • Modified SMS delivery tasks so that legacy SMS tasks delegate to the fair queue when the control lane is enabled. Added a new deliver_sms_fair task and logic to assign a MessageGroupId for ordering. [1] [2] [3]
  • Ensured that when dispatching SMS tasks to the fair queue, the correct MessageGroupId is set based on service or notification ID, both in direct and job-based notification flows. [1] [2]

Testing and validation:

  • Expanded and added tests to verify that SMS notifications are routed to the fair queue with the correct MessageGroupId when the control lane is enabled, and that legacy tasks delegate properly. [1] [2] [3] [4] [5] [6] [7]

Miscellaneous:

  • Updated mypy.ini to specify a cache directory for type checking.

These changes collectively enable a configurable, centralized SMS delivery mechanism, improve queue management, and ensure robust testing for the new functionality.

Related Issues | Cartes liées

https://app.zenhub.com/workspaces/notify-planning-core-6411dfb7c95fb80014e0cab0/issues/gh/cds-snc/notification-planning-core/786

Reviewer checklist | Liste de vérification du réviseur

  • This PR does not break existing functionality.
  • This PR does not violate GCNotify's privacy policies.
  • This PR does not raise new security concerns. Refer to our GC Notify Risk Register document on our Google drive.
  • This PR does not significantly alter performance.
  • Additional required documentation resulting of these changes is covered (such as the README, setup instructions, a related ADR or the technical documentation).

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.

Comment thread app/notifications/process_notifications.py Fixed
Comment thread app/celery/provider_tasks.py Fixed
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.

2 participants