Skip to content

Add e2e specs Rails 8 #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 16, 2025
Merged

Add e2e specs Rails 8 #174

merged 2 commits into from
Mar 16, 2025

Conversation

MUTOgen
Copy link
Contributor

@MUTOgen MUTOgen commented Feb 23, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a new job in the CI workflow for Rails 8.
    • Added a new class for application-level controller functionality.
    • Implemented a new job class for background processing.
    • Created new configuration files for Action Cable, caching, and storage services.
    • Developed new HTML templates for custom error pages, enhancing user experience.
  • Cleanup & Upgrades

    • Removed legacy configurations, including outdated gem dependencies and unnecessary files.
    • Upgraded application structure to Rails 8, ensuring compatibility and performance improvements.
    • Enhanced testing setup with new system test configuration and helper files.

@MUTOgen MUTOgen self-assigned this Feb 23, 2025
Copy link

coderabbitai bot commented Feb 23, 2025

Walkthrough

This pull request removes legacy Rails 5.2 files and adds a comprehensive set of new files supporting a Rails 8 environment. A new GitHub Actions workflow job named rails_8 is introduced to run tests using Ruby 3.2.2 with specific bundler versions. Additional new executable scripts, application components, configuration files, database schemas, seed data, and test infrastructure update the project to align with Rails 8 conventions.

Changes

File(s) Change Summary
.github/workflows/ruby.yml Added new job rails_8 which checks out the repo, sets up Ruby 3.2.2, manages bundler versions, and runs tests including interaction tests with CYPRESS_RECORD_KEY.
specs_e2e/rails_5_2/... Removed all Rails 5.2 files and configurations: Gemfile, assets (posts.js, posts.css, scaffold.css), controllers, jobs, views (layouts and welcome), bin scripts, config files (application, boot, credentials, database, environments, initializers, locales), public error pages, and master.key.
specs_e2e/rails_8/{.gitattributes, .rubocop.yml, Gemfile, Rakefile, package.json} Introduced new project-level configuration and dependency files for the Rails 8 setup.
specs_e2e/rails_8/app/... Added Rails 8 application files: new ApplicationController (with modern browser allowance), ApplicationJob (with retry/discard patterns), updated ApplicationRecord (using primary_abstract_class), application.css manifest, and layout template.
specs_e2e/rails_8/bin/... Added new executable scripts (brakeman, bundle, dev, importmap, rails, rake, setup, thrust) serving as wrappers and entry points for the Rails 8 environment.
specs_e2e/rails_8/config/... Created new configuration files for Rails 8 including application, boot, cable, cache, credentials, database, deploy, environments (development, production, test), importmap, various initializers (CSP, filter, inflections), locales, master.key, puma, queue, recurring, and storage; updated config.ru and environment.rb accordingly.
specs_e2e/rails_8/db/... Added new schema files (cable_schema, cache_schema, queue_schema), updated migration (CreatePosts now inherits from ActiveRecord::Migration[7.2]), and added seeds for Rails 8.
specs_e2e/rails_8/public/... Added new custom error pages (400, 404, 406, 422, 500) and updated the robots.txt with documentation guidelines.
specs_e2e/rails_8/test/... Added new test support files: application system test case, test helper with parallel execution and fixtures loader, and a test results JSON file; updated test.sh to reflect Rails version change.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as GitHub Actions Runner
    participant Checkout as Checkout Action
    participant RubySetup as Ruby Setup Action
    participant Bundler as Bundler Manager
    participant Tests as Test Executor

    Runner->>Checkout: Checkout repository
    Runner->>RubySetup: Set up Ruby 3.2.2
    Runner->>Bundler: Uninstall bundler (>=2) and install bundler (<2)
    Runner->>Tests: Run tests with `bundle exec rake`
    Runner->>Tests: Execute interaction tests via ./specs_e2e/rails_8/test.sh
Loading

Possibly related PRs

Poem

Oh, I’m a rabbit with a coding beat,
Hopping from Rails 5.2 to something neat.
New workflows and scripts, a Rails 8 delight,
Each file a carrot shining so bright.
With whiskers twitching at changes so grand,
I celebrate code from my wonderland!
🥕🐰 Happy hops in every command!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bce1cd6 and 37acfad.

📒 Files selected for processing (1)
  • specs_e2e/rails_8/test.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • specs_e2e/rails_8/test.sh
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: rails_6_1
  • GitHub Check: rails_8
  • GitHub Check: rails_7_2

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (22)
specs_e2e/rails_8/config/deploy.yml (1)

7-15: Server Deployment Configuration

The servers: block properly designates a web server with the specified IP, and the job section is commented out for now. If the job functionality is not required in this phase, consider adding a clarifying note or removing it to reduce clutter.

specs_e2e/rails_8/config/initializers/filter_parameter_logging.rb (1)

6-8:

❓ Verification inconclusive

Consider adding more financial and personal identifiers.

The current list of filtered parameters provides good security coverage. However, consider adding more common sensitive parameters:

  • Financial: :card, :account, :routing, :iban
  • Personal: :phone, :dob, :birth, :ssn, :sin, :tax
 Rails.application.config.filter_parameters += [
-  :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
+  :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc,
+  :card, :account, :routing, :iban, :phone, :dob, :birth, :sin, :tax
 ]

