activesupport 7.1.5.1 → 7.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +213 -1082
  3. data/README.rdoc +1 -1
  4. data/lib/active_support/array_inquirer.rb +1 -1
  5. data/lib/active_support/backtrace_cleaner.rb +10 -3
  6. data/lib/active_support/broadcast_logger.rb +65 -78
  7. data/lib/active_support/cache/file_store.rb +17 -12
  8. data/lib/active_support/cache/mem_cache_store.rb +29 -89
  9. data/lib/active_support/cache/memory_store.rb +7 -6
  10. data/lib/active_support/cache/null_store.rb +2 -2
  11. data/lib/active_support/cache/redis_cache_store.rb +17 -14
  12. data/lib/active_support/cache/serializer_with_fallback.rb +0 -23
  13. data/lib/active_support/cache/strategy/local_cache.rb +56 -20
  14. data/lib/active_support/cache.rb +63 -71
  15. data/lib/active_support/callbacks.rb +77 -115
  16. data/lib/active_support/core_ext/array/conversions.rb +0 -2
  17. data/lib/active_support/core_ext/benchmark.rb +1 -0
  18. data/lib/active_support/core_ext/class/attribute.rb +2 -2
  19. data/lib/active_support/core_ext/class/subclasses.rb +15 -35
  20. data/lib/active_support/core_ext/date/blank.rb +4 -0
  21. data/lib/active_support/core_ext/date/conversions.rb +0 -2
  22. data/lib/active_support/core_ext/date_and_time/compatibility.rb +28 -1
  23. data/lib/active_support/core_ext/date_time/blank.rb +4 -0
  24. data/lib/active_support/core_ext/date_time/conversions.rb +4 -6
  25. data/lib/active_support/core_ext/digest/uuid.rb +6 -0
  26. data/lib/active_support/core_ext/enumerable.rb +17 -5
  27. data/lib/active_support/core_ext/erb/util.rb +7 -2
  28. data/lib/active_support/core_ext/hash/keys.rb +4 -4
  29. data/lib/active_support/core_ext/module/attr_internal.rb +17 -6
  30. data/lib/active_support/core_ext/module/delegation.rb +20 -163
  31. data/lib/active_support/core_ext/module/deprecation.rb +1 -4
  32. data/lib/active_support/core_ext/module/introspection.rb +3 -0
  33. data/lib/active_support/core_ext/numeric/conversions.rb +3 -3
  34. data/lib/active_support/core_ext/object/blank.rb +45 -1
  35. data/lib/active_support/core_ext/object/instance_variables.rb +11 -19
  36. data/lib/active_support/core_ext/object/json.rb +1 -1
  37. data/lib/active_support/core_ext/object/try.rb +2 -2
  38. data/lib/active_support/core_ext/object/with.rb +5 -3
  39. data/lib/active_support/core_ext/pathname/blank.rb +4 -0
  40. data/lib/active_support/core_ext/range/overlap.rb +1 -1
  41. data/lib/active_support/core_ext/range/sole.rb +17 -0
  42. data/lib/active_support/core_ext/range.rb +1 -0
  43. data/lib/active_support/core_ext/securerandom.rb +4 -4
  44. data/lib/active_support/core_ext/string/conversions.rb +1 -1
  45. data/lib/active_support/core_ext/string/filters.rb +4 -4
  46. data/lib/active_support/core_ext/string/multibyte.rb +3 -3
  47. data/lib/active_support/core_ext/string/output_safety.rb +0 -7
  48. data/lib/active_support/core_ext/time/calculations.rb +18 -28
  49. data/lib/active_support/core_ext/time/compatibility.rb +24 -0
  50. data/lib/active_support/core_ext/time/conversions.rb +0 -2
  51. data/lib/active_support/core_ext/time/zones.rb +1 -1
  52. data/lib/active_support/core_ext.rb +0 -1
  53. data/lib/active_support/current_attributes.rb +45 -40
  54. data/lib/active_support/delegation.rb +202 -0
  55. data/lib/active_support/dependencies/autoload.rb +0 -12
  56. data/lib/active_support/deprecation/constant_accessor.rb +47 -26
  57. data/lib/active_support/deprecation/proxy_wrappers.rb +9 -12
  58. data/lib/active_support/deprecation/reporting.rb +7 -2
  59. data/lib/active_support/deprecation.rb +8 -5
  60. data/lib/active_support/descendants_tracker.rb +9 -87
  61. data/lib/active_support/duration/iso8601_parser.rb +2 -2
  62. data/lib/active_support/duration/iso8601_serializer.rb +1 -2
  63. data/lib/active_support/duration.rb +11 -6
  64. data/lib/active_support/encrypted_file.rb +1 -1
  65. data/lib/active_support/error_reporter.rb +46 -5
  66. data/lib/active_support/evented_file_update_checker.rb +0 -1
  67. data/lib/active_support/execution_wrapper.rb +1 -2
  68. data/lib/active_support/file_update_checker.rb +2 -2
  69. data/lib/active_support/fork_tracker.rb +2 -38
  70. data/lib/active_support/gem_version.rb +3 -3
  71. data/lib/active_support/hash_with_indifferent_access.rb +26 -24
  72. data/lib/active_support/html_safe_translation.rb +3 -0
  73. data/lib/active_support/json/decoding.rb +1 -1
  74. data/lib/active_support/json/encoding.rb +23 -5
  75. data/lib/active_support/lazy_load_hooks.rb +1 -1
  76. data/lib/active_support/log_subscriber.rb +0 -12
  77. data/lib/active_support/logger.rb +15 -2
  78. data/lib/active_support/logger_thread_safe_level.rb +0 -8
  79. data/lib/active_support/message_encryptors.rb +2 -2
  80. data/lib/active_support/message_pack/extensions.rb +15 -2
  81. data/lib/active_support/message_verifier.rb +21 -0
  82. data/lib/active_support/message_verifiers.rb +5 -3
  83. data/lib/active_support/messages/rotator.rb +5 -0
  84. data/lib/active_support/multibyte/chars.rb +6 -3
  85. data/lib/active_support/notifications/fanout.rb +4 -7
  86. data/lib/active_support/notifications/instrumenter.rb +21 -18
  87. data/lib/active_support/notifications.rb +28 -27
  88. data/lib/active_support/number_helper/number_converter.rb +2 -2
  89. data/lib/active_support/option_merger.rb +2 -2
  90. data/lib/active_support/ordered_options.rb +53 -15
  91. data/lib/active_support/proxy_object.rb +8 -5
  92. data/lib/active_support/railtie.rb +4 -11
  93. data/lib/active_support/string_inquirer.rb +1 -1
  94. data/lib/active_support/subscriber.rb +1 -0
  95. data/lib/active_support/tagged_logging.rb +0 -1
  96. data/lib/active_support/test_case.rb +3 -1
  97. data/lib/active_support/testing/assertions.rb +4 -4
  98. data/lib/active_support/testing/constant_stubbing.rb +30 -8
  99. data/lib/active_support/testing/deprecation.rb +5 -12
  100. data/lib/active_support/testing/isolation.rb +20 -8
  101. data/lib/active_support/testing/method_call_assertions.rb +2 -16
  102. data/lib/active_support/testing/parallelization/server.rb +18 -2
  103. data/lib/active_support/testing/parallelization/worker.rb +2 -2
  104. data/lib/active_support/testing/parallelization.rb +12 -1
  105. data/lib/active_support/testing/tests_without_assertions.rb +19 -0
  106. data/lib/active_support/testing/time_helpers.rb +3 -3
  107. data/lib/active_support/time_with_zone.rb +8 -4
  108. data/lib/active_support/values/time_zone.rb +7 -7
  109. data/lib/active_support/xml_mini.rb +13 -2
  110. data/lib/active_support.rb +2 -1
  111. metadata +18 -29
  112. data/lib/active_support/deprecation/instance_delegator.rb +0 -65
  113. data/lib/active_support/ruby_features.rb +0 -7
  114. data/lib/active_support/testing/strict_warnings.rb +0 -39
data/CHANGELOG.md CHANGED
@@ -1,1301 +1,432 @@
1
- ## Rails 7.1.5.1 (December 10, 2024) ##
2
-
3
- * No changes.
4
-
5
-
6
- ## Rails 7.1.5 (October 30, 2024) ##
7
-
8
- * No changes.
1
+ ## Rails 7.2.3 (October 28, 2025) ##
9
2
 
3
+ * Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple.
10
4
 
