From df305e92cf1f45961019789fd80eacf53e310fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 28 Apr 2026 15:26:00 -0600 Subject: [PATCH 1/4] Fix: compare mode does not run on buckets --- CHANGELOG.md | 1 + lib/deprecation_tracker.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25eacd6..927c820 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.5.0...main) +- [BUGFIX: DeprecationTracker#compare ignores buckets](https://github.com/fastruby/next_rails/pull/180) - [BUGFIX: example](https://github.com/fastruby/next_rails/pull/) - [BUGFIX: Compare mode now checks only buckets the current process ran, fixing parallel test support](https://github.com/fastruby/next_rails/pull/179) diff --git a/lib/deprecation_tracker.rb b/lib/deprecation_tracker.rb index 08379c6..516e2d2 100644 --- a/lib/deprecation_tracker.rb +++ b/lib/deprecation_tracker.rb @@ -184,7 +184,7 @@ def compare changed_buckets = [] - normalized_deprecation_messages.each do |bucket, messages| + deprecation_messages.each do |bucket, messages| if stored[bucket] != messages changed_buckets << bucket end From 972fdbb1b36126dd60055438eeef9bf36ef1a2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 28 Apr 2026 15:58:40 -0600 Subject: [PATCH 2/4] fix: remove space in block parameter for Ruby 2.3 compatibility Block parameter |k ,v| with space before comma may not parse correctly on Ruby 2.3. Changed to |k, v|. --- lib/deprecation_tracker.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/deprecation_tracker.rb b/lib/deprecation_tracker.rb index 516e2d2..154648f 100644 --- a/lib/deprecation_tracker.rb +++ b/lib/deprecation_tracker.rb @@ -184,7 +184,7 @@ def compare changed_buckets = [] - deprecation_messages.each do |bucket, messages| + normalized_deprecation_messages.each do |bucket, messages| if stored[bucket] != messages changed_buckets << bucket end @@ -252,7 +252,7 @@ def normalized_deprecation_messages # not using `to_h` here to support older ruby versions {}.tap do |h| - normalized.reject {|_key, value| value.empty? }.sort_by {|key, _value| key }.each do |k ,v| + normalized.reject {|_key, value| value.empty? }.sort_by {|key, _value| key }.each do |k, v| h[k] = v end end From a9d47ae5c19c1e89aba2d30046521b0c0a36a33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 28 Apr 2026 16:02:25 -0600 Subject: [PATCH 3/4] fix(deprecation_tracker): use deprecation_messages in compare, not normalized Only validate buckets actively tracked in the current run. Skip merged buckets from storage that aren't tracked now (e.g., tests removed). This avoids expensive file I/O and hash merging in compare mode when only current-run validation is needed. --- CHANGELOG.md | 2 +- lib/deprecation_tracker.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 927c820..96343e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.5.0...main) -- [BUGFIX: DeprecationTracker#compare ignores buckets](https://github.com/fastruby/next_rails/pull/180) +- [BUGFIX: Fix Ruby 2.3 compatibility in DeprecationTracker#normalized_deprecation_messages](https://github.com/fastruby/next_rails/pull/180) - [BUGFIX: example](https://github.com/fastruby/next_rails/pull/) - [BUGFIX: Compare mode now checks only buckets the current process ran, fixing parallel test support](https://github.com/fastruby/next_rails/pull/179) diff --git a/lib/deprecation_tracker.rb b/lib/deprecation_tracker.rb index 154648f..7828dc9 100644 --- a/lib/deprecation_tracker.rb +++ b/lib/deprecation_tracker.rb @@ -184,7 +184,7 @@ def compare changed_buckets = [] - normalized_deprecation_messages.each do |bucket, messages| + deprecation_messages.each do |bucket, messages| if stored[bucket] != messages changed_buckets << bucket end From d959bbc2b7913cac2cd289b0cdf3addb5b0765cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 28 Apr 2026 16:17:35 -0600 Subject: [PATCH 4/4] test: add explicit tests for normalized_deprecation_messages Ensures the method correctly merges, sorts, and deduplicates messages. Tests the block parameter syntax that broke on Ruby 2.3. --- spec/deprecation_tracker_spec.rb | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/spec/deprecation_tracker_spec.rb b/spec/deprecation_tracker_spec.rb index 193afd0..0302117 100644 --- a/spec/deprecation_tracker_spec.rb +++ b/spec/deprecation_tracker_spec.rb @@ -226,6 +226,60 @@ end end + describe "#normalized_deprecation_messages" do + it "merges stored and current messages" do + setup_tracker = DeprecationTracker.new(shitlist_path) + setup_tracker.bucket = "bucket 1" + setup_tracker.add("a") + setup_tracker.save + + subject = DeprecationTracker.new(shitlist_path) + subject.bucket = "bucket 2" + subject.add("b") + + normalized = subject.normalized_deprecation_messages + expect(normalized).to eq( + "bucket 1" => ["a"], + "bucket 2" => ["b"] + ) + end + + it "sorts messages per bucket" do + subject = DeprecationTracker.new(shitlist_path) + subject.bucket = "bucket 1" + subject.add("c") + subject.add("a") + subject.add("b") + + normalized = subject.normalized_deprecation_messages + expect(normalized["bucket 1"]).to eq(["a", "b", "c"]) + end + + it "rejects empty buckets" do + setup_tracker = DeprecationTracker.new(shitlist_path) + setup_tracker.bucket = "bucket 1" + setup_tracker.add("a") + setup_tracker.save + + subject = DeprecationTracker.new(shitlist_path) + # Don't add anything, just read + + normalized = subject.normalized_deprecation_messages + expect(normalized).to eq("bucket 1" => ["a"]) + end + + it "sorts by bucket name" do + subject = DeprecationTracker.new(shitlist_path) + subject.bucket = "z_bucket" + subject.add("a") + subject.bucket = "a_bucket" + subject.add("b") + + normalized = subject.normalized_deprecation_messages + expect(normalized.keys).to eq(["a_bucket", "z_bucket"]) + end + end + describe "#after_run" do let(:shitlist_path) { "some_path" }