Let's verify if any of these sensitive parameters are being used in the codebase:


🏁 Script executed:

#!/bin/bash
# Search for potential sensitive parameters in the codebase
echo "Searching for sensitive parameter usage..."
rg -i "params\.(card|account|routing|iban|phone|dob|birth|sin|tax)"

Length of output: 164


Enhance Sensitive Parameter Filtering

Please update the filtering configuration in specs_e2e/rails_8/config/initializers/filter_parameter_logging.rb to include additional financial and personal identifiers. The improved snippet would appear as follows:

 Rails.application.config.filter_parameters += [
-  :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
+  :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc,
+  :card, :account, :routing, :iban, :phone, :dob, :birth, :sin, :tax
 ]

A preliminary grep search for these additional parameter names did not produce any output. Since this inference may be low-confidence, please perform a manual verification to ensure that adding these parameters aligns with your application's usage patterns and security requirements.

specs_e2e/rails_8/public/404.html (2)

104-106: Enhance SVG Accessibility – Improvement Recommended

The inline SVG used in the header is visually appealing; however, adding accessibility attributes (such as role="img" and, if the SVG is purely decorative, aria-hidden="true") can enhance support for screen readers and improve overall accessibility.


112-115: Extraneous Content Detected – Nitpick

There appears to be an extraneous line (the standalone "115") at the end of the file. Removing it would help maintain clean markup and prevent any unintended rendering issues.

specs_e2e/rails_8/config/environments/production.rb (1)

15-26: Consider production-grade storage and CDN configuration.

While the caching configuration is good, consider the following production optimizations:

  1. Using a CDN by uncommenting and configuring asset_host
  2. Using a cloud storage service (like AWS S3) instead of local storage for better scalability
specs_e2e/rails_8/public/400.html (1)

104-106: SVG Accessibility Enhancement
The inline SVG within the header is a key visual element. Consider adding an accessibility attribute (e.g., aria-hidden="true") if the graphic is purely decorative, or an appropriate role/title if it conveys meaningful information.

specs_e2e/rails_8/db/queue_schema.rb (3)

14-20: Consider adding a foreign key for process_id.
solid_queue_claimed_executions references a process_id yet lacks a corresponding add_foreign_key, which can lead to orphan records if processes are deleted or restructured.

Potential fix:

+  add_foreign_key "solid_queue_claimed_executions", "solid_queue_processes",
+    column: "process_id", on_delete: :cascade

53-65: Add referential integrity for supervisor_id.
If supervisor_id references another record in solid_queue_processes, consider enforcing referential integrity with a foreign key for transactionally consistent data.


123-129: Confirm broad on-delete cascade usage.
All foreign keys cascade on delete, which can be powerful but also risky if jobs or related records are unintentionally removed. Ensure these actions align with your data-retention policies.

Do you need help creating a quick guide or flow diagram on how this cascade might operate in production?

specs_e2e/rails_8/bin/brakeman (1)

1-7: Add frozen string literal pragma.
Consider adding # frozen_string_literal: true at the top of the file to maintain consistency with newer Ruby style guidelines and potentially improve performance.

Proposed change:

1c1
- #!/usr/bin/env ruby
+ #!/usr/bin/env ruby
+# frozen_string_literal: true
specs_e2e/rails_8/test/test_helper.rb (1)

13-13: Consider adding common test helper methods.

The comment indicates a placeholder for helper methods. Consider adding commonly needed helpers for:

  • Authentication setup
  • Factory methods for test data
  • Common assertions

Would you like me to suggest some common helper methods implementation?

specs_e2e/rails_8/db/cable_schema.rb (2)

3-6: Consider optimizing binary field sizes.

The binary field sizes are quite large:

  • channel at 1KB
  • payload at 512MB
    Consider if these limits are necessary for your use case, as they might impact database performance.

5-5: Consider adding updated_at timestamp.

The table only has created_at but missing updated_at. While this might be intentional for message logging, having both timestamps is a Rails convention and might be useful for debugging or maintenance.

 t.datetime "created_at", null: false
+t.datetime "updated_at", null: false
specs_e2e/rails_8/app/views/layouts/application.html.erb (2)

4-4: Consider a more descriptive default title.

The default title "App" is quite generic. Consider using a more descriptive application name.

-    <title><%= content_for(:title) || "App" %></title>
+    <title><%= content_for(:title) || "Rails 8 E2E Tests" %></title>

5-9: Add recommended security headers.

Consider adding additional security-related meta tags and headers for better protection.

     <meta name="viewport" content="width=device-width,initial-scale=1">
     <meta name="apple-mobile-web-app-capable" content="yes">
     <meta name="mobile-web-app-capable" content="yes">
+    <meta name="referrer" content="strict-origin-when-cross-origin">
     <%= csrf_meta_tags %>
     <%= csp_meta_tag %>
+    <%= tag.meta name: "robots", content: "noindex" if Rails.env.test? %>
specs_e2e/rails_8/config/application.rb (1)

17-17: Consider additional autoload ignores for e2e specs.

For e2e testing setup, you might want to ignore additional directories.

