Skip to content

feat: Rspec helpers#19

Merged
arturictus merged 24 commits intomainfrom
rspec_helpers
Jan 22, 2026
Merged

feat: Rspec helpers#19
arturictus merged 24 commits intomainfrom
rspec_helpers

Conversation

@arturictus
Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to the RubyReactor library, with a focus on better async execution handling, enhanced context serialization/deserialization, and expanded support for RSpec testing. The most important changes are grouped below by theme.

Async Execution and Context Handling

  • Improved async execution flow in step_executor.rb and reactor.rb: Inline executions (such as in test mode or Sidekiq inline testing) now correctly reload and synchronize context state from storage, ensuring that results and traces are up-to-date. Also, async router now uses SidekiqAdapter by default. [1] [2] [3] [4] [5]
  • Added new status-checking methods (finished?, failed?) to the Context class for easier workflow control.

Serialization and Deserialization Improvements

  • Enhanced ContextSerializer to support serializing/deserializing Symbol types, and improved handling of unknown type wrappers by recursively deserializing values. Introduced simplify_for_api to flatten and clean up data for API usage. [1] [2] [3] [4]

Error and Result Handling

  • Failure and Success result objects now have a to_h method for easier inspection and serialization. The executor now attaches validation errors to failures when handling input validation errors. [1] [2] [3]

RSpec Integration

  • Added new RSpec helpers and matchers for testing reactors, with Zeitwerk inflection for "RSpec". Introduced lib/ruby_reactor/rspec.rb and supporting files for streamlined test setup. [1] [2] [3]

These changes collectively improve the reliability and testability of async workflows, make context and result data easier to work with, and enhance the developer experience for testing reactors.

define_singleton_method(:name) { superclass.name }

# 3. Apply Force Sync (Disable async on all steps)
if force_sync
Copy link
Copy Markdown
Owner Author

@arturictus arturictus Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't force sync, just regular execution, queuing the jobs. later on tests we can drain the jobs and proceed

… from the adapter, introducing manual job processing in `TestSubject` with `Sidekiq::Testing.fake!`, and updating `MapStep` to respect forced synchronous execution and collect successful values by default.
unless @compensation_manager.undo_stack.any? { |existing| existing[:step].name.to_s == item[:step].name.to_s }
@compensation_manager.add_to_undo_stack(item)
end
def refresh_context_from_storage
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should verify if this code is still relevant or is a remnant of the rejected inline executor for testing

…er and extend RSpec helper's inline completion check to include RetryQueuedResult.
…icated private helpers for improved modularity and readability.
…nstruction and improve `map_step` fail-fast behavior with detailed RSpec failure messages.
…objects and update map step testing to use real storage.
… modularize TestSubject's step interception.
… Reactor interrupt pause/resume and concurrent interrupt workflows.
…enhanced reactor testing and update documentation with an example.
@arturictus arturictus marked this pull request as ready for review January 22, 2026 00:12
@arturictus arturictus merged commit cb71f80 into main Jan 22, 2026
2 checks passed
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