From d011b3a92770d0403ddd9fefc4f162035d48d981 Mon Sep 17 00:00:00 2001 From: Jamie Cobbett Date: Wed, 23 Oct 2024 14:48:07 +0100 Subject: [PATCH 1/3] Improve Rails 7.2 compatibility On trying to upgrade to Rails 7.2, I was experiencing [SystemStackError: stack level too deep (SystemStackError)] On debugging, I found the object triggering this was an instance of ActiveRecord::Transaction. Adding this condition in appears to fix the problem. --- meta_request/lib/meta_request/event.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/meta_request/lib/meta_request/event.rb b/meta_request/lib/meta_request/event.rb index 87df1fb..0563d48 100644 --- a/meta_request/lib/meta_request/event.rb +++ b/meta_request/lib/meta_request/event.rb @@ -66,6 +66,7 @@ def sanitize_hash(payload) def not_encodable?(value) return true if defined?(ActiveRecord) && value.is_a?(ActiveRecord::ConnectionAdapters::AbstractAdapter) + return true if defined?(ActiveRecord) && defined?(ActiveRecord::Transaction) && value.is_a?(ActiveRecord::Transaction) return true if defined?(ActionDispatch) && (value.is_a?(ActionDispatch::Request) || value.is_a?(ActionDispatch::Response)) return true if defined?(ActionView) && value.is_a?(ActionView::Helpers::FormBuilder) From 844f09b8d3c30c840927b9b414a85b211cf2638b Mon Sep 17 00:00:00 2001 From: Jamie Cobbett Date: Wed, 23 Oct 2024 15:10:30 +0100 Subject: [PATCH 2/3] Add missing rails-7-1 to docker-compose.yml The Dockerfile was added in https://github.com/dejan/rails_panel/pull/199 but not added to this file, so I don't think it is actually used. --- meta_request/docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta_request/docker-compose.yml b/meta_request/docker-compose.yml index 0000881..ebdbe9d 100644 --- a/meta_request/docker-compose.yml +++ b/meta_request/docker-compose.yml @@ -21,3 +21,7 @@ services: build: context: . dockerfile: Dockerfile-rails-7.0 + test-rails-7.1: + build: + context: . + dockerfile: Dockerfile-rails-7.1 From d88fabf4f73d763780bf1fdf391070c93d992492 Mon Sep 17 00:00:00 2001 From: Jamie Cobbett Date: Wed, 23 Oct 2024 15:14:55 +0100 Subject: [PATCH 3/3] Add rails 7.2 to test suite --- meta_request/Dockerfile-rails-7.2 | 36 +++++++++++++++++++++++++++++++ meta_request/docker-compose.yml | 4 ++++ 2 files changed, 40 insertions(+) create mode 100644 meta_request/Dockerfile-rails-7.2 diff --git a/meta_request/Dockerfile-rails-7.2 b/meta_request/Dockerfile-rails-7.2 new file mode 100644 index 0000000..c58d7ed --- /dev/null +++ b/meta_request/Dockerfile-rails-7.2 @@ -0,0 +1,36 @@ +FROM ruby:3.1-alpine + +RUN apk add --update --no-cache \ + build-base \ + curl-dev \ + git \ + nodejs \ + shared-mime-info \ + sqlite-dev \ + tzdata \ + yaml-dev \ + yarn \ + zlib-dev + +RUN mkdir /app /gem +WORKDIR /app + +RUN gem update --system 3.5.7 +RUN bundle config force_ruby_platform true +RUN gem install rails -v 7.2.1.1 +RUN rails new . + +COPY . /gem +RUN bundle add meta_request --path /gem +RUN bundle install + +COPY res/routes.rb /app/config/ +COPY res/dummy_controller.rb /app/app/controllers/ +COPY res/dummy /app/app/views/dummy +COPY res/meta_request_test.rb /app/test/integration/ + +RUN bundle exec rails db:migrate + +ENV PARALLEL_WORKERS 1 + +CMD ["bin/rake"] diff --git a/meta_request/docker-compose.yml b/meta_request/docker-compose.yml index ebdbe9d..9ee56d0 100644 --- a/meta_request/docker-compose.yml +++ b/meta_request/docker-compose.yml @@ -25,3 +25,7 @@ services: build: context: . dockerfile: Dockerfile-rails-7.1 + test-rails-7.2: + build: + context: . + dockerfile: Dockerfile-rails-7.2