-    config.autoload_lib(ignore: %w[assets tasks])
+    config.autoload_lib(ignore: %w[assets tasks specs_e2e])
specs_e2e/rails_8/config/environments/development.rb (2)

28-29: Consider using :null_store for e2e tests.

Using :memory_store might cause inconsistencies in e2e tests. Consider using :null_store or adding a comment about e2e test considerations.

-  # Change to :null_store to avoid any caching.
-  config.cache_store = :memory_store
+  # Use :null_store for e2e tests to avoid caching-related flakiness
+  config.cache_store = Rails.env.test? ? :null_store : :memory_store

40-42: Consider disabling query logs in e2e tests.

Verbose query logs might slow down e2e tests unnecessarily.

   # Highlight code that triggered database queries in logs.
-  config.active_record.verbose_query_logs = true
+  config.active_record.verbose_query_logs = !Rails.env.test?
specs_e2e/rails_8/Gemfile (1)

17-20: Consider adding additional testing gems.

While the current setup with cypress-on-rails and database_cleaner is good, consider adding these gems to improve the testing experience:

  • factory_bot_rails for test data setup
  • faker for generating test data
  • shoulda-matchers for RSpec-like assertions
 group :development, :test do
   gem 'cypress-on-rails', path: '../../'
   gem 'database_cleaner'
+  gem 'factory_bot_rails'
+  gem 'faker'
+  gem 'shoulda-matchers'
 end
.github/workflows/ruby.yml (1)

46-64: Review: New rails_8 Job Configuration

The addition of the rails_8 job is well executed. By updating to Ruby 3.2.2 and reusing the bundler commands (uninstalling conflicting versions and installing the required bundler version), the configuration aligns nicely with the Rails 8 environment. Ensure that the ./specs_e2e/rails_8/test.sh script is kept up to date with any new Rails 8 testing requirements.

As an optional improvement, consider refactoring shared steps (like checking out the repo, Ruby setup, and bundler management) into YAML anchors for enhanced maintainability across similar jobs.

specs_e2e/rails_8/config/initializers/content_security_policy.rb (2)

19-21: Consider a more secure nonce generator for production use.

While using session.id as a nonce generator works, consider using SecureRandom for better security in production. However, for e2e testing purposes, the current implementation is acceptable.

-#   config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+#   config.content_security_policy_nonce_generator = ->(request) { SecureRandom.base64(16) }

23-25: Consider enabling report-only mode during initial testing.

For e2e testing setup, it's recommended to initially enable report-only mode to identify any CSP violations without breaking the tests. This helps in fine-tuning the policy based on actual usage.

-#   # config.content_security_policy_report_only = true
+#   config.content_security_policy_report_only = true if Rails.env.test?
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20ab815 and bce1cd6.