11
- ## Rails 7.1.4.2 (October 23, 2024) ##
12
-
13
- * No changes.
5
+ *Olivier Bellone*
14
6
 
7
+ * Fix parallel tests hanging when worker processes die abruptly.
15
8
 
16
- ## Rails 7.1.4.1 (October 15, 2024) ##
9
+ Previously, if a worker process was killed (e.g., OOM killed, `kill -9`) during parallel
10
+ test execution, the test suite would hang forever waiting for the dead worker.
17
11
 
18
- * No changes.
19
-
20
-
21
- ## Rails 7.1.4 (August 22, 2024) ##
22
-
23
- * Improve compatibility for `ActiveSupport::BroadcastLogger`.
24
-
25
- *Máximo Mussini*
12
+ *Joshua Young*
26
13
 
27
- * Pass options along to write_entry in handle_expired_entry method.
14
+ * `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unnecessary reloads with time travel test helpers
28
15
 
29
- *Graham Cooper*
16
+ *Jan Grodowski*
30
17
 
31
- * Fix Active Support configurations deprecations.
18
+ * Fix `ActiveSupport::BroadcastLogger` from executing a block argument for each logger (tagged, info, etc.).
32
19
 
33
- *fatkodima*
20
+ *Jared Armstrong*
34
21
 
35
- * Fix teardown callbacks.
22
+ * Fix `ActiveSupport::HashWithIndifferentAccess#transform_keys!` removing defaults.
36
23
 
37
- *Tristan Starck*
24
+ *Hartley McGuire*
38
25
 
39
- * `BacktraceCleaner` silence core internal methods by default.
26
+ * Fix `ActiveSupport::HashWithIndifferentAccess#tranform_keys!` to handle collisions.
40
27
 
41
- *Jean Boussier*
28
+ If the transformation would result in a key equal to another not yet transformed one,
29
+ it would result in keys being lost.
42
30
 
43
- * Fix `delegate_missing_to allow_nil: true` when called with implict self
31
+ Before:
44
32
 
45
33
  ```ruby
46
- class Person
47
- delegate_missing_to :address, allow_nil: true
48
-
49
- def address
50
- nil
51
- end
52
-
53
- def berliner?
54
- city == "Berlin"
55
- end
56
- end
57
-
58
- Person.new.city # => nil
59
- Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
34
+ >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
35
+ => {"c" => 1}
60
36
  ```
61
37
 
62
- *Jean Boussier*
63
-
64
- * Work around a Ruby bug that can cause a VM crash.
65
-
66
- This would happen if using `TaggerLogger` with a Proc
67
- formatter on which you called `object_id`.
38
+ After:
68
39
 
40
+ ```ruby
41
+ >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
42
+ => {"c" => 1, "d" => 2}
69
43
  ```
70
- [BUG] Object ID seen, but not in mapping table: proc
71
- ```
72
-
73
- *Jean Boussier*
74
-
75
- * Fix `ActiveSupport::Notifications.publish_event` to preserve units.
76
-
77
- This solves the incorrect reporting of time spent running Active Record
78
- asynchronous queries (by a factor `1000`).
79
-
80
- *Jean Boussier*
81
-
82
-
83
- ## Rails 7.1.3.4 (June 04, 2024) ##
84
-
85
- * No changes.
86
-
87
-
88
- ## Rails 7.1.3.3 (May 16, 2024) ##
89
-
90
- * No changes.
91
-
92
-
93
- ## Rails 7.1.3.2 (February 21, 2024) ##
94
-
95
- * No changes.
96
-
97
-
98
- ## Rails 7.1.3.1 (February 21, 2024) ##
99
44
 
100
- * No changes.
101
-
102
-
103
- ## Rails 7.1.3 (January 16, 2024) ##
104
-
105
- * Handle nil `backtrace_locations` in `ActiveSupport::SyntaxErrorProxy`.
106
-
107
- *Eugene Kenny*
108
-
109
- * Fix `ActiveSupport::JSON.encode` to prevent duplicate keys.
110
-
111
- If the same key exist in both String and Symbol form it could
112
- lead to the same key being emitted twice.
113
-
114
- *Manish Sharma*
115
-
116
- * Fix `ActiveSupport::Cache::Store#read_multi` when using a cache namespace
117
- and local cache strategy.
118
-
119
- *Mark Oleson*
120
-
121
- * Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
122
-
123
- There is a bug in the current implementation of #travel_to:
124
- it remembers a timezone of its argument, and all stubbed methods start
125
- returning results in that remembered timezone. However, the expected
126
- behaviour is to return results in a system timezone.
127
-
128
- *Aleksei Chernenkov*
129
-
130
- * Fix `:unless_exist` option for `MemoryStore#write` (et al) when using a
131
- cache namespace.
45
+ *Jason T Johnson*, *Jean Boussier*
132
46
 
133
- *S. Brent Faulkner*
47
+ * Fix `ActiveSupport::Cache::MemCacheStore#read_multi` to handle network errors.
134
48
 
135
- * Fix ActiveSupport::Deprecation to handle blaming generated code.
49
+ This method specifically wasn't handling network errors like other codepaths.
136
50
 
137
- *Jean Boussier*, *fatkodima*
51
+ *Alessandro Dal Grande*
138
52
 
53
+ * Fix Active Support Cache `fetch_multi` when local store is active.
139
54
 
140
- ## Rails 7.1.2 (November 10, 2023) ##
141
-
142
- * Fix `:expires_in` option for `RedisCacheStore#write_multi`.
143
-
144
- *fatkodima*
145
-
146
- * Fix deserialization of non-string "purpose" field in Message serializer
147
-
148
- *Jacopo Beschi*
149
-
150
- * Prevent global cache options being overwritten when setting dynamic options
151
- inside a `ActiveSupport::Cache::Store#fetch` block.
152
-
153
- *Yasha Krasnou*
154
-
155
- * Fix missing `require` resulting in `NoMethodError` when running
156
- `bin/rails secrets:show` or `bin/rails secrets:edit`.
157
-
158
- *Stephen Ierodiaconou*
159
-
160
- * Ensure `{down,up}case_first` returns non-frozen string.
161
-
162
- *Jonathan Hefner*
163
-
164
- * Fix `#to_fs(:human_size)` to correctly work with negative numbers.
165
-
166
- *Earlopain*
167
-
168
- * Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
169
-
170
- *Andrew Novoselac*
171
-
172
- * Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
173
-
174
- *Andrew Novoselac*
175
-
176
- * Fix `ActiveSupport::Cache` to handle outdated Marshal payload from Rails 6.1 format.
177
-
178
- Active Support's Cache is supposed to treat a Marshal payload that can no longer be
179
- deserialized as a cache miss. It fail to do so for compressed payload in the Rails 6.1
180
- legacy format.
55
+ `fetch_multi` now properly yield to the provided block for missing entries
56
+ that have been recorded as such in the local store.
181
57
 
182
58
  *Jean Boussier*
183
59
 
184
- * Fix `OrderedOptions#dig` for array indexes.
60
+ * Fix execution wrapping to report all exceptions, including `Exception`.
185
61
 
186
- *fatkodima*
187
-
188
- * Fix time travel helpers to work when nested using with separate classes.
189
-
190
- *fatkodima*
191
-
192
- * Fix `delete_matched` for file cache store to work with keys longer than the
193
- max filename size.
194
-
195
- *fatkodima* and *Jonathan Hefner*
196
-
197
- * Fix compatibility with the `semantic_logger` gem.
198
-
199
- The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
200
- `SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
201
-
202
- This caused the various `LogSubscriber` classes in Rails to break when assigned a
203
- `SemanticLogger` instance.
62
+ If a more serious error like `SystemStackError` or `NoMemoryError` happens,
63
+ the error reporter should be able to report these kinds of exceptions.
204
64
 
205
- *Jean Boussier*, *ojab*
206
-
207
- ## Rails 7.1.1 (October 11, 2023) ##
208
-
209
- * Add support for keyword arguments when delegating calls to custom loggers from `ActiveSupport::BroadcastLogger`.
210
-
211
- *Edouard Chin*
212
-
213
- * `NumberHelper`: handle objects responding `to_d`.
214
-
215
- *fatkodima*
216
-
217
- * Fix RedisCacheStore to properly set the TTL when incrementing or decrementing.
218
-
219
- This bug was only impacting Redis server older than 7.0.
220
-
221
- *Thomas Countz*
222
-
223
- * Fix MemoryStore to prevent race conditions when incrementing or decrementing.
224
-
225
- *Pierre Jambet*
226
-
227
-
228
- ## Rails 7.1.0 (October 05, 2023) ##
229
-
230
- * No changes.
231
-
232
-
233
- ## Rails 7.1.0.rc2 (October 01, 2023) ##
234
-
235
- * Fix `AS::MessagePack` with `ENV["RAILS_MAX_THREADS"]`.
236
-
237
- *Jonathan Hefner*
238
-
239
-
240
- ## Rails 7.1.0.rc1 (September 27, 2023) ##
241
-
242
- * Add a new public API for broadcasting logs
243
-
244
- This feature existed for a while but was until now a private API.
245
- Broadcasting log allows to send log message to difference sinks (STDOUT, a file ...) and
246
- is used by default in the development environment to write logs both on STDOUT and in the
247
- "development.log" file.
65
+ *Gannon McGibbon*
248
66
 
249
- Basic usage:
67
+ * Fix `RedisCacheStore` and `MemCacheStore` to also handle connection pool related errors.
250
68
 
251
- ```ruby
252
- stdout_logger = Logger.new(STDOUT)
253
- file_logger = Logger.new("development.log")
254
- broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger, file_logger)
69
+ These errors are rescued and reported to `Rails.error`.
255
70
 
