You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modernize deprecation-tracking.md for next_rails v1.5.0
Replace the ~25-line manual Ruby merge script (obsolete as of v1.5.0)
with the parallel-CI-native pattern:
- `node_index:` option on `track_rspec` / `track_minitest`. Can be
passed explicitly (`node_index: ENV["CI_NODE_INDEX"]`) or
auto-detected from standard CI env vars (`CIRCLE_NODE_INDEX`,
`BUILDKITE_PARALLEL_JOB`, `SEMAPHORE_JOB_INDEX`, `CI_NODE_INDEX`).
- `deprecations merge --delete-shards` CLI command for the fan-in
step that combines per-node shards into the canonical shitlist.
- `DeprecationTracker.merge_shards(path, delete_shards: true)`
programmatic form for custom CI flows.
- `--next` flag for handling the next-Rails shitlist separately.
The three-phase CI workflow (save per node → merge once → compare per
node) is documented with runnable examples. Platform-specific env var
mapping covers CircleCI, Buildkite, GitLab CI, Semaphore, and generic
CI.
Also adds:
- Minimum `next_rails >= 1.5.0` callout at the top of Step 2, plus
an updated Limitations note.
- "Last-resort fallback" section at the bottom with
`bundle exec rspec 2>&1 | grep 'DEPRECATION WARNING' | sort -u`
for apps where `DeprecationTracker` won't configure (loses
structure, compare mode, and regression gating — use the tracker
when possible).
- `deprecations merge --delete-shards` row in the Quick Reference.
Preserves: Why This Matters, silenced-deprecations detection
(Step 1), custom-deprecation-behavior approach for Minitest/parallel-fork
and older Rails (Step 3, all four Rails version variants retained),
Limitations, Maintenance, Quick Reference.
Implements plan §12.
Deprecation warnings are your roadmap during a Rails upgrade — they tell you exactly what will break in the next version. If deprecations are silenced, you're flying blind. Before setting up dual-boot, you must ensure deprecation warnings are visible and tracked.
9
+
Deprecation warnings are your roadmap during a Rails upgrade. They tell you exactly what will break in the next version. If deprecations are silenced, you're flying blind. Before setting up dual-boot, you must ensure deprecation warnings are visible and tracked.
10
10
11
11
---
12
12
@@ -17,16 +17,16 @@ Check these files for silenced deprecations:
17
17
### Check `config/environments/test.rb`
18
18
19
19
```ruby
20
-
# BAD — deprecations are invisible
20
+
# BAD (deprecations are invisible)
21
21
config.active_support.deprecation =:silence
22
22
23
-
# BAD — all deprecation behaviors disabled (Rails 7.0+)
23
+
# BAD (all deprecation behaviors disabled, Rails 7.0+)
24
24
config.active_support.report_deprecations =false
25
25
```
26
26
27
27
### Check `config/environments/development.rb`
28
28
29
-
Same patterns as above —`:silence` or `report_deprecations = false`.
29
+
Same patterns as above:`:silence` or `report_deprecations = false`.
30
30
31
31
### Check for Global Silencing
32
32
@@ -60,19 +60,21 @@ If any of these are silencing deprecations, fix them before proceeding with the
60
60
61
61
The `next_rails` gem includes `DeprecationTracker` which captures all deprecation warnings during test runs and saves them to a file. This gives you a complete inventory without stopping on the first failure (unlike `:raise`).
62
62
63
+
> **Minimum `next_rails` version: 1.5.0** (released 2026-04-02). The parallel-CI-aware `node_index:` option and the `deprecations merge` CLI require v1.5.0. If your Gemfile currently pins an older version, update it before proceeding.
64
+
63
65
### Setup
64
66
65
-
Ensure `next_rails` is in your Gemfile at the **root level** (not inside a `group` block):
67
+
Ensure `next_rails` is in your Gemfile at the **root level** (not inside a `group` block), with the version constraint:
66
68
67
69
```ruby
68
70
# Gemfile
69
-
# MUST be at root level — not in :development or :test group
70
-
gem 'next_rails'
71
+
# MUST be at root level, not in :development or :test group
72
+
gem 'next_rails', '>= 1.5.0'
71
73
```
72
74
73
75
Then configure your test runner.
74
76
75
-
**RSpec** — in `spec/spec_helper.rb` (or `spec/rails_helper.rb`):
77
+
**RSpec**, in `spec/spec_helper.rb` (or `spec/rails_helper.rb`):
-**`shitlist_path`** — where to save/read the deprecation inventory (required, no default)
99
-
-**`mode`** — defaults to `save` so it always tracks
100
-
-**`transform_message`** — strips the Rails root path from messages so the shitlist is portable across environments
100
+
-**`shitlist_path`**: where to save/read the deprecation inventory (required, no default)
101
+
-**`mode`**: defaults to `save` so it always tracks
102
+
-**`transform_message`**: strips the Rails root path from messages so the shitlist is portable across environments
101
103
102
104
### Save the Deprecation Shitlist
103
105
104
-
Run the test suite with `DEPRECATION_TRACKER=save` to collect all deprecation warnings (substitute your project's test command — e.g. `bundle exec rspec`, `bin/rails test`, `bin/test`):
106
+
Run the test suite with `DEPRECATION_TRACKER=save` to collect all deprecation warnings (substitute your project's test command, e.g. `bundle exec rspec`, `bin/rails test`, `bin/test`):
105
107
106
108
```bash
107
109
DEPRECATION_TRACKER=save bundle exec rspec
108
110
```
109
111
110
-
This generates `spec/support/deprecation_warning.shitlist.json` — a JSON file listing every unique deprecation warning found during the run.
112
+
This generates `spec/support/deprecation_warning.shitlist.json`, a JSON file listing every unique deprecation warning found during the run.
111
113
112
114
> **Note:** Make sure the directory for `shitlist_path` exists before running.
113
115
@@ -117,55 +119,116 @@ Once you have a shitlist, run with `DEPRECATION_TRACKER=save` after fixing depre
1.`DEPRECATION_TRACKER=save bundle exec rspec` generates the initial shitlist
121
123
2. Review the shitlist to understand the scope of deprecations
122
124
3. Fix one category of deprecation (e.g., `update_attributes`)
123
-
4.`DEPRECATION_TRACKER=save bundle exec rspec`— updates the shitlist (it should shrink)
125
+
4.`DEPRECATION_TRACKER=save bundle exec rspec` updates the shitlist (it should shrink)
124
126
5. Repeat until the shitlist is empty
125
127
6. Commit the shitlist file so the team tracks progress together
126
128
127
129
### CI with Parallel Test Execution
128
130
129
-
`DeprecationTracker` does not natively support parallel execution. When CI splits tests across multiple nodes/containers (e.g., CircleCI parallelism, parallel_tests gem), each node only sees its subset of deprecations. You need to collect and merge the results.
131
+
Starting with `next_rails` v1.5.0, `DeprecationTracker` has native support for parallel CI. When CI splits tests across multiple nodes or containers (CircleCI parallelism, Buildkite, GitLab, Semaphore, GitHub Actions matrix), each node writes its own shard file. A one-off merge step fans the shards back into the canonical shitlist.
130
132
131
-
**Strategy: Save per-node, merge after**
133
+
#### Configure `node_index:`
132
134
133
-
1. On each CI node, run with `DEPRECATION_TRACKER=save` as normal
134
-
2. Each node produces its own `spec/support/deprecation_warning.shitlist.json`
135
-
3. After all nodes finish, collect and merge the shitlist files:
135
+
Pass a `node_index:` value to `track_rspec` or `track_minitest`. When set, the tracker writes to `<shitlist_path>.node-<index>.json` instead of the canonical file, so parallel nodes don't clobber each other.
136
136
137
-
```bash
138
-
# Example merge script (run after all parallel nodes complete)
139
-
# Collects shitlist JSON files from each node and merges them
137
+
You can pass `node_index:` explicitly, or omit it and rely on auto-detection from standard CI environment variables:
The exact collection mechanism depends on your CI setup:
158
-
-**CircleCI**: Use `persist_to_workspace` / `attach_workspace` to gather shitlists from parallel containers
159
-
-**GitHub Actions**: Use `upload-artifact` / `download-artifact` across matrix jobs
160
-
-**parallel_tests gem**: Each process writes to the same filesystem, so you can glob the results directly
184
+
Each node produces a file like `spec/support/deprecation_warning.shitlist.node-0.json`, `...node-1.json`, etc.
185
+
186
+
**Merge phase** (runs once after all nodes finish, with shards gathered into one workspace):
187
+
188
+
```bash
189
+
deprecations merge --delete-shards
190
+
```
161
191
162
-
> **Tip:** Run the initial `DEPRECATION_TRACKER=save` locally (non-parallel) to generate the first complete shitlist. Use the parallel merge strategy in CI for ongoing regression checks.
192
+
This fans all shards into the canonical `spec/support/deprecation_warning.shitlist.json` and removes the per-node files. To merge the next-Rails shitlist (the shards produced when running under the next Rails version in dual-boot), pass `--next`:
193
+
194
+
```bash
195
+
deprecations merge --next --delete-shards
196
+
```
197
+
198
+
For custom flows, call the programmatic form directly:
199
+
200
+
```ruby
201
+
DeprecationTracker.merge_shards(
202
+
"spec/support/deprecation_warning.shitlist.json",
203
+
delete_shards:true
204
+
)
205
+
```
206
+
207
+
**Compare phase** (each parallel node compares its subset against the merged canonical file):
The shard/canonical split means compare mode works per-node without false positives: each node only checks deprecations it actually emits, and the canonical shitlist already contains every deprecation from every node.
214
+
215
+
#### Gathering shards between phases
216
+
217
+
The exact mechanism to move shards from save-phase nodes into the merge job depends on your CI:
218
+
219
+
-**CircleCI**: use `persist_to_workspace` in each parallel container, `attach_workspace` in the merge job
220
+
-**GitHub Actions**: use `upload-artifact` from each matrix job, `download-artifact` in the merge job
221
+
-**Buildkite**: use pipeline artifacts (`buildkite-agent artifact upload` / `download`)
222
+
-**GitLab CI**: use job artifacts with `dependencies:` in the merge job
223
+
-**parallel_tests gem (single host)**: each process writes to the same filesystem, so the merge step can run immediately without any artifact shuffle
224
+
225
+
> **Tip:** Run the initial `DEPRECATION_TRACKER=save` locally without `node_index:` to generate the first complete canonical shitlist. Use the parallel sharded workflow in CI for ongoing regression checks.
163
226
164
227
### Limitations
165
228
166
-
-**Not compatible with `minitest/parallel_fork`**— use standard minitest or RSpec
167
-
-**No native parallel support**— requires manual merge when using CI parallelism (see above)
168
-
-**Supports RSpec (`track_rspec`) and Minitest (`track_minitest`)**— other frameworks require manual integration
229
+
-**Not compatible with `minitest/parallel_fork`.**Use standard Minitest, RSpec, or the custom deprecation behavior approach below.
230
+
-**Requires `next_rails` >= 1.5.0**for native parallel CI support. Older versions need a manual merge script.
231
+
-**Supports RSpec (`track_rspec`) and Minitest (`track_minitest`).**Other frameworks require manual integration.
0 commit comments