⛔ Files ignored due to path filters (3)
  • specs_e2e/rails_5_2/public/favicon.ico is excluded by !**/*.ico
  • specs_e2e/rails_8/public/icon.png is excluded by !**/*.png
  • specs_e2e/rails_8/public/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (89)
  • .github/workflows/ruby.yml (1 hunks)
  • specs_e2e/rails_5_2/Gemfile (0 hunks)
  • specs_e2e/rails_5_2/app/assets/javascripts/posts.js (0 hunks)
  • specs_e2e/rails_5_2/app/assets/stylesheets/posts.css (0 hunks)
  • specs_e2e/rails_5_2/app/assets/stylesheets/scaffold.css (0 hunks)
  • specs_e2e/rails_5_2/app/controllers/application_controller.rb (0 hunks)
  • specs_e2e/rails_5_2/app/jobs/application_job.rb (0 hunks)
  • specs_e2e/rails_5_2/app/views/layouts/application.html.erb (0 hunks)
  • specs_e2e/rails_5_2/app/views/welcome/index.html.erb (0 hunks)
  • specs_e2e/rails_5_2/bin/bundle (0 hunks)
  • specs_e2e/rails_5_2/bin/rails (0 hunks)
  • specs_e2e/rails_5_2/bin/rake (0 hunks)
  • specs_e2e/rails_5_2/bin/setup (0 hunks)
  • specs_e2e/rails_5_2/bin/update (0 hunks)
  • specs_e2e/rails_5_2/config/application.rb (0 hunks)
  • specs_e2e/rails_5_2/config/boot.rb (0 hunks)
  • specs_e2e/rails_5_2/config/credentials.yml.enc (0 hunks)
  • specs_e2e/rails_5_2/config/database.yml (0 hunks)
  • specs_e2e/rails_5_2/config/environments/development.rb (0 hunks)
  • specs_e2e/rails_5_2/config/environments/production.rb (0 hunks)
  • specs_e2e/rails_5_2/config/environments/test.rb (0 hunks)
  • specs_e2e/rails_5_2/config/initializers/application_controller_renderer.rb (0 hunks)
  • specs_e2e/rails_5_2/config/initializers/backtrace_silencers.rb (0 hunks)
  • specs_e2e/rails_5_2/config/initializers/content_security_policy.rb (0 hunks)
  • specs_e2e/rails_5_2/config/initializers/cookies_serializer.rb (0 hunks)
  • specs_e2e/rails_5_2/config/initializers/filter_parameter_logging.rb (0 hunks)
  • specs_e2e/rails_5_2/config/initializers/mime_types.rb (0 hunks)
  • specs_e2e/rails_5_2/config/initializers/wrap_parameters.rb (0 hunks)
  • specs_e2e/rails_5_2/config/locales/en.yml (0 hunks)
  • specs_e2e/rails_5_2/config/master.key (0 hunks)
  • specs_e2e/rails_5_2/public/404.html (0 hunks)
  • specs_e2e/rails_5_2/public/422.html (0 hunks)
  • specs_e2e/rails_5_2/public/500.html (0 hunks)
  • specs_e2e/rails_5_2/public/robots.txt (0 hunks)
  • specs_e2e/rails_8/.gitattributes (1 hunks)
  • specs_e2e/rails_8/.rubocop.yml (1 hunks)
  • specs_e2e/rails_8/Gemfile (1 hunks)
  • specs_e2e/rails_8/Rakefile (1 hunks)
  • specs_e2e/rails_8/app/assets/stylesheets/application.css (1 hunks)
  • specs_e2e/rails_8/app/controllers/application_controller.rb (1 hunks)
  • specs_e2e/rails_8/app/jobs/application_job.rb (1 hunks)
  • specs_e2e/rails_8/app/models/application_record.rb (1 hunks)
  • specs_e2e/rails_8/app/views/layouts/application.html.erb (1 hunks)
  • specs_e2e/rails_8/bin/brakeman (1 hunks)
  • specs_e2e/rails_8/bin/bundle (1 hunks)
  • specs_e2e/rails_8/bin/dev (1 hunks)
  • specs_e2e/rails_8/bin/importmap (1 hunks)
  • specs_e2e/rails_8/bin/rails (1 hunks)
  • specs_e2e/rails_8/bin/rake (1 hunks)
  • specs_e2e/rails_8/bin/setup (1 hunks)
  • specs_e2e/rails_8/bin/thrust (1 hunks)
  • specs_e2e/rails_8/config.ru (1 hunks)
  • specs_e2e/rails_8/config/application.rb (1 hunks)
  • specs_e2e/rails_8/config/boot.rb (1 hunks)
  • specs_e2e/rails_8/config/cable.yml (1 hunks)
  • specs_e2e/rails_8/config/cache.yml (1 hunks)
  • specs_e2e/rails_8/config/credentials.yml.enc (1 hunks)
  • specs_e2e/rails_8/config/database.yml (1 hunks)
  • specs_e2e/rails_8/config/deploy.yml (1 hunks)
  • specs_e2e/rails_8/config/environment.rb (1 hunks)
  • specs_e2e/rails_8/config/environments/development.rb (1 hunks)
  • specs_e2e/rails_8/config/environments/production.rb (1 hunks)
  • specs_e2e/rails_8/config/environments/test.rb (1 hunks)
  • specs_e2e/rails_8/config/importmap.rb (1 hunks)
  • specs_e2e/rails_8/config/initializers/content_security_policy.rb (1 hunks)
  • specs_e2e/rails_8/config/initializers/filter_parameter_logging.rb (1 hunks)
  • specs_e2e/rails_8/config/initializers/inflections.rb (1 hunks)
  • specs_e2e/rails_8/config/locales/en.yml (1 hunks)
  • specs_e2e/rails_8/config/master.key (1 hunks)
  • specs_e2e/rails_8/config/puma.rb (1 hunks)
  • specs_e2e/rails_8/config/queue.yml (1 hunks)
  • specs_e2e/rails_8/config/recurring.yml (1 hunks)
  • specs_e2e/rails_8/config/storage.yml (1 hunks)
  • specs_e2e/rails_8/db/cable_schema.rb (1 hunks)
  • specs_e2e/rails_8/db/cache_schema.rb (1 hunks)
  • specs_e2e/rails_8/db/migrate/20180621085832_create_posts.rb (1 hunks)
  • specs_e2e/rails_8/db/queue_schema.rb (1 hunks)
  • specs_e2e/rails_8/db/seeds.rb (1 hunks)
  • specs_e2e/rails_8/package.json (1 hunks)
  • specs_e2e/rails_8/public/400.html (1 hunks)
  • specs_e2e/rails_8/public/404.html (1 hunks)
  • specs_e2e/rails_8/public/406-unsupported-browser.html (1 hunks)
  • specs_e2e/rails_8/public/422.html (1 hunks)
  • specs_e2e/rails_8/public/500.html (1 hunks)
  • specs_e2e/rails_8/public/robots.txt (1 hunks)
  • specs_e2e/rails_8/test-results/.last-run.json (1 hunks)
  • specs_e2e/rails_8/test.sh (1 hunks)
  • specs_e2e/rails_8/test/application_system_test_case.rb (1 hunks)
  • specs_e2e/rails_8/test/test_helper.rb (1 hunks)
