Skip to content

Remove deprecations v2#1938

Merged
tomaszpatrzek merged 42 commits into
masterfrom
remove-deprecations-v2
Jun 24, 2026
Merged

Remove deprecations v2#1938
tomaszpatrzek merged 42 commits into
masterfrom
remove-deprecations-v2

Conversation

@tomaszpatrzek

Copy link
Copy Markdown
Contributor

Remove deprecated APIs (v3)

This PR removes all APIs that were deprecated in v2.x with warnings pointing users to migrate before v3.

Deprecation warnings were introduced in PR #1561 and the deprecation-warnings branch.


Specification

  • Specification#in_batches_of → in_batches
  • Specification#of_types → of_type

RailsEventStore constants

  • RailsEventStore::Event, ::InMemoryRepository, ::Projection and other aliases removed
    Use RubyEventStore::* constants directly.

Instrumentation

  • *.rails_event_store instrumentation event names removed
    Use *.ruby_event_store names only. Dual-firing is gone.
  • serialize/deserialize mapper instrumentation event names removed
    Use event_to_record/record_to_event.
  • events:/messages: payload keys removed from InstrumentedRepository
    Use records: only.

Projection

  • Projection.from_stream / from_all_streams / init / when / run removed
    Use Projection.init.on(...).call(event_store, ...).
  • Multi-scope Projection#call removed
    Pass one scope at a time.
  • Projection.new made private — use Projection.init

AggregateRoot

  • apply_* method naming convention removed
    Use the on EventClass do |event| ... end DSL.
  • AggregateRoot::Configuration and default_event_store removed
    Pass the event store to AggregateRoot::Repository.new directly.
  • with_default_apply_strategy and with_strategy removed
    Use AggregateRoot.with(strategy: ...).

Dispatchers / Schedulers

  • ImmediateAsyncDispatcher removed → ImmediateDispatcher
  • AfterCommitAsyncDispatcher removed → AfterCommitDispatcher
  • Dispatcher alias removed → SyncScheduler
  • Class-as-subscriber removed from SyncScheduler
    Pass instances with #call instead of classes.

Mappers

  • EventClassRemapper and events_class_remapping: option removed
    Use upcasting instead.
  • NullMapper removed → Mappers::Default
  • JSONMapper removed → Mappers::Default

Other

  • InMemoryRepository: mixing :any and specific expected versions now raises UnsupportedVersionAnyUsage
    Use one strategy consistently per stream.
  • publish/append/link with nil now raises ArgumentError
  • rails_event_store_active_record gem rename deprecation warning removed
    The gem silently delegates to ruby_event_store-active_record.

tomaszpatrzek and others added 30 commits May 27, 2026 15:45
Use #in_batches instead.

Removes deprecation warning added in bd7f3e3.
Use #of_type instead.

Removes deprecation warning added in ba535e3.
Removes the const_missing deprecation shim that aliased
RailsEventStore::Event, ::Metadata, etc. to their RubyEventStore
counterparts. Also removes the deprecation specs and updates
scheduler specs to use fully-qualified RubyEventStore::Event.

Based on d685cfb7
Drop the dual-firing layer that sent instrumentation events under both
*.rails_event_store and *.ruby_event_store names. All instrumented wrappers
(Broker, Dispatcher, Repository, Subscriptions, BatchMapper) now fire only
under the canonical *.ruby_event_store names. The serialize/deserialize →
event_to_record/record_to_event rename deprecation in InstrumentedMapper is
kept as it belongs to a separate later commit.

Original commit: f9ca730

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drop the deprecated old-style Projection API: class methods from_stream and
from_all_streams, instance methods init/when/run, and helper methods
valid_start_for_streams?/valid_start_for_all_streams?. Update all specs to use
the canonical Projection.init(state).on(EventClass) { }.call(scope) API.

Original commit: 7edab22

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
call(*scopes) is now call(scope) — only a single scope is accepted.
Remove the :projection_multiple_scopes deprecation and the multi-scope
reduce loop from Projection#call.

Original commit: ff037b5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove :projection_new_constructor deprecation and _internal flag.
Projection.new is now private_class_method; Projection.init(state) is
the only public constructor.

Original commit: 1eec0c2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drop support for apply_EventName handler methods. DefaultApplyStrategy
now only resolves handlers via the on DSL (on_methods registry).
Update error message format and remove apply_* deprecation tests.

