Skip to content

Remove deprecations#1937

Draft
tomaszpatrzek wants to merge 33 commits into
masterfrom
remove-deprecations
Draft

Remove deprecations#1937
tomaszpatrzek wants to merge 33 commits into
masterfrom
remove-deprecations

Conversation

@tomaszpatrzek

Copy link
Copy Markdown
Contributor

Remove deprecated code

This branch removes everything that was warned about in the deprecation-warnings branch. Each commit
corresponds to one deprecation warning and references the source commit that introduced it.

What's removed

Specification

  • Specification#in_batches_of — use in_batches
  • Specification#of_types — use of_type

RailsEventStore

  • RailsEventStore::* constant aliases for RubyEventStore::* classes
  • *.rails_event_store instrumentation event names — only *.ruby_event_store names remain

Projection

  • Projection.from_stream, from_all_streams, init, when, run class-level API
  • Multi-scope Projection#call(*scopes) — single scope only
  • Projection.new is now private — use Projection.init

AggregateRoot

  • apply_* method naming convention — use explicit apply(Event) calls
  • AggregateRoot::Configuration and default_event_store
  • with_strategy and with_default_apply_strategy includes — use AggregateRoot.with(strategy:)

Dispatchers

  • ImmediateAsyncDispatcher — use ImmediateDispatcher
  • AfterCommitAsyncDispatcher — use AfterCommitDispatcher
  • Dispatcher alias — use SyncScheduler
  • Class-as-subscriber support in SyncScheduler — subscribers must respond to #call

Mappers

  • EventClassRemapper and events_class_remapping: — use upcasting
  • NullMapper — use Default
  • JSONMapper — use Default
  • serialize/deserialize mapper instrumentation event names — only event_to_record/record_to_event remain

Repository

  • events: and messages: payload keys in InstrumentedRepository — use records:
  • ensure_supported_any_usage: option in InMemoryRepository (now always enforced)

Client

  • Passing nil to publish, append, or link now raises ArgumentError immediately

Gem

  • rails_event_store_active_record shim no longer emits a runtime warn or post-install message

@cbillen

cbillen commented May 19, 2026

Copy link
Copy Markdown

Does this also drop the require "rails_event_store_active_record" in rails_event_store.rb:3

tomaszpatrzek and others added 22 commits May 19, 2026 14:42
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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drops the dual-firing deprecated_instrument shim from all instrumented
wrappers. Each method now fires only *.ruby_event_store events directly.
InstrumentedMapper retains the serialize/deserialize rename deprecation layer.

Based on 9eab186a

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes the old Projection API: from_stream, from_all_streams, instance
init, when, and run methods. All tests updated to use the new
Projection.init(state).on(EventClass) { }.call(scope) API.

Based on 2cddc9e9

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
call(*scopes) is now call(scope) — only a single scope is accepted.
Removes MULTI_SCOPE_DEPRECATION_MESSAGE and the multi-scope reduction loop.

Based on f13b20ab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes NEW_CONSTRUCTOR_DEPRECATION_MESSAGE and _internal flag.
Projection.new is now private_class_method; use Projection.init(state).

Based on 2b4ce59d

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drops support for apply_EventName handler methods. DefaultApplyStrategy
now only resolves handlers via the on DSL (on_methods registry).
All tests updated to use on DSL instead of apply_* methods.

Based on 6880ad51

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Repository#initialize now requires an explicit event_store argument.
AggregateRoot.configure and AggregateRoot::Configuration are removed.

Based on 9a3d41189

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all uses with ImmediateDispatcher, which was introduced as the canonical name.

Based on 756e0218

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all uses with AfterCommitDispatcher, which was introduced as the canonical name.

Based on 935e4d03

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all uses of RubyEventStore::Dispatcher with SyncScheduler.
Update Broker default dispatcher and broker_lint shared examples.

Based on c8bc3dae

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SyncScheduler now only accepts instances and callables.
Passing a class is no longer supported.

Based on fed065b91

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace with Upcast transformation. Remove events_class_remapping option
from Default and JSONMapper mappers, and from protobuf mapper.

Based on cabb98b16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace remaining uses with Default.new, which is the canonical replacement.

Based on 19bcfdb7b

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
It was identical to Default mapper. Replace all uses with Default.

Based on 9bbac9bd

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use AggregateRoot.with(strategy: ...) directly.
with_default_apply_strategy was identical to include AggregateRoot.

Based on c38b0c44

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
InstrumentedMapper now only fires event_to_record and record_to_event
instrumentation events, which were introduced as the canonical names.

Based on ea7110e5e

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ository

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

Based on 80834331f

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mixing :any with specific positions (or :auto) now always raises
UnsupportedVersionAnyUsage. The opt-in flag and deprecation warning are removed.

Based on e5e6531b1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…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 and the post_install_message
from the gemspec. The old gem name no longer emits warnings; users should
have migrated to ruby_event_store-active_record.

Based on deprecation-warnings commit 6954e54
@tomaszpatrzek tomaszpatrzek force-pushed the remove-deprecations branch from 2a978d1 to 1fdf3e4 Compare May 19, 2026 12:45
tomaszpatrzek and others added 6 commits May 19, 2026 14:51
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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…EADME

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tomaszpatrzek and others added 5 commits May 20, 2026 19:23
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Aligns with original PR #1561 commit 5acd7df — the parameter is kept
as an escape hatch, but defaults to true (strict/raise) instead of
false (warn). Passing false silently allows mixed :any usage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Raise in enrich_event_metadata for nil element (not only in enrich_events_metadata)
- Match original error message: "Event cannot be `nil`"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fidel

fidel commented May 22, 2026

Copy link
Copy Markdown
Contributor

Does this also drop the require "rails_event_store_active_record" in rails_event_store.rb:3

@cbillen sorry for the hassle with superfluous deprecation messages. This shouldn't happen. I just finished working on a fix and refactoring the way we handle deprecations at all. People who use this shim indirectly shouldn't be penalized and I was able to achieve that (already on the master branch).

The 2.19.2 is expected to resolve this soon. Following branch needs to be readjusted though.

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.

3 participants