256
- broadcast.info("Hello!") # The "Hello!" message is written on STDOUT and in the log file.
257
- ```
71
+ *Jean Boussier*
258
72
 
259
- Adding other sink(s) to the broadcast:
73
+ * Fix `ActiveSupport::Cache#read_multi` to respect version expiry when using local cache.
260
74
 
261
- ```ruby
262
- broadcast = ActiveSupport::BroadcastLogger.new
263
- broadcast.broadcast_to(Logger.new(STDERR))
264
- ```
75
+ *zzak*
265
76
 
266
- Remove a sink from the broadcast:
77
+ * Fix `ActiveSupport::MessageVerifier` and `ActiveSupport::MessageEncryptor` configuration of `on_rotation` callback.
267
78
 
268
79
  ```ruby
269
- stdout_logger = Logger.new(STDOUT)
270
- broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger)
271
-
272
- broadcast.stop_broadcasting_to(stdout_logger)
80
+ verifier.rotate(old_secret).on_rotation { ... }
273
81
  ```
274
82
 
275
- *Edouard Chin*
276
-
277
- * Fix Range#overlap? not taking empty ranges into account on Ruby < 3.3
278
-
279
- *Nobuyoshi Nakada*, *Shouichi Kamiya*, *Hartley McGuire*
280
-
281
- * Use Ruby 3.3 Range#overlap? if available
282
-
283
- *Yasuo Honda*
284
-
285
-
286
- ## Rails 7.1.0.beta1 (September 13, 2023) ##
287
-
288
- * Add `bigdecimal` as Active Support dependency that is a bundled gem candidate for Ruby 3.4.
289
-
290
- `bigdecimal` 3.1.4 or higher version will be installed.
291
- Ruby 2.7 and 3.0 users who want `bigdecimal` version 2.0.0 or 3.0.0 behavior as a default gem,
292
- pin the `bigdecimal` version in your application Gemfile.
293
-
294
- *Koichi ITO*
295
-
296
- * Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
297
-
298
- *Yasuo Honda*
299
-
300
- * When using cache format version >= 7.1 or a custom serializer, expired and
301
- version-mismatched cache entries can now be detected without deserializing
302
- their values.
303
-
304
- *Jonathan Hefner*
305
-
306
- * Make all cache stores return a boolean for `#delete`
307
-
308
- Previously the `RedisCacheStore#delete` would return `1` if the entry
309
- exists and `0` otherwise. Now it returns true if the entry exists and false
310
- otherwise, just like the other stores.
311
-
312
- The `FileStore` would return `nil` if the entry doesn't exists and returns
313
- `false` now as well.
314
-
315
- *Petrik de Heus*
316
-
317
- * Active Support cache stores now support replacing the default compressor via
318
- a `:compressor` option. The specified compressor must respond to `deflate`
319
- and `inflate`. For example:
320
-
321
- ```ruby
322
- module MyCompressor
323
- def self.deflate(string)
324
- # compression logic...
325
- end
326
-
327
- def self.inflate(compressed)
328
- # decompression logic...
329
- end
330
- end
331
-
332
- config.cache_store = :redis_cache_store, { compressor: MyCompressor }
333
- ```
334
-
335
- *Jonathan Hefner*
83
+ Now both work as documented.
336
84
 
337
- * Active Support cache stores now support a `:serializer` option. Similar to
338
- the `:coder` option, serializers must respond to `dump` and `load`. However,
339
- serializers are only responsible for serializing a cached value, whereas
340
- coders are responsible for serializing the entire `ActiveSupport::Cache::Entry`
341
- instance. Additionally, the output from serializers can be automatically
342
- compressed, whereas coders are responsible for their own compression.
343
-
344
- Specifying a serializer instead of a coder also enables performance
345
- optimizations, including the bare string optimization introduced by cache
346
- format version 7.1.
347
-
348
- The `:serializer` and `:coder` options are mutually exclusive. Specifying
349
- both will raise an `ArgumentError`.
350
-
351
- *Jonathan Hefner*
85
+ *Jean Boussier*
352
86
 
353
- * Fix `ActiveSupport::Inflector.humanize(nil)` raising ``NoMethodError: undefined method `end_with?' for nil:NilClass``.
87
+ * Fix `ActiveSupport::MessageVerifier` to always be able to verify both URL-safe and URL-unsafe payloads.
354
88
 
355
- *James Robinson*
89
+ This is to allow transitioning seemlessly from either configuration without immediately invalidating
90
+ all previously generated signed messages.
356
91
 
357
- * Don't show secrets for `ActiveSupport::KeyGenerator#inspect`.
92
+ *Jean Boussier*, *Florent Beaurain*, *Ali Sepehri*
358
93
 
359
- Before:
94
+ * Fix `cache.fetch` to honor the provided expiry when `:race_condition_ttl` is used.
360
95
 
361
96
  ```ruby
362
- ActiveSupport::KeyGenerator.new(secret).inspect
363
- "#<ActiveSupport::KeyGenerator:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
364
- ```
365
-
366
- After:
367
-
368
- ```ruby
369
- ActiveSupport::KeyGenerator::Aes256Gcm(secret).inspect
370
- "#<ActiveSupport::KeyGenerator:0x0000000104888038>"
97
+ cache.fetch("key", expires_in: 1.hour, race_condition_ttl: 5.second) do
98
+ "something"
99
+ end
371
100
  ```
372
101
 
373
- *Petrik de Heus*
374
-
375
- * Improve error message when EventedFileUpdateChecker is used without a
376
- compatible version of the Listen gem
377
-
378
- *Hartley McGuire*
102
+ In the above example, the final cache entry would have a 10 seconds TTL instead
103
+ of the requested 1 hour.
379
104
 
380
- * Add `:report` behavior for Deprecation
105
+ *Dhia*
381
106
 
382
- Setting `config.active_support.deprecation = :report` uses the error
383
- reporter to report deprecation warnings to `ActiveSupport::ErrorReporter`.
107
+ * Better handle procs with splat arguments in `set_callback`.
384
108
 
385
- Deprecations are reported as handled errors, with a severity of `:warning`.
109
+ *Radamés Roriz*
386
110
 
387
- Useful to report deprecations happening in production to your bug tracker.
111
+ * Fix `String#mb_chars` to not mutate the receiver.
388
112
 
389
- *Étienne Barrié*
113
+ Previously it would call `force_encoding` on the receiver,
114
+ now it dups the receiver first.
390
115
 
391
- * Rename `Range#overlaps?` to `#overlap?` and add alias for backwards compatibility
392
-
393
- *Christian Schmidt*
394
-
395
- * Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
396
- methods
397
-
398
- *Hartley McGuire*
399
-
400
- * Don't show secrets for `MessageEncryptor#inspect`.
401
-
402
- Before:
403
-
404
- ```ruby
405
- ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
406
- "#<ActiveSupport::MessageEncryptor:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
407
- ```
116
+ *Jean Boussier*
408
117
 
409
- After:
118
+ * Improve `ErrorSubscriber` to also mark error causes as reported.
410
119
 
411
- ```ruby
412
- ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
413
- "#<ActiveSupport::MessageEncryptor:0x0000000104888038>"
414
- ```
120
+ This avoid some cases of errors being reported twice, notably in views because of how
121
+ errors are wrapped in `ActionView::Template::Error`.
415
122
 