Original commit: 36704f2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Repository#initialize now requires an explicit event_store argument.
Remove AggregateRoot.configure, AggregateRoot::Configuration, and the
default_event_store fallback from Repository.

Original commit: 7d20d90

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all uses with ImmediateDispatcher, the canonical name.
Remove the class, its spec file, and the deprecation registration.

Original commit: 148bec0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all uses with AfterCommitDispatcher (RailsEventStore::AfterCommitDispatcher).
The AfterCommitAsyncDispatcher alias was deprecated in v2.x.

Original commit: b8424aaa8
Replace all uses of RubyEventStore::Dispatcher with SyncScheduler.
Update Broker default dispatcher and broker_lint shared examples.

Original commit: c8bc3dae
SyncScheduler now only accepts instances and callables.
Passing a class is no longer supported.

Original commit: fed065b91
Replace with Upcast transformation. Remove events_class_remapping option
from Default and JSONMapper mappers, and from protobuf mapper.

Original commit: cabb98b16
Replace remaining uses with Default.new, which is the canonical replacement.

Original commit: 19bcfdb7b
It was identical to Default mapper. Replace all uses with Default.

Original commit: 9bbac9bd
Use AggregateRoot.with(strategy: ...) directly.
with_default_apply_strategy was identical to include AggregateRoot.

Original commit: c38b0c44
InstrumentedMapper now only fires event_to_record and record_to_event
instrumentation events, which were introduced as the canonical names.

Original commit: ea7110e5e
…ository

append_to_stream and update_messages now only include records: in their
instrumentation payload, dropping the legacy events: and messages: aliases.

Original commit: 80834331f
Mixing :any with specific positions (or :auto) now always raises
UnsupportedVersionAnyUsage. The opt-in flag and deprecation warning are removed.

Original commit: e5e6531b1
…tError instead

Replace warn blocks with immediate ArgumentError raises when nil is passed
to publish, append, or link. Update specs to expect ArgumentError.

Based on deprecation-warnings commit c2714e9
Remove the runtime warn from the compat shim. The old gem name no longer
emits warnings; users should have migrated to ruby_event_store-active_record.

Based on deprecation-warnings commit 6954e54
Replace apply_order_created method with on DSL handler and update
the MissingHandler error message expectation to match the new format.
Verify that event_to_record encodes metadata as a binary string, not a
plain Ruby hash. Without ProtobufNestedStructMetadata in the pipeline,
metadata would pass through unchanged and this test would fail.
Transform was only used by apply_handler_name to convert event type
strings to snake_case method names. With apply_* convention removed,
nothing references Transform anymore.

Based on 6880ad51
- Add NullHandler constant for non-strict no-op case
- Replace if/elsif pattern with on_handler using fetch + rescue KeyError
- Use lambda in missing_handler to defer the raise until the event is dispatched
- Fix error message word order: "on aggregate X for Y"

Based on 6880ad51
The rename to ruby_event_store-active_record happened long ago; the old name
survived only as a shim gem (rails_event_store_active_record.gemspec + a one-line
lib defining the RailsEventStoreActiveRecord constant) plus a generator namespace.
On remove-deprecations-v2 the shim's deprecation warning was already dropped, so
it would ship in 3.0 as a silent, still-published dead artifact.

Remove it entirely:
- delete the shim gemspec and lib (and the RailsEventStoreActiveRecord constant)
- rails_event_store now depends on / requires ruby_event_store-active_record
  directly (previously it reached it only through the shim)
- drop the shim line from all Gemfiles (the real gem was already listed) and
  regenerate the lockfiles
- stop building/publishing the shim (root Makefile set-version + AR Makefile
  OLD_GEM_NAME double build/push)
- rename the Rails generator namespace rails_event_store_active_record:* to
  ruby_event_store_active_record:* (no alias) + APP_TEMPLATE + spec

Breaking change for 3.0: gem name, RailsEventStoreActiveRecord constant and the
rails_event_store_active_record:* generator namespace are gone — use
ruby_event_store-active_record / RubyEventStore::ActiveRecord /
ruby_event_store_active_record:*.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Point all references at the current names:
- RailsEventStoreActiveRecord -> RubyEventStore::ActiveRecord
- rails_event_store_active_record gem -> ruby_event_store-active_record
- generator namespace rails_event_store_active_record:migration ->
  ruby_event_store_active_record:migration (install guide + APP_TEMPLATE)
