Status of transproc inside rom?

Hi,

I am asking this question cause i have been trying to upgrade our application which uses rom to ruby 3.0. A since there are some breaking changes related to keyword argument usage i am wondering if this is not related to transproc. I did not do much investigating at the moment yet but maybe there is already an obvious answer before i start that journey :slight_smile:

We use rom (5.2.5) and rom-sql (3.3.2) together with ruby event store (1.3.1) and after the ruby upgrade it triggered issue with keywords… But it seems to be unrelated to our code and is more in the internals of rom or ruby event store. From the first investigation i did ruby event store seems to be fine but when you look at the stack trace (see below) it seems to be something related to transproc. Now when i looked up the transproc gem to see if it had any ruby 3 issues it mentions that it is ported to dry-rb/dry-transformer and the github project is archived as read only. If it has been ported why is it then still used inside rom at all? Not blaiming anyone would just like to know if transproc is ruby 3 compatible or not.

 ArgumentError:
       wrong number of arguments (given 1, expected 0; required keywords: event_id, data, metadata, event_type)
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/serialized_record.rb:6:in `initialize'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/class.rb:32:in `new'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/class.rb:32:in `constructor_inject'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/function.rb:49:in `call'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/function.rb:49:in `call'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/composite.rb:32:in `call'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/array.rb:44:in `block in map_array'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/array.rb:44:in `map'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/array.rb:44:in `map_array'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/function.rb:49:in `call'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/function.rb:49:in `call'
     # /bundle/ruby/3.0.0/gems/transproc-1.1.1/lib/transproc/transformer.rb:72:in `call'
     # /bundle/ruby/3.0.0/gems/rom-core-5.2.4/lib/rom/relation/composite.rb:24:in `call'
     # /bundle/ruby/3.0.0/gems/rom-core-5.2.4/lib/rom/relation/materializable.rb:15:in `to_a'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-rom-1.3.1/lib/ruby_event_store/rom/repositories/events.rb:46:in `block in read'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/batch_enumerator.rb:16:in `block in each'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/batch_enumerator.rb:14:in `step'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/batch_enumerator.rb:14:in `each'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/specification_reader.rb:23:in `each'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/specification_reader.rb:23:in `each'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/specification.rb:81:in `each_batch'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/specification.rb:95:in `each'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/specification.rb:118:in `each'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/specification.rb:118:in `reduce'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/specification.rb:118:in `reduce'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/projection.rb:88:in `block in reduce_from_streams'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/projection.rb:87:in `each'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/projection.rb:87:in `reduce'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/projection.rb:87:in `reduce_from_streams'
     # /bundle/ruby/3.0.0/gems/ruby_event_store-1.3.1/lib/ruby_event_store/projection.rb:68:in `run'
     # ./app/event_store/projections/user_projection.rb:26:in `project_for'

@butsjoh hey sorry for late reply, I totally missed the notification about your post :frowning:

So, this is an unfortunate story - the plan was to use dry-transformer in rom 6.0 which was supposed to be already released and then 2020 happened. Given there are issues with transproc and rom 5.x under MRI 3.0, I’m going to look into upgrading rom 5.x to use dry-transformer and release that before rom 6.0. I’ll also consider “un-archiving” transproc and upgrade it to work with MRI 3.0 (most likely the simplest solution). We’ll see what makes more sense.

Sorry for the confusion, this didn’t play out well :frowning:

Hey,

No problem at least it is clear now what the plan is :slight_smile: The timing of my question was not ideal after the new year period so was not expecting an immediate answer anyways but i am glad you still managed to give your thoughts. Thnx for that.

Johan

1 Like

From what I can see it’s a problem with ruby_event_store rather than transproc or rom. It expects keywords but transproc never passed keywords to constructors, it always passes plain hashes. No wonder it broke in ruby 3.0. So I recommend checking on ruby_event_store.

1 Like