Skip to content

Fix push notification delivery crashing on send#71

Merged
dadachi merged 1 commit into
mainfrom
fix_push_delivery
May 20, 2026
Merged

Fix push notification delivery crashing on send#71
dadachi merged 1 commit into
mainfrom
fix_push_delivery

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented May 20, 2026

Summary

Push delivery via ItemTagNotifier raised TypeError (no implicit conversion of nil into Hash) in the Noticed action_push_native job. Two stacked bugs:

  1. nil options — The notifier omitted with_apple, with_google, and with_data. Noticed's delivery method passes each to ActionPushNative, which does {}.merge(option) and raises when the option is nil. Now provided (empty hashes for apple/google, the url payload for data), matching Noticed's canonical config.
  2. wrong route helper (masked by test3 #1)url called api_v1_shopkeeper_shop_item_tag_path, which doesn't exist: item_tags is declared shallow: true (config/routes.rb:49-50), so the show route is api_v1_shopkeeper_item_tag_path(id). Fixed.

Not caused by the noticed v2→v3 bump — the v2.9.3 delivery method was byte-identical; push simply hadn't run end-to-end until credentials landed.

Tests

Existing notifier tests only enqueued the notification and never performed the delivery job, so neither bug surfaced. Added:

  • A test that performs the Noticed delivery job (excluding the real APNs/FCM send job) — verified it reproduces the exact production error on the unfixed code.
  • A test pinning url to the shallow item_tag route.

Test plan

  • bin/rubocop — no offenses
  • bin/rails test — 426 runs, 889 assertions, 0 failures

🤖 Generated with Claude Code

ItemTagNotifier's action_push_native config omitted the with_apple,
with_google, and with_data options. Noticed's delivery method passes
each to ActionPushNative, which does {}.merge(option) and raises
TypeError (no implicit conversion of nil into Hash) when the option is
nil. Provide the options (empty hashes for apple/google, the url payload
for data), matching Noticed's canonical config.

That crash masked a second bug: url referenced
api_v1_shopkeeper_shop_item_tag_path, which does not exist because
item_tags is declared shallow. Use the shallow helper
api_v1_shopkeeper_item_tag_path.

Existing tests only enqueued the notification and never performed the
delivery job, so neither bug surfaced. Add a test that performs the
delivery (excluding the real APNs/FCM send job) plus a test pinning the
url to the shallow route.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit 045aaf4 into main May 20, 2026
3 checks passed
@dadachi dadachi deleted the fix_push_delivery branch May 20, 2026 08:49
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.

1 participant