Skip to content

feat: subscriber registry for account-change callbacks (0.2.0) - #1

Merged
moviendome merged 1 commit into
mainfrom
feat/subscriber-registry
Jun 13, 2026
Merged

moviendome merged 1 commit into
mainfrom
feat/subscriber-registry

Conversation

@moviendome

Copy link
Copy Markdown
Member

Replaces the single global on_account_change callback with a subscriber registry so multiple consumers (e.g. the new solrengine-sdp engine plus a host app's own listener) can react to the same account-change stream without clobbering each other.

What changed

  • Solrengine::Realtime.subscribe(name, &block) / unsubscribe(name) — a named registry; AccountMonitor dispatches to all subscribers.
  • Legacy on_account_change= preserved: it registers under a reserved name, so existing apps keep working (soft-deprecated, noted in CHANGELOG).
  • One subscriber raising is rescued and logged; the others still run.
  • Version → 0.2.0.

Why

The solrengine-sdp engine depends on ~> 0.2 for this. Without the registry, the engine's doorbell broadcaster would overwrite a host app's own realtime callback — breaking the "both custody models in one app" story.

Tests

8 runs, 16 assertions, 0 failures (standalone minitest, the family convention).

🤖 Generated with Claude Code

Replace the single global on_account_change callback with a named
subscriber registry so multiple consumers can react to account changes
without clobbering each other.

- Add Solrengine::Realtime.subscribe(name, &block) / unsubscribe(name)
- AccountMonitor dispatches to all registered subscribers via
  Solrengine::Realtime.dispatch(wallet_address)
- A raising subscriber is rescued and logged (Rails.logger when
  available, otherwise stderr); remaining subscribers still run
- Legacy on_account_change= assignment keeps working: it registers
  under the reserved :legacy_on_account_change name, and re-assignment
  replaces it (0.1 semantics preserved); soft-deprecated in CHANGELOG
- Bump version to 0.2.0, add CHANGELOG.md, add tests + CI test job

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@moviendome
moviendome merged commit ac0dddb into main Jun 13, 2026
4 checks passed
@moviendome
moviendome deleted the feat/subscriber-registry branch June 13, 2026 06:07
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