- drop the duplicate shim row from the README gems table

Frozen permalinks (custom-repository, rom CHANGELOG) and versioned_docs are left
untouched as historical snapshots.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per review: the generator namespace should mirror the module nesting
RubyEventStore::ActiveRecord, so colon-separated ruby_event_store:active_record:*
rather than the flat ruby_event_store_active_record:* that merely echoed the gem name.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The custom build/push/clean target invoked gem.mk by hand only so it could run
twice (once per GEM_NAME) to build both the real gem and the shim. With the shim
gone, fall back to the standard include ../support/make/gem.mk like every other gem.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tomaszpatrzek and others added 12 commits June 23, 2026 16:28
The require/include examples pointed at a frozen SHA under the old
rails_event_store_active_record/spec path; the spec now lives in
ruby_event_store-active_record/spec. Point at the current location on master.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
RubyEventStore::Dispatcher was renamed to SyncScheduler.

Removal: 94d767f36

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
NullMapper was removed; EventClassRemapper was removed in favour of upcasting and
is no longer part of the Default mapper pipeline. The publish/read sequence
diagrams drop the EventClassRemapper participant (publish diagram also picks up
the SyncScheduler rename).

Removals:
- NullMapper: 2ceaf0131
- EventClassRemapper: 9680bdac4
- Dispatcher -> SyncScheduler: 94d767f36

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The *.rails_event_store instrumentation event names were removed; only
*.ruby_event_store fire now. Mapper events were also renamed
(serialize -> event_to_record, deserialize -> record_to_event). Dispatcher
example uses SyncScheduler.

Removals:
- event names: a88a83af1
- Dispatcher -> SyncScheduler: 94d767f36

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Removal: 8470c309f

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sync class-as-subscriber support was removed from SyncScheduler -- subscribe a
callable (e.g. a lambda building a fresh instance) instead. Also fixes the
ImmediateDispatcher namespace (RubyEventStore, not RailsEventStore).

Removals:
- class-as-subscriber: caba09b46
- ImmediateAsyncDispatcher -> ImmediateDispatcher: 8470c309f

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AggregateRoot::Configuration / default_event_store was removed -- the event store
is now a required AggregateRoot::Repository constructor argument. The apply_*
method naming convention was removed in favour of the 'on' DSL, so the deprecated
alternative-syntax section is dropped.

Removals:
- Configuration/default_event_store: 2a8867550
- apply_* convention: 761e4ba4f

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
RailsEventStore::Event, ::Projection and ::WrongExpectedEventVersion were
const_missing aliases to their RubyEventStore counterparts and are gone in 3.0
(NameError). Use the RubyEventStore constants directly. RailsEventStore::Client,
AfterCommitDispatcher, ActiveJobScheduler etc. are defined directly and stay.

Removal: 3523e35fc

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Projection.from_stream and .from_all_streams were removed; the stream selection
now moves into the scope passed to #call (client.read.stream(name) or client.read).
Also: .when -> .on (block form), .run(client) -> .call(scope), and .init takes the
initial state value directly. Dropped the multiple-specific-streams example, which
the single-scope #call no longer expresses (combine streams via linking instead).

Removal: 7edab22ad

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The append_to_stream and update_messages repository instrumentation payloads
dropped the :events and :messages keys; both now expose :records.

Removal: 98bcd3910

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The mapper instrumentation events that fire on publish/read are the batch ones,
events_to_records.mapper.ruby_event_store (payload :domain_events) and
records_to_events.mapper.ruby_event_store (payload :records), not the per-event
serialize/deserialize names.

Removal: a84d71d78

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The constant-alias sweep (d2d1143) turned "also aliased as
RailsEventStore::WrongExpectedEventVersion" into "also aliased as
RubyEventStore::WrongExpectedEventVersion" -- an alias to itself. The alias is
gone in 3.0, so drop the clause entirely.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tomaszpatrzek
tomaszpatrzek marked this pull request as ready for review June 24, 2026 11:23
@tomaszpatrzek
tomaszpatrzek merged commit 79d5ae5 into master Jun 24, 2026
82 checks passed
@tomaszpatrzek
tomaszpatrzek deleted the remove-deprecations-v2 branch June 24, 2026 11:38
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