💤 Files with no reviewable changes (33)
  • specs_e2e/rails_5_2/app/controllers/application_controller.rb
  • specs_e2e/rails_5_2/config/initializers/mime_types.rb
  • specs_e2e/rails_5_2/bin/rake
  • specs_e2e/rails_5_2/config/master.key
  • specs_e2e/rails_5_2/bin/bundle
  • specs_e2e/rails_5_2/config/locales/en.yml
  • specs_e2e/rails_5_2/app/views/welcome/index.html.erb
  • specs_e2e/rails_5_2/app/assets/stylesheets/posts.css
  • specs_e2e/rails_5_2/public/robots.txt
  • specs_e2e/rails_5_2/config/initializers/application_controller_renderer.rb
  • specs_e2e/rails_5_2/public/404.html
  • specs_e2e/rails_5_2/config/initializers/backtrace_silencers.rb
  • specs_e2e/rails_5_2/config/initializers/cookies_serializer.rb
  • specs_e2e/rails_5_2/config/environments/test.rb
  • specs_e2e/rails_5_2/config/database.yml
  • specs_e2e/rails_5_2/bin/setup
  • specs_e2e/rails_5_2/app/views/layouts/application.html.erb
  • specs_e2e/rails_5_2/Gemfile
  • specs_e2e/rails_5_2/config/application.rb
  • specs_e2e/rails_5_2/app/jobs/application_job.rb
  • specs_e2e/rails_5_2/config/credentials.yml.enc
  • specs_e2e/rails_5_2/config/initializers/content_security_policy.rb
  • specs_e2e/rails_5_2/bin/rails
  • specs_e2e/rails_5_2/app/assets/javascripts/posts.js
  • specs_e2e/rails_5_2/config/initializers/filter_parameter_logging.rb
  • specs_e2e/rails_5_2/public/422.html
  • specs_e2e/rails_5_2/config/boot.rb
  • specs_e2e/rails_5_2/config/environments/production.rb
  • specs_e2e/rails_5_2/public/500.html
  • specs_e2e/rails_5_2/config/initializers/wrap_parameters.rb
  • specs_e2e/rails_5_2/bin/update
  • specs_e2e/rails_5_2/config/environments/development.rb
  • specs_e2e/rails_5_2/app/assets/stylesheets/scaffold.css
✅ Files skipped from review due to trivial changes (33)
  • specs_e2e/rails_8/Rakefile
  • specs_e2e/rails_8/config/environment.rb
  • specs_e2e/rails_8/public/robots.txt
  • specs_e2e/rails_8/test.sh
  • specs_e2e/rails_8/app/jobs/application_job.rb
  • specs_e2e/rails_8/config/boot.rb
  • specs_e2e/rails_8/test/application_system_test_case.rb
  • specs_e2e/rails_8/bin/dev
  • specs_e2e/rails_8/.gitattributes
  • specs_e2e/rails_8/bin/rails
  • specs_e2e/rails_8/config/cache.yml
  • specs_e2e/rails_8/bin/rake
  • specs_e2e/rails_8/config/initializers/inflections.rb
  • specs_e2e/rails_8/bin/importmap
  • specs_e2e/rails_8/config/queue.yml
  • specs_e2e/rails_8/config/recurring.yml
  • specs_e2e/rails_8/package.json
  • specs_e2e/rails_8/app/assets/stylesheets/application.css
  • specs_e2e/rails_8/config/master.key
  • specs_e2e/rails_8/test-results/.last-run.json
  • specs_e2e/rails_8/config/puma.rb
  • specs_e2e/rails_8/config/importmap.rb
  • specs_e2e/rails_8/public/422.html
  • specs_e2e/rails_8/db/cache_schema.rb
  • specs_e2e/rails_8/public/500.html
  • specs_e2e/rails_8/config/locales/en.yml
  • specs_e2e/rails_8/config/credentials.yml.enc
  • specs_e2e/rails_8/config/environments/test.rb
  • specs_e2e/rails_8/public/406-unsupported-browser.html
  • specs_e2e/rails_8/.rubocop.yml
  • specs_e2e/rails_8/bin/thrust
  • specs_e2e/rails_8/db/migrate/20180621085832_create_posts.rb
  • specs_e2e/rails_8/db/seeds.rb
🔇 Additional comments (44)
specs_e2e/rails_8/config/deploy.yml (11)

1-3: Service Name Configuration

The application service is defined as app. Ensure this value aligns with your overall naming conventions across environments.


4-6: Container Image Configuration

The image is currently set as your-user/app, which appears to be a placeholder. Verify that this value is updated based on your actual Docker image repository before deployment.


16-23: SSL and Proxy Configuration

The proxy settings enable SSL with auto-certification and designate app.example.com as the host. Ensure that this domain is updated to reflect your production domain. The comments provide clear guidance for edge cases like Cloudflare usage.


24-33: Registry Credentials Configuration

The registry block is structured correctly with a username and password list. Remember to replace placeholder values with secure credentials and avoid checking sensitive data into version control.


34-55: Environment Variables Injection

The env: block clearly separates secret and clear environment variables. The inclusion of SOLID_QUEUE_IN_PUMA: true is explicit, and the commented lines serve as useful documentation for optional configurations. Confirm that these settings match your deployment needs.


56-63: Alias Commands Configuration

The defined aliases for console, shell, logs, and dbc streamline command-line operations. They are clearly specified and should enhance developer productivity when interacting with containers.


