Skip to content

Remove deprecations v2#1938

Draft
tomaszpatrzek wants to merge 28 commits into
masterfrom
remove-deprecations-v2
Draft

Remove deprecations v2#1938
tomaszpatrzek wants to merge 28 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 28 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>
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