Add Coverband for production code coverage tracking#163
Add Coverband for production code coverage tracking#163JuanVqz merged 16 commits intorailsbump:mainfrom
Conversation
CGI.parse was removed in Ruby 4.0, causing VCR 6.3.1 to fail.
Unmaintained since 2022 and incompatible with Ruby 4.0 (C extension). Ruby 4.0 ships with the debug gem as a built-in replacement.
Its dependency rouge uses CGI.parse which is removed in Ruby 4.0. Rails built-in error pages are sufficient for development.
faraday, faraday_middleware, faraday-multipart, and faraday-retry were listed explicitly but never used directly in app code. Octokit pulls in faraday transitively via sawyer. Removing the explicit pins allows faraday to resolve to 2.x (from 1.x), dropping the deprecated faraday_middleware and several unused adapter gems.
The codecov gem is deprecated and archived. Replace it with the official Codecov GitHub Action which picks up SimpleCov's coverage output and uploads it using the existing CODECOV_TOKEN secret.
CI runs on ubuntu (x86_64-linux) but lockfiles only had arm64-darwin-25.
Tracks which code paths are actually hit in production (web + Sidekiq), helping identify dead code before the DirectResolver migration. - Uses existing Redis via $redis global - Mounts web UI at /coverband behind basic auth (same creds as Sidekiq) - Enables view tracking and background reporting
jeremysmithco
left a comment
There was a problem hiding this comment.
Cool! I haven't used Coverband before.
There might be some way to consolidate the auth checks in routes, like with a route constraint or something. But that's minor.
|
@JuanVqz I just noticed when I tried to visit /coverband locally that it couldn't find Redis, and it appears it's because of the initializer load order. (coverband.rb loads before redis.rb, so $redis is nil when Coverband::Adapters::RedisStore.new($redis) runs) Were you seeing this on your machine? |
Co-authored-by: Juan Vásquez <javasgon@gmail.com>
Coverband's initializer was using $redis which is defined in config/initializers/redis.rb. Since initializers load alphabetically, coverband.rb loads before redis.rb, making $redis nil and causing "undefined method 'get' for nil" errors. Create a dedicated Redis connection directly in the Coverband config to avoid the load order dependency.
Enable web_enable_clear so coverage data can be reset from the /coverband UI, useful for getting a clean baseline after deploys. Add ignore list to exclude boot/config files that add noise to the coverage report without providing actionable insights.
Fixed, thanks for flagging it |
# Conflicts: # Gemfile.lock # Gemfile.next.lock
Summary
/coverbandbehind basic auth (same creds as Sidekiq)Test plan
/coverbandask Juan for credentials