64-69: Persistent Storage Volume Setup

The volumes configuration for persistent storage (app_storage:/rails/storage) is concise. Verify that the mounted volume path is appropriately backed up and aligns with your production storage strategy.


70-75: Asset Path Bridging

The asset path is set to /rails/public/assets to bridge fingerprinted assets. Ensure that this path accurately reflects the location of your precompiled assets to prevent 404 errors.


76-89: Image Builder Configuration

The builder: block is well-organized and includes clear commentary on remote builds and build arguments. Retaining the commented examples is useful for future reference; just be sure to remove or update them as your build process evolves.


90-93: SSH User Configuration (Commented Out)

The optional SSH configuration is provided as a commented template for running as a non-root user. This is a good security practice—ensure you update and enable it if required by your deployment environment.


94-117: Accessory Services Configuration

The commented out accessory services for MySQL and Redis serve as practical templates for future use. When you decide to integrate these services, make sure to adjust the configuration (host, port, files, etc.) to fit your production or staging environment.

specs_e2e/rails_8/config/initializers/filter_parameter_logging.rb (1)

1-5: LGTM! Clear and comprehensive documentation.

The comments effectively explain the purpose, behavior, and requirements of this configuration file. The reference to ActiveSupport::ParameterFilter documentation is particularly helpful for maintainers.

specs_e2e/rails_8/public/404.html (2)

1-12: HTML Structure and Meta Tags – Approved

The document begins with a correct HTML5 doctype, specifies the language attribute, and includes the essential meta tags (charset, viewport, and robots). This establishes a solid foundation for the 404 error page.


107-109: Clear and Informative 404 Message – Approved

The content within the <article> tag presents a clear, user-friendly message that explains the error and suggests possible causes. This is effective for guiding users when they encounter a missing page.

specs_e2e/rails_8/config/environments/production.rb (4)

1-14: LGTM! Core configuration follows Rails production best practices.

The configuration correctly disables code reloading, enables eager loading for better performance, and disables local request consideration for security.


36-48: LGTM! Logging configuration follows 12-factor app principles.

The configuration correctly implements:

  • STDOUT logging with request ID tracking
  • Environment-based log level configuration
  • Health check noise reduction
  • Deprecation silence in production

56-71: Update mailer configuration for production use.

The mailer configuration needs production-specific updates:

  1. Replace example.com with the actual production domain
  2. Uncomment and configure SMTP settings
  3. Ensure SMTP credentials are properly set using rails credentials:edit

49-55:

✅ Verification successful

Verify solid_cache and solid_queue gem dependencies.

The configuration uses Rails 8's new features. Please ensure:

  1. The required gems are added to the Gemfile
  2. The queue database configuration exists in database.yml

🌐 Web query:

Are solid_cache_store and solid_queue officially supported in Rails 8?

💡 Result:

Yes, both solid_cache_store (Solid Cache) and solid_queue (Solid Queue) are officially supported in Rails 8 as default components. Here’s a breakdown:


Solid Cache

  • Official status: Enabled by default in new Rails 8 apps[1][3][6].
  • Purpose: Replaces Redis for caching by using your SQL database (PostgreSQL/MySQL/SQLite) or dedicated NVMe SSD storage[1][10].
  • Key benefits:
    • Larger caches (weeks instead of hours)[7]
    • Simplified infrastructure (no Redis dependency)[10]
    • Automatic configuration via rails new[1][6]
  • Disabling: Use rails new app_name --skip-solid[3][6].

Solid Queue

  • Official status: Default Active Job backend in Rails 8[6][8].
  • Purpose: Manages background jobs via your SQL database instead of Redis/Sidekiq[2][4][7].
  • Key benefits:
    • Eliminates Redis/Sidekiq dependencies[4][7]
    • Supports prioritization, retries, and scheduling[4]
    • Configured automatically with rails new[6]
  • Disabling: Same --skip-solid flag as Solid Cache[3][6].

Key Evidence

