Skip to content

Code review cleanups - #581

Merged
excid3 merged 1 commit into
mainfrom
review-cleanups
Sep 30, 2026
Merged

excid3 merged 1 commit into
mainfrom
review-cleanups

Conversation

@excid3

@excid3 excid3 commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

Last batch from the library-wide review. One real bug, the rest cleanups.

  • Action Push Native bug: notification_class read config[:class], but DeliverBy#constant also reads config[:class] to choose the delivery method class, so setting it would have constantized your push notification class as the job. Renamed to config.notification_class (the old name was undocumented). Adds the first tests for this delivery method with a fake builder that mirrors the ActionPushNative::Notification API.
  • Dedupe: Noticed::SlackDelivery and Noticed::WebhookDelivery concerns shared by the individual and bulk classes. Discord/Test bodies are three lines and stay duplicated. Noticed::DeliveryMethods::Slack::DEFAULT_URL still resolves via the included module.
  • deliver_by duplicate name → ArgumentError (was NameError).
  • recipients :typo → NoMethodError (was silently delivering to nobody).
  • Event: drop always-true respond_to?(:serialize) guard and unused accepts_nested_attributes_for.
  • Generator templates: the example deliver_by ... class: comment now names the namespaced class, so copy-pasting it works.
  • README: if:/unless: symbol convention (method on the Notifier receiving the notification) — it was undocumented and differs from wait/queue symbols, which resolve on the Notification.

Test plan

  • standardrb clean
  • rails test on main Gemfile, Rails main, 7.1 — 152 runs, 0 failures
  • Rails.application.eager_load! + Zeitwerk::Loader.eager_load_all in the dummy app loads the new concerns
  • rails g noticed:delivery_method Foo --pretend renders

* ActionPushNative: the push notification class is configured with
  notification_class. It read config[:class], which DeliverBy#constant
  also reads to pick the delivery method class, so setting it broke the
  delivery job. Adds the first tests for this delivery method.
* Extract SlackDelivery and WebhookDelivery so the individual and bulk
  delivery methods share one implementation. Discord and Test are three
  lines each and stay duplicated.
* deliver_by with a duplicate name raises ArgumentError, not NameError
* recipients :typo raises NoMethodError instead of delivering to nobody
* Event: drop the always-true respond_to?(:serialize) guard and the
  unused accepts_nested_attributes_for :notifications
* Generator templates: the example deliver_by comment now names the
  generated DeliveryMethods::/BulkDeliveryMethods:: class so it
  constantizes
* README documents that if:/unless: symbols are called on the Notifier
  with the notification as an argument
@excid3
excid3 merged commit f36b009 into main Sep 30, 2026
36 checks passed
@excid3
excid3 deleted the review-cleanups branch September 30, 2026 21:28
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