Skip to content

Don't deactivate FCM devices on payload errors - #818

Merged
50-Course merged 3 commits into
django-commons:masterfrom
JaeHyuckSa:fcm-invalid-argument-payload
Nov 5, 2026
Merged

50-Course merged 3 commits into
django-commons:masterfrom
JaeHyuckSa:fcm-invalid-argument-payload

Conversation

@JaeHyuckSa

Copy link
Copy Markdown
Member

FCM returns INVALID_ARGUMENT for both bad tokens and bad payloads, so a payload error deactivates devices with valid tokens. Only deactivate when the error details name message.token as the invalid field.

Fixes #817

@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.65%. Comparing base (900ed6c) to head (d40a78c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #818      +/-   ##
==========================================
+ Coverage   74.46%   74.65%   +0.18%     
==========================================
  Files          32       32              
  Lines        1359     1365       +6     
  Branches      225      227       +2     
==========================================
+ Hits         1012     1019       +7     
  Misses        300      300              
+ Partials       47       46       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JaeHyuckSa
JaeHyuckSa force-pushed the fcm-invalid-argument-payload branch from 776e8fd to ededa82 Compare November 4, 2026 05:41

@50-Course 50-Course left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you for this. approved.

Comment thread push_notifications/gcm.py Resolved

@50-Course 50-Course left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, fix itself looks correct, however, requested changes due to small nitpicks. one cleanup before approval: InvalidArgumentError is now fully handled by the isinstance branch you have and always returns there, so its entry in fcm_error_list is dead for the exception path.

could you please remove it from there so the final type(exc) in fcm_error_list only represents errors that still deactivate by type and the intent stays clear?

@JaeHyuckSa

JaeHyuckSa commented Nov 5, 2026 •

Copy link
Copy Markdown
Member Author

@50-Course Removed it. I kept it because fcm_error_list_str uses the same list, but I missed that it contains property objects, so the check never matches. I'll fix that in a follow-up.

@50-Course 50-Course left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you 🚀

@50-Course
50-Course merged commit a27a4c0 into django-commons:master Nov 5, 2026
12 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.

Payload errors deactivate FCM devices with valid tokens

2 participants