416
- *Petrik de Heus*
123
+ *Jean Boussier*
417
124
 
418
- * Don't show contents for `EncryptedConfiguration#inspect`.
125
+ * Fix `Module#module_parent_name` to return the correct name after the module has been named.
419
126
 
420
- Before:
421
- ```ruby
422
- Rails.application.credentials.inspect
423
- "#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8 ... @config={:secret=>\"something secret\"} ... @key_file_contents=\"915e4ea054e011022398dc242\" ...>"
424
- ```
127
+ When called on an anonymous module, the return value wouldn't change after the module was given a name
128
+ later by being assigned to a constant.
425
129
 
426
- After:
427
130
  ```ruby
428
- Rails.application.credentials.inspect
429
- "#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8>"
131
+ mod = Module.new
132
+ mod.module_parent_name # => "Object"
133
+ MyModule::Something = mod
134
+ mod.module_parent_name # => "MyModule"
430
135
  ```
431
136
 
432
- *Petrik de Heus*
433
-
434
- * `ERB::Util.html_escape_once` always returns an `html_safe` string.
435
-
436
- This method previously maintained the `html_safe?` property of a string on the return
437
- value. Because this string has been escaped, however, not marking it as `html_safe` causes
438
- entities to be double-escaped.
439
-
440
- As an example, take this view snippet:
441
-
442
- ```html
443
- <p><%= html_escape_once("this & that &amp; the other") %></p>
444
- ```
445
-
446
- Before this change, that would be double-escaped and render as:
137
+ *Jean Boussier*
447
138
 
448
- ```html
449
- <p>this &amp;amp; that &amp;amp; the other</p>
450
- ```
139
+ * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
451
140
 
452
- After this change, it renders correctly as:
141
+ *Martin Emde*
453
142
 
454
- ```html
455
- <p>this &amp; that &amp; the other</p>
456
- ```
457
143
 
458
- Fixes #48256
144
+ ## Rails 7.2.2.2 (August 13, 2025) ##
459
145
 
460
- *Mike Dalessio*
146
+ * No changes.
461
147
 
462
- * Deprecate `SafeBuffer#clone_empty`.
463
148
 
464
- This method has not been used internally since Rails 4.2.0.
149
+ ## Rails 7.2.2.1 (December 10, 2024) ##
465
150
 
466
- *Mike Dalessio*
151
+ * No changes.
467
152
 