Feature Source Confirmation
Default in Rails 8 Enabled unless skipped via --skip-solid ([Rails Guides][3], [Rails Blog][6])
Database-backed design Uses SQL instead of Redis ([GitHub docs][1], [Jay's Tech Bites][9])
Production readiness Explicitly recommended for production caching/jobs ([Pawel Urbanek][7], [YT demo][10])

Comparison Table

Solid Cache Solid Queue
Replaces Redis/Memcached Sidekiq/Resque
Storage SQL database or NVMe SSDs SQL database
Rails 8 Default ✔️ ✔️
Infra Simplification No Redis required No Redis required

For existing apps, migration guides are available to adopt these tools incrementally[7][9].

Citations:


Solid Cache & Solid Queue Configuration Verified

The web query confirms that both solid_cache_store and solid_queue are officially supported in Rails 8. The configuration in specs_e2e/rails_8/config/environments/production.rb (lines 49-55) correctly utilizes Rails 8’s default components.

Please ensure:

  • The necessary gem dependencies are added in the Gemfile (or are automatically provided by Rails when not skipped).
  • The queue database configuration referenced in config.solid_queue.connects_to exists and matches the appropriate settings in database.yml.

If these conditions are met, no further changes are required.

specs_e2e/rails_8/public/400.html (4)

1-3: HTML Structure & Doctype Declaration
The file begins with a proper HTML5 doctype declaration and sets the language attribute appropriately, ensuring a modern and accessible document structure.


5-12: Head Metadata & Title Setup
The <head> section includes essential meta tags (charset, viewport, robots) and a descriptive title. Although the title is verbose, it effectively communicates the error context.


13-84: Inline CSS Styling Overview
The inline CSS is comprehensive, employing modern layout techniques like CSS Grid, responsive typography via clamp(), and proper resets (e.g., universal box-sizing). The styling is well-organized and enhances the user experience.


99-114: Well-Structured HTML Body
The <body> section is neatly organized with a <main> container that includes both a <header> (with an inline SVG) and an <article> for the error message. This clear structure supports both usability and readability.

specs_e2e/rails_8/db/queue_schema.rb (2)

1-1: Confirm ActiveRecord schema version alignment with Rails 8.
This file references ActiveRecord::Schema[7.1], which may conflict with the stated objective of incorporating “Rails 8” changes.

Would you like to confirm that this version is indeed correct for your Rails 8 environment?


112-121: Evaluate concurrency/semaphore usage.
The solid_queue_semaphores table uses a simple value integer and expiration strategy. Before shipping, verify your concurrency approach and consider whether an additional index on key plus concurrency logic is needed to handle high-throughput scenarios.

specs_e2e/rails_8/app/models/application_record.rb (1)

2-2: Use of primary_abstract_class is aligned with modern Rails.
This approach is recommended in Rails 7.x+ and helps keep the base model class separate from direct instantiation.

specs_e2e/rails_8/config.ru (1)

3-6: LGTM! Follows Rails 8 best practices.

The configuration properly initializes the Rails 8 application with the required load_server call.

specs_e2e/rails_8/app/controllers/application_controller.rb (1)

2-3:

❓ Verification inconclusive

Verify browser compatibility requirements.

The allow_browser versions: :modern directive restricts access to only modern browsers. While this ensures better feature support, please verify if this restriction is intentional for e2e specs, as it might affect test coverage for older browsers.


🌐 Web query:

What browsers are considered "modern" by Rails 8's allow_browser versions: :modern directive?

💡 Result:

Rails 8 defines "modern" browsers through its allow_browser directive as those supporting key web features like webp images, web push, badges, import maps, CSS nesting, and CSS :has. The specific browser versions considered modern are:

  • Safari: 17.2+
  • Chrome: 120+
  • Firefox: 121+
  • Opera: 106+

This configuration blocks older browsers by default while allowing newer versions and agents without user-agent headers[1][4][10]. Developers can customize these thresholds further using hash syntax (e.g., allow_browser versions: { safari: 16.4 }) or override defaults in specific controllers[1][7]. Unsupported browsers receive a 406 Not Acceptable response with public/406-unsupported-browser.html[1][7].

Citations:


Confirm browser support scope.

The allow_browser versions: :modern directive restricts access to browsers that support key modern web features (webp images, web push, badges, import maps, CSS nesting, and CSS :has). In Rails 8, this means that only Safari (17.2+), Chrome (120+), Firefox (121+), and Opera (106+) are allowed. Please verify that this configuration is intentional for our e2e specs. If broader browser coverage (including legacy browsers) is needed for testing, consider adjusting these restrictions.

specs_e2e/rails_8/test/test_helper.rb (1)

7-9: LGTM! Efficient test parallelization setup.

The parallel test configuration using number_of_processors is optimal for maximizing test execution speed.

specs_e2e/rails_8/db/cable_schema.rb (1)

7-9: LGTM! Good index coverage.

The indexes on channel, channel_hash, and created_at are well-chosen for optimizing common query patterns.

specs_e2e/rails_8/app/views/layouts/application.html.erb (1)

13-14: Consider enabling PWA support for e2e testing.

The PWA manifest is commented out. Since this is for e2e testing, enabling PWA features could help test offline functionality.

Please verify if PWA testing is part of the e2e test requirements. If so, we can help implement the manifest configuration.

specs_e2e/rails_8/config/application.rb (1)

12-12: LGTM! Rails 8 defaults are properly configured.

The application is correctly configured to use Rails 8.0 defaults.

specs_e2e/rails_8/Gemfile (1)

4-4: LGTM! Rails 8 version is correctly specified.

The ~> 8.0.1 constraint ensures compatibility with Rails 8 while allowing patch updates.

specs_e2e/rails_8/config/database.yml (2)

26-41: LGTM! Well-structured multiple database configuration.

The production setup with separate databases for primary, cache, queue, and cable operations follows best practices:

  • Each database has its own migration path
  • Consistent naming convention
  • Proper inheritance from default configuration

14-14:

✅ Verification successful

Verify storage directory existence.

Ensure the storage/ directory exists and has proper permissions for database files.

Also applies to: 21-21


🏁 Script executed:

#!/bin/bash
# Check if storage directory exists and create it if needed
if [ ! -d "specs_e2e/rails_8/storage" ]; then
  echo "Storage directory missing"
  exit 1
fi

# Check directory permissions
ls -ld specs_e2e/rails_8/storage

Length of output: 151


Storage directory configuration verified

The specs_e2e/rails_8/storage directory exists and has the appropriate permissions (drwxr-xr-x), confirming that the database file at storage/development.sqlite3 is correctly supported. Both the configuration at line 14 and its counterpart at line 21 in specs_e2e/rails_8/config/database.yml are properly aligned with this setup. Please ensure that any production database configuration that relies on this storage path is similarly verified.

specs_e2e/rails_8/config/cable.yml (1)

11-17:

✅ Verification successful

Verify solid_cable adapter compatibility.

The production configuration uses solid_cable adapter with specific settings. Please verify:

  1. The adapter's compatibility with Rails 8
  2. The appropriateness of the polling interval and message retention periods

🌐 Web query:

Is solid_cable adapter compatible with Rails 8?

💡 Result:

Yes, the solid_cable adapter is fully compatible with Rails 8 and serves as its default Action Cable adapter for production environments[1][3][4]. This integration eliminates Redis as a mandatory dependency for real-time WebSocket communication by leveraging your existing SQL database (PostgreSQL, MySQL, or SQLite)[2][4][7].

Key Details:

  • Default Configuration:
    Rails 8 configures solid_cable as the standard adapter in config/cable.yml, replacing Redis-based setups[3][7].
  • Database Backend:
    Messages are stored in a database table (solid_cable_messages) and polled at sub-second intervals (default: 0.1.seconds), achieving performance comparable to Redis for most use cases[3][4][5].
  • Hotwire Integration:
    Works seamlessly with Turbo and Stimulus for real-time UI updates without custom JavaScript[2][5].

Example Configuration:

# config/cable.yml
production:
  adapter: solid_cable
  connects_to:
    database:
      writing: cable
  polling_interval: 0.1.seconds

For new Rails 8 apps, no additional setup is required. Existing apps can migrate by updating their cable.yml and running bin/rails solid_cable:install to create the necessary database tables[2][7]. While Redis remains optional for advanced scaling needs, solid_cable simplifies deployments by reducing infrastructure dependencies[1][4][9].

Citations:


Solid Cable Adapter Configuration Verified

The production configuration using the solid_cable adapter is fully compatible with Rails 8, as confirmed by recent documentation. The polling interval of 0.1.seconds matches the established default for Rails 8 setups. Additionally, while the message_retention: 1.day parameter isn’t part of the default configuration example, it appears acceptable provided it aligns with your production messaging requirements.

  • Production Configuration:

    • solid_cable is confirmed as the default and compatible adapter for Rails 8.
    • The polling interval is set correctly for optimal performance.
    • The custom message_retention setting should be double-checked to ensure it meets your specific needs.
  • Development/Test Setup:

    • Ensure that your development/test configurations remain consistent, especially if using alternative adapters or if different messaging retention logic is required.
specs_e2e/rails_8/bin/bundle (2)

13-103: LGTM! Well-structured Bundler initialization.

The module provides robust version detection and error handling for Bundler activation.


1-1:

✅ Verification successful

Verify script permissions.

Ensure the bundle script is executable.


🏁 Script executed:

#!/bin/bash
# Check if the script is executable
if [ ! -x "specs_e2e/rails_8/bin/bundle" ]; then
  echo "Bundle script is not executable"
  exit 1
fi

Length of output: 45


Bundle Script Permissions Verified

The specs_e2e/rails_8/bin/bundle file is correctly marked as executable. The permissions check executed without errors, confirming that no changes are necessary.

specs_e2e/rails_8/config/storage.yml (6)

1-4: Review: Test Storage Configuration

The test service is configured correctly using the Disk service with its root set to tmp/storage via Rails.root.join. This is a common and effective setup for an isolated test environment.


5-8: Review: Local Storage Configuration

The local configuration correctly uses the Disk service pointed at a dedicated storage directory. This clear separation of environments is appropriate for local development.


9-16: Review: AWS S3 Configuration (Commented)

The commented-out AWS S3 configuration provides useful instructions (via bin/rails credentials:edit) and serves as a template. Be sure to secure all sensitive data in Rails credentials when activated.


17-23: Review: Google Cloud Storage Configuration (Commented)

The configuration template for Google Cloud Storage is well-documented, and the reminder not to check in your GCS keyfile is an excellent security measure.


24-30: Review: Azure Storage Configuration (Commented)

The Azure Storage commented section is consistent with the AWS and GCS sections. It includes clear instructions for setting secrets via credentials.


31-34: Review: Mirror Service Configuration (Commented)

The mirror configuration template, though commented, provides a useful blueprint for future needs. Make sure that, if enabled, the service names and mirror array are validated against actual storage service configurations.

specs_e2e/rails_8/config/initializers/content_security_policy.rb (1)

1-6: LGTM! Documentation is clear and helpful.

The file includes proper documentation and links to the Rails security guide, which is essential for maintainers to understand and modify the CSP configuration.

@MUTOgen MUTOgen merged commit c89651e into master Mar 16, 2025
3 checks passed
@MUTOgen MUTOgen deleted the update-e2e-specs-setup-3 branch March 16, 2025 17:28
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