8000 chore(notifications): B-series follow-up cleanups by mwoods79 · Pull Request #130 · huddlz-hq/huddlz · GitHub
[go: up one dir, main page]

Skip to content

chore(notifications): B-series follow-up cleanups - #130

Merged
mwoods79 merged 4 commits into
mainfrom
chore/notifications-b-series-followups
Apr 30, 2026
Merged

mwoods79 merged 4 commits into
mainfrom
chore/notifications-b-series-followups

Conversation

@mwoods79
@mwoods79 mwoods79 commented Apr 30, 2026 •
Copy link
Copy Markdown
Contributor

Summary

Four small follow-ups on the B-series notifications work merged in #129. None of them are functionally novel; they're cleanups that should have shipped with #129. Splitting into a separate PR rather than carrying them onto the upcoming C/D-series branch keeps that diff focused.

  • feat(notifications): log Oban enqueue failures in deliver_async — only behavior change. Adds a Logger.warning when Oban.insert/1 rejects the enqueue. Caller still gets {:error, reason} back; this is purely additive instrumentation.
  • refactor(group): extract ok_or_error helper in transfer_ownership — three branches of the role-swap repeated the same case clauses; pulled into a private helper.
  • refactor(notifications): rename humanize_role to role_label — the helper didn't actually humanize anything, just labelled. Pure rename in Senders.GroupRoleChanged.
  • refactor(test): tidy flush_mailbox placement and drop dead sleep — moves the private helper to the bottom of the module and drops a Process.sleep(0) that was decorating an already-synchronous Oban.drain_queue/1.

Test plan

  • mix precommit clean (921 tests, credo clean)
  • CI green

deliver_async/3 used to silently return {:error, reason} from
Oban.insert/1 and rely on the caller to log it. Callers in change
modules and LiveViews don't have an obvious place to surface that —
the email just never gets sent. Add a Logger.warning at the enqueue
site so a misconfigured Oban or DB outage at least shows up in logs.

The {:error, _} tuple still propagates to the caller; this is purely
additive instrumentation.
Three branches of the role-swap logic each repeated the same
{:ok, _} -> :ok / {:error, r} -> {:error, r} case. Pull the pattern
out into a private ok_or_error/1 so the action body reads as a flat
pipeline.

No behavior change.
The helper was called humanize_role/1 but it doesn't humanize
anything — it just substitutes "member" when the role string is
empty and otherwise returns it verbatim. role_label/1 describes
what it does. Pure rename, no behavior change.
Two cosmetic cleanups in group_membership_notifications_test:

- flush_mailbox/0 was defined mid-module between two describe
  blocks. Move it to the bottom of the module where private
  helpers conventionally live in this codebase.
- Remove a Process.sleep(0) that was decorating an
  Oban.drain_queue/1 call. drain_queue is synchronous, so the
  zero-millisecond sleep was a no-op.
@mwoods79
mwoods79 force-pushed the chore/notifications-b-series-followups branch from 3be9e3d to cce926c Compare April 30, 2026 20:00
@mwoods79
mwoods79 merged commit e0b6d5d into main Apr 30, 2026
1 check passed
@mwoods79
mwoods79 deleted the chore/notifications-b-series-followups branch April 30, 2026 20:23
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

0