468
- * `MessageEncryptor`, `MessageVerifier`, and `config.active_support.message_serializer`
469
- now accept `:message_pack` and `:message_pack_allow_marshal` as serializers.
470
- These serializers require the [`msgpack` gem](https://rubygems.org/gems/msgpack)
471
- (>= 1.7.0).
472
153
 
473
- The Message Pack format can provide improved performance and smaller payload
474
- sizes. It also supports round-tripping some Ruby types that are not supported
475
- by JSON. For example:
154
+ ## Rails 7.2.2 (October 30, 2024) ##
476
155
 
477
- ```ruby
478
- verifier = ActiveSupport::MessageVerifier.new("secret")
479
- data = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)]
480
- message = verifier.generate(data)
156
+ * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
481
157
 
482
- # BEFORE with config.active_support.message_serializer = :json
483
- verifier.verified(message)
484
- # => [{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"]
485
- verifier.verified(message).map(&:class)
486
- # => [Hash, Hash, String, String]
158
+ *Adam Renberg Tamm*
487
159
 
488
- # AFTER with config.active_support.message_serializer = :message_pack
489
- verifier.verified(message)
490
- # => [{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600]
491
- verifier.verified(message).map(&:class)
492
- # => [Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time]
493
- ```
160
+ * Print test names when running `rails test -v` for parallel tests.
494
161
 
495
- The `:message_pack` serializer can fall back to deserializing with
496
- `ActiveSupport::JSON` when necessary, and the `:message_pack_allow_marshal`
497
- serializer can fall back to deserializing with `Marshal` as well as
498
- `ActiveSupport::JSON`. Additionally, the `:marshal`, `:json`, and
499
- `:json_allow_marshal` serializers can now fall back to deserializing with
500
- `ActiveSupport::MessagePack` when necessary. These behaviors ensure old
501
- messages can still be read so that migration is easier.
162
+ *John Hawthorn*, *Abeid Ahmed*
502
163
 
503
- *Jonathan Hefner*
504
164
 
505
- * A new `7.1` cache format is available which includes an optimization for
506
- bare string values such as view fragments.
165
+ ## Rails 7.2.1.2 (October 23, 2024) ##
507
166
 
508
- The `7.1` cache format is used by default for new apps, and existing apps
509
- can enable the format by setting `config.load_defaults 7.1` or by setting
510
- `config.active_support.cache_format_version = 7.1` in `config/application.rb`
511
- or a `config/environments/*.rb` file.
167
+ * No changes.
512
168
 
513
- Cache entries written using the `6.1` or `7.0` cache formats can be read
514
- when using the `7.1` format. To perform a rolling deploy of a Rails 7.1
515
- upgrade, wherein servers that have not yet been upgraded must be able to
516
- read caches from upgraded servers, leave the cache format unchanged on the
517
- first deploy, then enable the `7.1` cache format on a subsequent deploy.
518
169
 
519
- *Jonathan Hefner*
170
+ ## Rails 7.2.1.1 (October 15, 2024) ##
520
171
 
521
- * Active Support cache stores can now use a preconfigured serializer based on
522
- `ActiveSupport::MessagePack` via the `:serializer` option:
172
+ * No changes.
523
173
 
524
- ```ruby
525
- config.cache_store = :redis_cache_store, { serializer: :message_pack }
526
- ```
527
174
 
528
- The `:message_pack` serializer can reduce cache entry sizes and improve
529
- performance, but requires the [`msgpack` gem](https://rubygems.org/gems/msgpack)
530
- (>= 1.7.0).
175
+ ## Rails 7.2.1 (August 22, 2024) ##
531
176
 
532
- The `:message_pack` serializer can read cache entries written by the default
533
- serializer, and the default serializer can now read entries written by the
534
- `:message_pack` serializer. These behaviors make it easy to migrate between
535
- serializer without invalidating the entire cache.
177
+ * No changes.
536
178
 
537
- *Jonathan Hefner*
538
179
 
539
- * `Object#deep_dup` no longer duplicate named classes and modules.
180
+ ## Rails 7.2.0 (August 09, 2024) ##
540
181
 
541
- Before:
182
+ * Fix `delegate_missing_to allow_nil: true` when called with implict self
542
183
 
543
184
  ```ruby
544
- hash = { class: Object, module: Kernel }
545
- hash.deep_dup # => {:class=>#<Class:0x00000001063ffc80>, :module=>#<Module:0x00000001063ffa00>}
546
- ```
185
+ class Person
186
+ delegate_missing_to :address, allow_nil: true
547
187
 
548
- After:
188
+ def address
189
+ nil
190
+ end
549
191
 
550
- ```ruby
551
- hash = { class: Object, module: Kernel }
552
- hash.deep_dup # => {:class=>Object, :module=>Kernel}
192
+ def berliner?
193
+ city == "Berlin"
194
+ end
195
+ end
196
+
197
+ Person.new.city # => nil
198
+ Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
553
199
  ```
554
200
 
555
201
  *Jean Boussier*
556
202
 
557
- * Consistently raise an `ArgumentError` if the `ActiveSupport::Cache` key is blank.
203
+ * Add `logger` as a dependency since it is a bundled gem candidate for Ruby 3.5
558
204
 
559
- *Joshua Young*
560
-
561
- * Deprecate usage of the singleton `ActiveSupport::Deprecation`.
562
-
563
- All usage of `ActiveSupport::Deprecation` as a singleton is deprecated, the most common one being
564
- `ActiveSupport::Deprecation.warn`. Gem authors should now create their own deprecator (`ActiveSupport::Deprecation`
565
- object), and use it to emit deprecation warnings.
205
+ *Earlopain*
566
206
 
567
- Calling any of the following without specifying a deprecator argument is also deprecated:
568
- * Module.deprecate
569
- * deprecate_constant
570
- * DeprecatedObjectProxy
571
- * DeprecatedInstanceVariableProxy
572
- * DeprecatedConstantProxy
573
- * deprecation-related test assertions
207
+ * Define `Digest::UUID.nil_uuid`, which returns the so-called nil UUID.
574
208
 
575
- Use of `ActiveSupport::Deprecation.silence` and configuration methods like `behavior=`, `disallowed_behavior=`,
576
- `disallowed_warnings=` should now be aimed at the [application's deprecators](https://api.rubyonrails.org/classes/Rails/Application.html#method-i-deprecators).
209
+ *Xavier Noria*
577
210
 
578
- ```ruby
579
- Rails.application.deprecators.silence do
580
- # code that emits deprecation warnings
581
- end
582
- ```
211
+ * Support `duration` type in `ActiveSupport::XmlMini`.
583
212
 
584
- If your gem has a Railtie or Engine, it's encouraged to add your deprecator to the application's deprecators, that
585
- way the deprecation related configuration options will apply to it as well, e.g.
586
- `config.active_support.report_deprecations` set to `false` in the production environment will also disable your
587
- deprecator.
213
+ *heka1024*
588
214
 
589
- ```ruby
590
- initializer "my_gem.deprecator" do |app|
591
- app.deprecators[:my_gem] = MyGem.deprecator
592
- end
593
- ```
215
+ * Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
594
216
 
595
- *Étienne Barrié*
217
+ *Rafael Mendonça França*
596
218
 
597
- * Add `Object#with` to set and restore public attributes around a block
219
+ * Remove deprecated support to call the following methods without passing a deprecator:
598
220
 
599
- ```ruby
600
- client.timeout # => 5
601
- client.with(timeout: 1) do
602
- client.timeout # => 1
603
- end
604
- client.timeout # => 5
605
- ```
221
+ - `deprecate`
222
+ - `deprecate_constant`
223
+ - `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
224
+ - `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
225
+ - `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
226
+ - `assert_deprecated`
227
+ - `assert_not_deprecated`
228
+ - `collect_deprecations`
606
229
 
607
- *Jean Boussier*
230
+ *Rafael Mendonça França*
608
231
 
609
- * Remove deprecated support to generate incorrect RFC 4122 UUIDs when providing a namespace ID that is not one of the
610
- constants defined on `Digest::UUID`.
232
+ * Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
611
233
 
612
234
  *Rafael Mendonça França*
613
235
 
614
- * Deprecate `config.active_support.use_rfc4122_namespaced_uuids`.
236
+ * Remove deprecated `SafeBuffer#clone_empty`.
615
237
 
616
238
  *Rafael Mendonça França*
617
239
 
618
- * Remove implicit conversion of objects into `String` by `ActiveSupport::SafeBuffer`.
240
+ * Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
619
241
 
620
242
  *Rafael Mendonça França*
621
243
 
622
- * Remove deprecated `active_support/core_ext/range/include_time_with_zone` file.
244
+ * Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
623
245
 
624
246
  *Rafael Mendonça França*
625
247
 
626
- * Deprecate `config.active_support.remove_deprecated_time_with_zone_name`.
248
+ * Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
627
249
 
628
250
  *Rafael Mendonça França*
629
251
 
630
- * Remove deprecated override of `ActiveSupport::TimeWithZone.name`.
252
+ * Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
631
253
 
632
254
  *Rafael Mendonça França*
633
255
 
634
- * Deprecate `config.active_support.disable_to_s_conversion`.
256
+ * Remove deprecated `config.active_support.disable_to_s_conversion`.
635
257
 
636
258
  *Rafael Mendonça França*
637
259
 
638
- * Remove deprecated option to passing a format to `#to_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
639
- `BigDecimal`, `Float` and, `Integer`.
260
+ * Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
640
261
 
641
262
  *Rafael Mendonça França*
642
263
 
643
- * Remove deprecated `ActiveSupport::PerThreadRegistry`.
264
+ * Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
644
265
 
645
266
  *Rafael Mendonça França*
646
267
 
647
- * Remove deprecated override of `Enumerable#sum`.
268
+ * Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
648
269
 
649
270
  *Rafael Mendonça França*
650
271
 
651
- * Deprecated initializing a `ActiveSupport::Cache::MemCacheStore` with an instance of `Dalli::Client`.
652
-
653
- Deprecate the undocumented option of providing an already-initialized instance of `Dalli::Client` to `ActiveSupport::Cache::MemCacheStore`. Such clients could be configured with unrecognized options, which could lead to unexpected behavior. Instead, provide addresses as documented.
272
+ * Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
654
273
 
655
- *aledustet*
274
+ *Rafael Mendonça França*
656
275
 
657
- * Stub `Time.new()` in `TimeHelpers#travel_to`
276
+ * Warn on tests without assertions.
658
277
 
659
- ```ruby
660
- travel_to Time.new(2004, 11, 24) do
661
- # Inside the `travel_to` block `Time.new` is stubbed
662
- assert_equal 2004, Time.new.year
663
- end
664
- ```
278
+ `ActiveSupport::TestCase` now warns when tests do not run any assertions.
279
+ This is helpful in detecting broken tests that do not perform intended assertions.
665
280
 
666
281
  *fatkodima*
667
282
 
668
- * Raise `ActiveSupport::MessageEncryptor::InvalidMessage` from
669
- `ActiveSupport::MessageEncryptor#decrypt_and_verify` regardless of cipher.
670
- Previously, when a `MessageEncryptor` was using a non-AEAD cipher such as
671
- AES-256-CBC, a corrupt or tampered message would raise
672
- `ActiveSupport::MessageVerifier::InvalidSignature`. Now, all ciphers raise
673
- the same error:
674
-
675
- ```ruby
676
- encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-gcm")
677
- message = encryptor.encrypt_and_sign("message")
678
- encryptor.decrypt_and_verify(message.next)
679
- # => raises ActiveSupport::MessageEncryptor::InvalidMessage
680
-
681
- encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-cbc")
682
- message = encryptor.encrypt_and_sign("message")
683
- encryptor.decrypt_and_verify(message.next)
684
- # BEFORE:
685
- # => raises ActiveSupport::MessageVerifier::InvalidSignature
686
- # AFTER:
687
- # => raises ActiveSupport::MessageEncryptor::InvalidMessage
688
- ```
689
-
690
- *Jonathan Hefner*
691
-
692
- * Support `nil` original values when using `ActiveSupport::MessageVerifier#verify`.
693
- Previously, `MessageVerifier#verify` did not work with `nil` original
694
- values, though both `MessageVerifier#verified` and
695
- `MessageEncryptor#decrypt_and_verify` do:
696
-
697
- ```ruby
698
- encryptor = ActiveSupport::MessageEncryptor.new(secret)
699
- message = encryptor.encrypt_and_sign(nil)
700
-
701
- encryptor.decrypt_and_verify(message)
702
- # => nil
703
-
704
- verifier = ActiveSupport::MessageVerifier.new(secret)
705
- message = verifier.generate(nil)
706
-
707
- verifier.verified(message)
708
- # => nil
709
-
710
- verifier.verify(message)
711
- # BEFORE:
712
- # => raises ActiveSupport::MessageVerifier::InvalidSignature
713
- # AFTER:
714
- # => nil
715
- ```
716
-
717
- *Jonathan Hefner*
718
-
719
- * Maintain `html_safe?` on html_safe strings when sliced with `slice`, `slice!`, or `chr` method.
720
-
721
- Previously, `html_safe?` was only maintained when the html_safe strings were sliced
722
- with `[]` method. Now, `slice`, `slice!`, and `chr` methods will maintain `html_safe?` like `[]` method.
723
-
724
- ```ruby
725
- string = "<div>test</div>".html_safe
726
- string.slice(0, 1).html_safe? # => true
727
- string.slice!(0, 1).html_safe? # => true
728
- # maintain html_safe? after the slice!
729
- string.html_safe? # => true
730
- string.chr.html_safe? # => true
731
- ```
732
-
733
- *Michael Go*
734
-
735
- * Add `Object#in?` support for open ranges.
736
-
737
- ```ruby
738
- assert Date.today.in?(..Date.tomorrow)
739
- assert_not Date.today.in?(Date.tomorrow..)
740
- ```
741
-
742
- *Ignacio Galindo*
743
-
744
- * `config.i18n.raise_on_missing_translations = true` now raises on any missing translation.
745
-
746
- Previously it would only raise when called in a view or controller. Now it will raise
747
- anytime `I18n.t` is provided an unrecognised key.
748
-
749
- If you do not want this behaviour, you can customise the i18n exception handler. See the
750
- upgrading guide or i18n guide for more information.
751
-
752
- *Alex Ghiculescu*
753
-
754
- * `ActiveSupport::CurrentAttributes` now raises if a restricted attribute name is used.
755
-
756
- Attributes such as `set` and `reset` cannot be used as they clash with the
757
- `CurrentAttributes` public API.
758
-
759
- *Alex Ghiculescu*
760
-
761
- * `HashWithIndifferentAccess#transform_keys` now takes a Hash argument, just
762
- as Ruby's `Hash#transform_keys` does.
763
-
764
- *Akira Matsuda*
765
-
766
- * `delegate` now defines method with proper arity when delegating to a Class.
767
- With this change, it defines faster method (3.5x faster with no argument).
768
- However, in order to gain this benefit, the delegation target method has to
769
- be defined before declaring the delegation.
770
-
771
- ```ruby
772
- # This defines 3.5 times faster method than before
773
- class C
774
- def self.x() end
775
- delegate :x, to: :class
776
- end
283
+ * Support `hexBinary` type in `ActiveSupport::XmlMini`.
777
284
 
778
- class C
779
- # This works but silently falls back to old behavior because
780
- # `delegate` cannot find the definition of `x`
781
- delegate :x, to: :class
782
- def self.x() end
783
- end
784
- ```
285
+ *heka1024*
785
286
 
786
- *Akira Matsuda*
287
+ * Deprecate `ActiveSupport::ProxyObject` in favor of Ruby's built-in `BasicObject`.
787
288
 
788
- * `assert_difference` message now includes what changed.
289
+ *Earlopain*
789
290
 
790
- This makes it easier to debug non-obvious failures.
291
+ * `stub_const` now accepts a `exists: false` parameter to allow stubbing missing constants.
791
292
 
792
- Before:
293
+ *Jean Boussier*
793
294
 
794
- ```
795
- "User.count" didn't change by 32.
796
- Expected: 1611
797
- Actual: 1579
798
- ```
295
+ * Make `ActiveSupport::BacktraceCleaner` copy filters and silencers on dup and clone.
799
296
 
800
- After:
297
+ Previously the copy would still share the internal silencers and filters array,
298
+ causing state to leak.
801
299
 
802
- ```
803
- "User.count" didn't change by 32, but by 0.
804
- Expected: 1611
805
- Actual: 1579
806
- ```
300
+ *Jean Boussier*
807
301
 
808
- *Alex Ghiculescu*
302
+ * Updating Astana with Western Kazakhstan TZInfo identifier.
809
303
 
810
- * Add ability to match exception messages to `assert_raises` assertion
304
+ *Damian Nelson*
811
305
 
812
- Instead of this
813
- ```ruby
814
- error = assert_raises(ArgumentError) do
815
- perform_service(param: 'exception')
816
- end
817
- assert_match(/incorrect param/i, error.message)
818
- ```
306
+ * Add filename support for `ActiveSupport::Logger.logger_outputs_to?`.
819
307
 
820
- you can now write this
821
308
  ```ruby
822
- assert_raises(ArgumentError, match: /incorrect param/i) do
823
- perform_service(param: 'exception')
824
- end
309
+ logger = Logger.new('/var/log/rails.log')
310
+ ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
825
311
  ```
826
312
 
827
- *fatkodima*
828
-
829
- * Add `Rails.env.local?` shorthand for `Rails.env.development? || Rails.env.test?`.
830
-
831
- *DHH*
313
+ *Christian Schmidt*
832
314
 
833
- * `ActiveSupport::Testing::TimeHelpers` now accepts named `with_usec` argument
834
- to `freeze_time`, `travel`, and `travel_to` methods. Passing true prevents
835
- truncating the destination time with `change(usec: 0)`.
315
+ * Include `IPAddr#prefix` when serializing an `IPAddr` using the
316
+ `ActiveSupport::MessagePack` serializer.
836
317
 
837
- *KevSlashNull*, and *serprex*
318
+ This change is backward and forward compatible — old payloads can
319
+ still be read, and new payloads will be readable by older versions of Rails.
838
320
 
839
- * `ActiveSupport::CurrentAttributes.resets` now accepts a method name
321
+ *Taiki Komaba*
840
322
 
841
- The block API is still the recommended approach, but now both APIs are supported:
323
+ * Add `default:` support for `ActiveSupport::CurrentAttributes.attribute`.
842
324
 
843
325
  ```ruby
844
326
  class Current < ActiveSupport::CurrentAttributes
845
- resets { Time.zone = nil }
846
- resets :clear_time_zone
327
+ attribute :counter, default: 0
847
328
  end
848
329
  ```
849
330
 
850
- *Alex Ghiculescu*
851
-
852
- * Ensure `ActiveSupport::Testing::Isolation::Forking` closes pipes
853
-
854
- Previously, `Forking.run_in_isolation` opened two ends of a pipe. The fork
855
- process closed the read end, wrote to it, and then terminated (which
856
- presumably closed the file descriptors on its end). The parent process
857
- closed the write end, read from it, and returned, never closing the read
858
- end.
859
-
860
- This resulted in an accumulation of open file descriptors, which could
861
- cause errors if the limit is reached.
862
-
863
- *Sam Bostock*
864
-
865
- * Fix `Time#change` and `Time#advance` for times around the end of Daylight
866
- Saving Time.
867
-
868
- Previously, when `Time#change` or `Time#advance` constructed a time inside
869
- the final stretch of Daylight Saving Time (DST), the non-DST offset would
870
- always be chosen for local times:
871
-
872
- ```ruby
873
- # DST ended just before 2021-11-07 2:00:00 AM in US/Eastern.
874
- ENV["TZ"] = "US/Eastern"
875
-
876
- time = Time.local(2021, 11, 07, 00, 59, 59) + 1
877
- # => 2021-11-07 01:00:00 -0400
878
- time.change(day: 07)
879
- # => 2021-11-07 01:00:00 -0500
880
- time.advance(seconds: 0)
881
- # => 2021-11-07 01:00:00 -0500
882
-
883
- time = Time.local(2021, 11, 06, 01, 00, 00)
884
- # => 2021-11-06 01:00:00 -0400
885
- time.change(day: 07)
886
- # => 2021-11-07 01:00:00 -0500
887
- time.advance(days: 1)
888
- # => 2021-11-07 01:00:00 -0500
889
- ```
331
+ *Sean Doyle*
890
332
 
891
- And the DST offset would always be chosen for times with a `TimeZone`
892
- object:
333
+ * Yield instance to `Object#with` block.
893
334
 
894
335
  ```ruby
895
- Time.zone = "US/Eastern"
896
-
897
- time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600
898
- # => 2021-11-07 01:00:00 -0500
899
- time.change(day: 07)
900
- # => 2021-11-07 01:00:00 -0400
901
- time.advance(seconds: 0)
902
- # => 2021-11-07 01:00:00 -0400
903
-
904
- time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone)
905
- # => 2021-11-08 01:00:00 -0500
906
- time.change(day: 07)
907
- # => 2021-11-07 01:00:00 -0400
908
- time.advance(days: -1)
909
- # => 2021-11-07 01:00:00 -0400
910
- ```
911
-
912
- Now, `Time#change` and `Time#advance` will choose the offset that matches
913
- the original time's offset when possible:
914
-
915
- ```ruby
916
- ENV["TZ"] = "US/Eastern"
917
-
918
- time = Time.local(2021, 11, 07, 00, 59, 59) + 1
919
- # => 2021-11-07 01:00:00 -0400
920
- time.change(day: 07)
921
- # => 2021-11-07 01:00:00 -0400
922
- time.advance(seconds: 0)
923
- # => 2021-11-07 01:00:00 -0400
924
-
925
- time = Time.local(2021, 11, 06, 01, 00, 00)
926
- # => 2021-11-06 01:00:00 -0400
927
- time.change(day: 07)
928
- # => 2021-11-07 01:00:00 -0400
929
- time.advance(days: 1)
930
- # => 2021-11-07 01:00:00 -0400
931
-
932
- Time.zone = "US/Eastern"
933
-
934
- time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600
935
- # => 2021-11-07 01:00:00 -0500
936
- time.change(day: 07)
937
- # => 2021-11-07 01:00:00 -0500
938
- time.advance(seconds: 0)
939
- # => 2021-11-07 01:00:00 -0500
940
-
941
- time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone)
942
- # => 2021-11-08 01:00:00 -0500
943
- time.change(day: 07)
944
- # => 2021-11-07 01:00:00 -0500
945
- time.advance(days: -1)
946
- # => 2021-11-07 01:00:00 -0500
947
- ```
948
-
949
- *Kevin Hall*, *Takayoshi Nishida*, and *Jonathan Hefner*
950
-
951
- * Fix MemoryStore to preserve entries TTL when incrementing or decrementing
952
-
953
- This is to be more consistent with how MemCachedStore and RedisCacheStore behaves.
954
-
955
- *Jean Boussier*
956
-
957
- * `Rails.error.handle` and `Rails.error.record` filter now by multiple error classes.
958
-
959
- ```ruby
960
- Rails.error.handle(IOError, ArgumentError) do
961
- 1 + '1' # raises TypeError
336
+ client.with(timeout: 5_000) do |c|
337
+ c.get("/commits")
962
338
  end
963
- 1 + 1 # TypeErrors are not IOErrors or ArgumentError, so this will *not* be handled
964
339
  ```
965
340
 
966
- *Martin Spickermann*
967
-
968
- * `Class#subclasses` and `Class#descendants` now automatically filter reloaded classes.
969
-
970
- Previously they could return old implementations of reloadable classes that have been
971
- dereferenced but not yet garbage collected.
341
+ *Sean Doyle*
972
342
 
973
- They now automatically filter such classes like `DescendantTracker#subclasses` and
974
- `DescendantTracker#descendants`.
343
+ * Use logical core count instead of physical core count to determine the
344
+ default number of workers when parallelizing tests.
975
345
 
976
- *Jean Boussier*
977
-
978
- * `Rails.error.report` now marks errors as reported to avoid reporting them twice.
346
+ *Jonathan Hefner*
979
347
 
980
- In some cases, users might want to report errors explicitly with some extra context
981
- before letting it bubble up.
348
+ * Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
982
349
 
983
- This also allows to safely catch and report errors outside of the execution context.
350
+ There is a bug in the current implementation of #travel_to:
351
+ it remembers a timezone of its argument, and all stubbed methods start
352
+ returning results in that remembered timezone. However, the expected
353
+ behavior is to return results in a system timezone.
984
354
 
985
- *Jean Boussier*
355
+ *Aleksei Chernenkov*
986
356
 
987
- * Add `assert_error_reported` and `assert_no_error_reported`
357
+ * Add `ErrorReported#unexpected` to report precondition violations.
988
358
 
989
- Allows to easily asserts an error happened but was handled
359
+ For example:
990
360
 
991
361
  ```ruby
992
- report = assert_error_reported(IOError) do
362
+ def edit
363
+ if published?
364
+ Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
365
+ return false
366
+ end
993
367
  # ...
994
368
  end
995
- assert_equal "Oops", report.error.message
996
- assert_equal "admin", report.context[:section]
997
- assert_equal :warning, report.severity
998
- assert_predicate report, :handled?
999
369
  ```
1000
370
 
1001
- *Jean Boussier*
1002
-
1003
- * `ActiveSupport::Deprecation` behavior callbacks can now receive the
1004
- deprecator instance as an argument. This makes it easier for such callbacks
1005
- to change their behavior based on the deprecator's state. For example,
1006
- based on the deprecator's `debug` flag.
1007
-
1008
- 3-arity and splat-args callbacks such as the following will now be passed
1009
- the deprecator instance as their third argument:
1010
-
1011
- * `->(message, callstack, deprecator) { ... }`
1012
- * `->(*args) { ... }`
1013
- * `->(message, *other_args) { ... }`
1014
-
1015
- 2-arity and 4-arity callbacks such as the following will continue to behave
1016
- the same as before:
1017
-
1018
- * `->(message, callstack) { ... }`
1019
- * `->(message, callstack, deprecation_horizon, gem_name) { ... }`
1020
- * `->(message, callstack, *deprecation_details) { ... }`
1021
-
1022
- *Jonathan Hefner*
1023
-
1024
- * `ActiveSupport::Deprecation#disallowed_warnings` now affects the instance on
1025
- which it is configured.
1026
-
1027
- This means that individual `ActiveSupport::Deprecation` instances can be
1028
- configured with their own disallowed warnings, and the global
1029
- `ActiveSupport::Deprecation.disallowed_warnings` now only affects the global
1030
- `ActiveSupport::Deprecation.warn`.
1031
-
1032
- **Before**
1033
-
1034
- ```ruby
1035
- ActiveSupport::Deprecation.disallowed_warnings = ["foo"]
1036
- deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem")
1037
- deprecator.disallowed_warnings = ["bar"]
1038
-
1039
- ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException
1040
- ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar"
1041
- deprecator.warn("foo") # => raise ActiveSupport::DeprecationException
1042
- deprecator.warn("bar") # => print "DEPRECATION WARNING: bar"
1043
- ```
1044
-
1045
- **After**
1046
-
1047
- ```ruby
1048
- ActiveSupport::Deprecation.disallowed_warnings = ["foo"]
1049
- deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem")
1050
- deprecator.disallowed_warnings = ["bar"]
1051
-
1052
- ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException
1053
- ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar"
1054
- deprecator.warn("foo") # => print "DEPRECATION WARNING: foo"
1055
- deprecator.warn("bar") # => raise ActiveSupport::DeprecationException
1056
- ```
1057
-
1058
- Note that global `ActiveSupport::Deprecation` methods such as `ActiveSupport::Deprecation.warn`
1059
- and `ActiveSupport::Deprecation.disallowed_warnings` have been deprecated.
1060
-
1061
- *Jonathan Hefner*
1062
-
1063
- * Add italic and underline support to `ActiveSupport::LogSubscriber#color`
1064
-
1065
- Previously, only bold text was supported via a positional argument.
1066
- This allows for bold, italic, and underline options to be specified
1067
- for colored logs.
1068
-
1069
- ```ruby
1070
- info color("Hello world!", :red, bold: true, underline: true)
1071
- ```
1072
-
1073
- *Gannon McGibbon*
1074
-
1075
- * Add `String#downcase_first` method.
1076
-
1077
- This method is the corollary of `String#upcase_first`.
1078
-
1079
- *Mark Schneider*
1080
-
1081
- * `thread_mattr_accessor` will call `.dup.freeze` on non-frozen default values.
1082
-
1083
- This provides a basic level of protection against different threads trying
1084
- to mutate a shared default object.
1085
-
1086
- *Jonathan Hefner*
1087
-
1088
- * Add `raise_on_invalid_cache_expiration_time` config to `ActiveSupport::Cache::Store`
1089
-
1090
- Specifies if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
1091
- `write` are given an invalid `expires_at` or `expires_in` time.
1092
-
1093
- Options are `true`, and `false`. If `false`, the exception will be reported
1094
- as `handled` and logged instead. Defaults to `true` if `config.load_defaults >= 7.1`.
1095
-
1096
- *Trevor Turk*
1097
-
1098
- * `ActiveSupport::Cache::Store#fetch` now passes an options accessor to the block.
1099
-
1100
- It makes possible to override cache options:
1101
-
1102
- Rails.cache.fetch("3rd-party-token") do |name, options|
1103
- token = fetch_token_from_remote
1104
- # set cache's TTL to match token's TTL
1105
- options.expires_in = token.expires_in
1106
- token
1107
- end
1108
-
1109
- *Andrii Gladkyi*, *Jean Boussier*
1110
-
1111
- * `default` option of `thread_mattr_accessor` now applies through inheritance and
1112
- also across new threads.
1113
-
1114
- Previously, the `default` value provided was set only at the moment of defining
1115
- the attribute writer, which would cause the attribute to be uninitialized in
1116
- descendants and in other threads.
1117
-
1118
- Fixes #43312.
1119
-
1120
- *Thierry Deo*
1121
-
1122
- * Redis cache store is now compatible with redis-rb 5.0.
371
+ The above will raise an error in development and test, but only report the error in production.
1123
372
 
1124
373
  *Jean Boussier*
1125
374
 
1126
- * Add `skip_nil:` support to `ActiveSupport::Cache::Store#fetch_multi`.
1127
-
1128
- *Daniel Alfaro*
375
+ * Make the order of read_multi and write_multi notifications for `Cache::Store#fetch_multi` operations match the order they are executed in.
1129
376
 
1130
- * Add `quarter` method to date/time
377
+ *Adam Renberg Tamm*
1131
378
 
1132
- *Matt Swanson*
379
+ * Make return values of `Cache::Store#write` consistent.
1133
380
 
1134
- * Fix `NoMethodError` on custom `ActiveSupport::Deprecation` behavior.
381
+ The return value was not specified before. Now it returns `true` on a successful write,
382
+ `nil` if there was an error talking to the cache backend, and `false` if the write failed
383
+ for another reason (e.g. the key already exists and `unless_exist: true` was passed).
1135
384
 
1136
- `ActiveSupport::Deprecation.behavior=` was supposed to accept any object
1137
- that responds to `call`, but in fact its internal implementation assumed that
1138
- this object could respond to `arity`, so it was restricted to only `Proc` objects.
385
+ *Sander Verdonschot*
1139
386
 
1140
- This change removes this `arity` restriction of custom behaviors.
387
+ * Fix logged cache keys not always matching actual key used by cache action.
1141
388
 
1142
- *Ryo Nakamura*
1143
-
1144
- * Support `:url_safe` option for `MessageEncryptor`.
1145
-
1146
- The `MessageEncryptor` constructor now accepts a `:url_safe` option, similar
1147
- to the `MessageVerifier` constructor. When enabled, this option ensures
1148
- that messages use a URL-safe encoding.
389
+ *Hartley McGuire*
1149
390
 
1150
- *Jonathan Hefner*
391
+ * Improve error messages of `assert_changes` and `assert_no_changes`.
1151
392
 
1152
- * Add `url_safe` option to `ActiveSupport::MessageVerifier` initializer
393
+ `assert_changes` error messages now display objects with `.inspect` to make it easier
394
+ to differentiate nil from empty strings, strings from symbols, etc.
395
+ `assert_no_changes` error messages now surface the actual value.
1153
396
 
1154
- `ActiveSupport::MessageVerifier.new` now takes optional `url_safe` argument.
1155
- It can generate URL-safe strings by passing `url_safe: true`.
397
+ *pcreux*
1156
398
 
1157
- ```ruby
1158
- verifier = ActiveSupport::MessageVerifier.new(url_safe: true)
1159
- message = verifier.generate(data) # => URL-safe string
1160
- ```
399
+ * Fix `#to_fs(:human_size)` to correctly work with negative numbers.
1161
400
 
1162
- This option is `false` by default to be backwards compatible.
401
+ *Earlopain*
1163
402
 
1164
- *Shouichi Kamiya*
403
+ * Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
1165
404
 
1166
- * Enable connection pooling by default for `MemCacheStore` and `RedisCacheStore`.
405
+ *Andrew Novoselac*
1167
406
 
1168
- If you want to disable connection pooling, set `:pool` option to `false` when configuring the cache store:
407
+ * Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
1169
408
 
1170
- ```ruby
1171
- config.cache_store = :mem_cache_store, "cache.example.com", pool: false
1172
- ```
409
+ *Andrew Novoselac*
1173
410
 
1174
- *fatkodima*
411
+ * Fix compatibility with the `semantic_logger` gem.
1175
412
 
1176
- * Add `force:` support to `ActiveSupport::Cache::Store#fetch_multi`.
413
+ The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
414
+ `SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
1177
415
 
1178
- *fatkodima*
416
+ This caused the various `LogSubscriber` classes in Rails to break when assigned a
417
+ `SemanticLogger` instance.
1179
418
 
1180
- * Deprecated `:pool_size` and `:pool_timeout` options for configuring connection pooling in cache stores.
419
+ *Jean Boussier*, *ojab*
1181
420
 
1182
- Use `pool: true` to enable pooling with default settings:
421
+ * Fix MemoryStore to prevent race conditions when incrementing or decrementing.
1183
422
 
1184
- ```ruby
1185
- config.cache_store = :redis_cache_store, pool: true
1186
- ```
423
+ *Pierre Jambet*
1187
424
 
1188
- Or pass individual options via `:pool` option:
425
+ * Implement `HashWithIndifferentAccess#to_proc`.
1189
426
 
1190
- ```ruby
1191
- config.cache_store = :redis_cache_store, pool: { size: 10, timeout: 2 }
1192
- ```
427
+ Previously, calling `#to_proc` on `HashWithIndifferentAccess` object used inherited `#to_proc`
428
+ method from the `Hash` class, which was not able to access values using indifferent keys.
1193
429
 
1194
430
  *fatkodima*
1195
431
 
1196
- * Allow #increment and #decrement methods of `ActiveSupport::Cache::Store`
1197
- subclasses to set new values.
1198
-
1199
- Previously incrementing or decrementing an unset key would fail and return
1200
- nil. A default will now be assumed and the key will be created.
1201
-
1202
- *Andrej Blagojević*, *Eugene Kenny*
1203
-
1204
- * Add `skip_nil:` support to `RedisCacheStore`
1205
-
1206
- *Joey Paris*
1207
-
1208
- * `ActiveSupport::Cache::MemoryStore#write(name, val, unless_exist:true)` now
1209
- correctly writes expired keys.
1210
-
1211
- *Alan Savage*
1212
-
1213
- * `ActiveSupport::ErrorReporter` now accepts and forward a `source:` parameter.
1214
-
1215
- This allow libraries to signal the origin of the errors, and reporters
1216
- to easily ignore some sources.
1217
-
1218
- *Jean Boussier*
1219
-
1220
- * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
1221
-
1222
- Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
1223
- in names of tags and names of attributes, following the specification of XML.
1224
-
1225
- *Álvaro Martín Fraguas*
1226
-
1227
- * Respect `ActiveSupport::Logger.new`'s `:formatter` keyword argument
1228
-
1229
- The stdlib `Logger::new` allows passing a `:formatter` keyword argument to
1230
- set the logger's formatter. Previously `ActiveSupport::Logger.new` ignored
1231
- that argument by always setting the formatter to an instance of
1232
- `ActiveSupport::Logger::SimpleFormatter`.
1233
-
1234
- *Steven Harman*
1235
-
1236
- * Deprecate preserving the pre-Ruby 2.4 behavior of `to_time`
1237
-
1238
- With Ruby 2.4+ the default for +to_time+ changed from converting to the
1239
- local system time to preserving the offset of the receiver. At the time Rails
1240
- supported older versions of Ruby so a compatibility layer was added to assist
1241
- in the migration process. From Rails 5.0 new applications have defaulted to
1242
- the Ruby 2.4+ behavior and since Rails 7.0 now only supports Ruby 2.7+
1243
- this compatibility layer can be safely removed.
1244
-
1245
- To minimize any noise generated the deprecation warning only appears when the
1246
- setting is configured to `false` as that is the only scenario where the
1247
- removal of the compatibility layer has any effect.
1248
-
1249
- *Andrew White*
1250
-
1251
- * `Pathname.blank?` only returns true for `Pathname.new("")`
1252
-
1253
- Previously it would end up calling `Pathname#empty?` which returned true
1254
- if the path existed and was an empty directory or file.
1255
-
1256
- That behavior was unlikely to be expected.
1257
-
1258
- *Jean Boussier*
1259
-
1260
- * Deprecate `Notification::Event`'s `#children` and `#parent_of?`
1261
-
1262
- *John Hawthorn*
1263
-
1264
- * Change the default serializer of `ActiveSupport::MessageVerifier` from
1265
- `Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`.
1266
-
1267
- Messages serialized with `Marshal` can still be read, but new messages will
1268
- be serialized with `ActiveSupport::JSON`. For more information, see
1269
- https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer.
1270
-
1271
- *Saba Kiaei*, *David Buckley*, and *Jonathan Hefner*
1272
-
1273
- * Change the default serializer of `ActiveSupport::MessageEncryptor` from
1274
- `Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`.
1275
-
1276
- Messages serialized with `Marshal` can still be read, but new messages will
1277
- be serialized with `ActiveSupport::JSON`. For more information, see
1278
- https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer.
1279
-
1280
- *Zack Deveau*, *Martin Gingras*, and *Jonathan Hefner*
1281
-
1282
- * Add `ActiveSupport::TestCase#stub_const` to stub a constant for the duration of a yield.
1283
-
1284
- *DHH*
1285
-
1286
- * Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
1287
-
1288
- *Stephen Sugden*
1289
-
1290
- * Improve `File.atomic_write` error handling
1291
-
1292
- *Daniel Pepper*
1293
-
1294
- * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
1295
-
1296
- [The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
1297
- but `Class#subclasses` was kept, breaking the feature detection.
1298
-
1299
- *Jean Boussier*
1300
-
1301
- Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activesupport/CHANGELOG.md) for previous changes.
432
+ Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activesupport/CHANGELOG.md) for previous changes.