Skip to content

Release 0.6.0: drop Rails 5.2 + Phase 2a housekeeping rollup#10

Merged
antarr merged 6 commits into
mainfrom
release/0.6.0
Apr 12, 2026
Merged

Release 0.6.0: drop Rails 5.2 + Phase 2a housekeeping rollup#10
antarr merged 6 commits into
mainfrom
release/0.6.0

Conversation

@antarr

@antarr antarr commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Summary

Paired release of mysql_genius-core 0.6.0 + mysql_genius 0.6.0. Drops Rails 5.2 support from the Rails adapter and rolls up the 8 post-0.5.0 commits sitting on main (3 CI fixes + 6 housekeeping cleanups).

Headline change: Rails 5.2 dropped

  • mysql_genius.gemspec: activerecord/railties floor raised from ">= 5.2" to ">= 6.0"
  • .github/workflows/ci.yml: Rails 5.2 row removed from the matrix entirely (plus its 5 exclude entries since they no longer apply). Matrix shrinks from 31 → 23 cells.
  • README compatibility table: Rails 5.2 row removed; note updated to point at 0.5.0 as the pin target
  • Users on Rails 5.2 who can't upgrade yet can pin gem "mysql_genius", "~> 0.5.0"

Why now: Rails 5.2 has been EOL since June 2022. Its bit-rot against modern Rack (ActionDispatch::Static#initialize arity mismatch, MiddlewareStack#operations removal) started surfacing as CI failures once Phase 2a's integration specs booted Rails in test. The combination of EOL upstream + CI friction + no practical users on that combination justifies raising the floor.

Rollup of post-0.5.0 work

CI fixes (3 commits):

  • require "logger" before require "rails" in rails_helper + dummy app — works around Ruby 3.x + older ActiveSupport incompatibility (LoggerThreadSafeLevel references Logger without requiring it)
  • Ruby 3.0 × Rails 5.2 excluded from matrix (made moot by the Rails 5.2 drop in this PR)
  • README note about Rails 5.2 being the last 0.5.0-supported version (updated in this PR to the dropped state)

Housekeeping cleanups (6 commits):

  • Duplicate source_code_uri metadata dropped from both gemspecs
  • actions/checkout@v4@v5 in both CI and publish workflows
  • default: false coverage gap closed in Core::Analysis::Columns spec (+1 example)
  • fake_result(columns:, rows:, to_a:) test helper extracted, 4 duplicated instance_double("ActiveRecord::Result", ...) call sites refactored
  • rails_connection consolidated into BaseController — 9 inline ActiveRecordAdapter.new(...) call sites + 2 private helpers collapse to 1
  • ai_domain_context helper inlined into its 2 callers (anomaly_detection, root_cause) and deleted

Test plan

  • bundle exec rspec — adapter 76/0
  • (cd gems/mysql_genius-core && bundle exec rspec) — core 194/0
  • bundle exec rubocop — 98 files clean
  • (cd gems/mysql_genius-core && bundle exec rubocop) — 60 files clean
  • bundle install resolves mysql_genius-core 0.6.0 + mysql_genius 0.6.0
  • Real host-app smoke test via path dep (your epitome): boot on branch, exercise every tab, confirm no regressions. Should be a no-op since this is almost entirely doc/gemspec/CHANGELOG/test-helper work — the only adapter code change is the rails_connection consolidation which is pure refactor with no behavior change.
  • After merge: tag v0.6.0, verify publish workflow pushes both gems
  • After release: fresh bundle install against gem "mysql_genius", "0.6.0" resolves mysql_genius-core 0.6.0 transitively

Breaking change

Rails 5.2 users: bundle update mysql_genius will fail to resolve on Rails 5.2. Pin gem "mysql_genius", "~> 0.5.0" to stay on a Rails 5.2-compatible version.

All Rails 6.0+ users: zero observable change. The internal refactors (rails_connection, ai_domain_context, fake_result) are pure code-organization cleanups.

What's next

  • Phase 2b — build gems/mysql_genius-desktop/ Sinatra sidecar (fresh brainstorming session, multi-task effort)

antarr added 6 commits April 11, 2026 16:18
…to v5

Two small cleanups:

1. Both gemspecs had `metadata["source_code_uri"] = spec.homepage` alongside
   `metadata["homepage_uri"] = spec.homepage` — same value. RubyGems emitted
   a warning on every build: "You have specified the uri: ... for all of the
   following keys: homepage_uri source_code_uri. Only the first one will be
   shown on rubygems.org." Dropped the duplicate source_code_uri line from
   both gemspecs. homepage_uri stays; changelog_uri stays.

2. `actions/checkout@v4` bumped to `@v5` in both ci.yml and publish.yml.
   GitHub deprecates Node 20 on 2026-06-02 and will force actions onto
   Node 24; v5 is Node-24-native. Every CI run currently emits a
   deprecation warning for each job in the matrix.

No behavior change, no version bump, no release needed.
Task 12's code review flagged a coverage gap: the fixture had 3 default
columns + 2 masked columns, so every visible column was also in
default_columns — the `default: false` branch of
`defaults.empty? || defaults.include?(col.name)` was never exercised.

Adds a 6th column `updated_at` to the fixture (visible, not masked, not
in default_columns) and a new example asserting it comes back with
`default: false`. Pins the `!defaults.empty? && !defaults.include?` path
so a future refactor can't silently regress it.

8 examples, 0 failures (was 7).
Task 7's code review flagged the repetitive pattern
`instance_double("ActiveRecord::Result", columns: [], rows: [], to_a: [])`
across multiple request specs. Extracts a `fake_result(columns:, rows:, to_a:)`
helper into FakeConnectionHelper alongside fake_column, with a smart
to_a default that builds a hash-per-row from the columns metadata.

Four call sites refactored to use the helper:
- spec/support/fake_connection.rb — the internal empty_result fallback
- spec/requests/mysql_genius/analysis_spec.rb — 8-line stub → 1-line call
- spec/requests/mysql_genius/query_execution_spec.rb — two literals collapsed
- spec/requests/mysql_genius/ai_features_spec.rb — empty_result literal,
  keeps the extra `.each` stub that root_cause action requires

76 examples, 0 failures, rubocop clean.
Before this commit there were 9 inline sites in concerns and 2 separate
private helpers (one in QueriesController, one in AiFeatures) all doing

    MysqlGenius::Core::Connection::ActiveRecordAdapter.new(ActiveRecord::Base.connection)

After: one private method on BaseController. All concerns that delegate
to Core::* services now call `rails_connection` directly. Ruby method
lookup handles it because the concerns are included into QueriesController
which inherits from BaseController — the private helper on the parent
class is accessible from any method on the instance, regardless of
which concern module the method is defined in.

Net effect: ~25 lines deleted across 4 files, one helper to maintain.

Call sites updated:
- QueryExecution#execute, #explain (2 sites) — dropped `connection = ...`
  local binding, pass `rails_connection` directly to QueryRunner.new
- DatabaseAnalysis: 5 action sites all refactored
- AiFeatures#suggest, #optimize (2 sites) — dropped `connection = ...`
  local binding. The 4 Phase 2a-delegated actions (schema_review,
  rewrite_query, index_advisor, migration_risk) were already using
  rails_connection — no change there, just the helper definition moved.

Both private helper definitions deleted:
- QueriesController#rails_connection (added in Task 19)
- AiFeatures#rails_connection (added in Task 20)

76 examples, 0 failures. Rubocop clean.
Task 20 left ai_domain_context as a thin shim returning
ai_system_context with a "Domain context:" prefix. It was only called
from the 2 remaining Rails-side AI actions (anomaly_detection and
root_cause — both keep Redis dependencies). Inlining it removes the
indirection.

Each of the two actions now computes a local `domain_ctx` string
just before building its messages array:

    domain_ctx = mysql_genius_config.ai_system_context.present? ? "\nDomain context:\n#{mysql_genius_config.ai_system_context}" : ""

and interpolates `#{domain_ctx}` in the system prompt heredoc.
Behavior is identical.

ai_domain_context private helper deleted. 76 examples, 0 failures.
Rubocop clean.
- mysql_genius-core: 0.5.0 -> 0.6.0 (no functional changes)
- mysql_genius: 0.5.0 -> 0.6.0
- mysql_genius.gemspec activerecord/railties floor: ">= 5.2" -> ">= 6.0"
- mysql_genius.gemspec mysql_genius-core dep: "~> 0.5.0" -> "~> 0.6.0"
- .github/workflows/ci.yml: Rails 5.2 matrix row removed entirely
  (plus its 5 exclude entries). Matrix shrinks from 31 to 23 cells.
- README compatibility table: Rails 5.2 row dropped; note updated to
  point at 0.5.0 as the pin target for users who can't upgrade yet.
- CHANGELOG.md: new ## 0.6.0 section rolling up the Rails 5.2 drop
  plus the 8 post-0.5.0 commits (logger require, matrix Ruby 3.0 x
  Rails 5.2 exclude, README compat note, 6 housekeeping cleanups).
- gems/mysql_genius-core/CHANGELOG.md: new ## 0.6.0 section noting
  the lockstep bump with no functional changes.

Rails 5.2 has been EOL since June 2022. Rails 5.2's bit-rot against
modern Rack (ActionDispatch::Static#initialize arity mismatch,
MiddlewareStack#operations removal) started surfacing as CI failures
once Phase 2a's integration specs booted Rails in test. Users on
Rails 5.2 can pin `gem "mysql_genius", "~> 0.5.0"` if they can't
upgrade Rails yet.

The next commit tags v0.6.0 and kicks off the publish workflow,
which will push mysql_genius-core 0.6.0 first and then
mysql_genius 0.6.0 to rubygems.
@antarr antarr merged commit e59f9e4 into main Apr 12, 2026
30 checks passed
@antarr antarr deleted the release/0.6.0 branch April 12, 2026 01:37
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