Skip to content

deepcopy context to have unique ids#37

Open
fhaver-amsterdam wants to merge 2 commits intomainfrom
notification/am-594-unique-id
Open

deepcopy context to have unique ids#37
fhaver-amsterdam wants to merge 2 commits intomainfrom
notification/am-594-unique-id

Conversation

@fhaver-amsterdam
Copy link
Contributor

@fhaver-amsterdam fhaver-amsterdam commented Mar 6, 2026

This PR fixes push-notification payload generation so each pushed message gets its own unique notificationId, and aligns Entra mock-auth wiring in additional apps when MOCK_ENTRA_AUTH is enabled.

Changes:

  • Update waste and survey app configs to swap in MockEntraTokenAuthentication when MOCK_ENTRA_AUTH is true.
  • Ensure per-device notifications don’t share the same context object by deep-copying it during duplication.
  • Add a test asserting pushed Firebase messages contain unique notificationId values per device.

Note: code co-authored by copilot

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes push-notification payload generation so each pushed message gets its own unique notificationId, and aligns Entra mock-auth wiring in additional apps when MOCK_ENTRA_AUTH is enabled.

Changes:

  • Update waste and survey app configs to swap in MockEntraTokenAuthentication when MOCK_ENTRA_AUTH is true.
  • Ensure per-device notifications don’t share the same context object by deep-copying it during duplication.
  • Add a test asserting pushed Firebase messages contain unique notificationId values per device.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
waste/apps.py Fixes MOCK_ENTRA_AUTH branch to actually use the mock authentication class.
survey/apps.py Fixes MOCK_ENTRA_AUTH branch to actually use the mock authentication class.
notification/crud.py Deep-copies context when duplicating notifications to prevent shared mutation during push.
notification/tests/test_crud.py Adds regression test ensuring pushed notificationIds are unique across devices.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants