activesupport 8.0.5.1 → 8.1.0.beta1

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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +224 -268
  3. data/lib/active_support/backtrace_cleaner.rb +71 -0
  4. data/lib/active_support/cache/mem_cache_store.rb +14 -17
  5. data/lib/active_support/cache/redis_cache_store.rb +37 -31
  6. data/lib/active_support/cache/strategy/local_cache.rb +16 -7
  7. data/lib/active_support/cache/strategy/local_cache_middleware.rb +7 -7
  8. data/lib/active_support/cache.rb +69 -6
  9. data/lib/active_support/configurable.rb +28 -0
  10. data/lib/active_support/continuous_integration.rb +145 -0
  11. data/lib/active_support/core_ext/benchmark.rb +0 -1
  12. data/lib/active_support/core_ext/class/attribute.rb +6 -8
  13. data/lib/active_support/core_ext/date_and_time/compatibility.rb +1 -1
  14. data/lib/active_support/core_ext/enumerable.rb +2 -2
  15. data/lib/active_support/core_ext/erb/util.rb +3 -3
  16. data/lib/active_support/core_ext/object/json.rb +9 -2
  17. data/lib/active_support/core_ext/object/to_query.rb +5 -0
  18. data/lib/active_support/core_ext/range.rb +0 -1
  19. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  20. data/lib/active_support/core_ext/string/multibyte.rb +10 -1
  21. data/lib/active_support/core_ext/string/output_safety.rb +20 -15
  22. data/lib/active_support/current_attributes/test_helper.rb +2 -2
  23. data/lib/active_support/current_attributes.rb +13 -10
  24. data/lib/active_support/delegation.rb +42 -25
  25. data/lib/active_support/deprecation/reporting.rb +4 -2
  26. data/lib/active_support/deprecation.rb +1 -1
  27. data/lib/active_support/editor.rb +70 -0
  28. data/lib/active_support/error_reporter.rb +50 -6
  29. data/lib/active_support/event_reporter/test_helper.rb +32 -0
  30. data/lib/active_support/event_reporter.rb +570 -0
  31. data/lib/active_support/evented_file_update_checker.rb +5 -1
  32. data/lib/active_support/execution_context.rb +64 -7
  33. data/lib/active_support/file_update_checker.rb +8 -6
  34. data/lib/active_support/gem_version.rb +3 -3
  35. data/lib/active_support/gzip.rb +1 -0
  36. data/lib/active_support/hash_with_indifferent_access.rb +27 -7
  37. data/lib/active_support/i18n_railtie.rb +1 -2
  38. data/lib/active_support/inflector/inflections.rb +32 -17
  39. data/lib/active_support/inflector/methods.rb +3 -3
  40. data/lib/active_support/inflector/transliterate.rb +6 -8
  41. data/lib/active_support/isolated_execution_state.rb +9 -17
  42. data/lib/active_support/json/decoding.rb +2 -2
  43. data/lib/active_support/json/encoding.rb +103 -14
  44. data/lib/active_support/log_subscriber.rb +2 -0
  45. data/lib/active_support/message_encryptors.rb +52 -0
  46. data/lib/active_support/message_pack/extensions.rb +6 -1
  47. data/lib/active_support/message_verifiers.rb +52 -0
  48. data/lib/active_support/messages/rotation_coordinator.rb +9 -0
  49. data/lib/active_support/messages/rotator.rb +5 -0
  50. data/lib/active_support/multibyte/chars.rb +8 -1
  51. data/lib/active_support/multibyte.rb +4 -0
  52. data/lib/active_support/notifications/instrumenter.rb +1 -1
  53. data/lib/active_support/number_helper/number_converter.rb +1 -1
  54. data/lib/active_support/number_helper/number_to_delimited_converter.rb +2 -17
  55. data/lib/active_support/railtie.rb +26 -12
  56. data/lib/active_support/syntax_error_proxy.rb +3 -0
  57. data/lib/active_support/test_case.rb +61 -12
  58. data/lib/active_support/testing/assertions.rb +37 -14
  59. data/lib/active_support/testing/autorun.rb +0 -5
  60. data/lib/active_support/testing/error_reporter_assertions.rb +18 -1
  61. data/lib/active_support/testing/event_reporter_assertions.rb +217 -0
  62. data/lib/active_support/testing/notification_assertions.rb +92 -0
  63. data/lib/active_support/testing/parallelization/server.rb +2 -15
  64. data/lib/active_support/testing/parallelization/worker.rb +5 -7
  65. data/lib/active_support/testing/parallelization.rb +14 -12
  66. data/lib/active_support/testing/tests_without_assertions.rb +1 -1
  67. data/lib/active_support/testing/time_helpers.rb +7 -3
  68. data/lib/active_support/time_with_zone.rb +19 -5
  69. data/lib/active_support/values/time_zone.rb +8 -1
  70. data/lib/active_support/xml_mini.rb +1 -4
  71. data/lib/active_support.rb +11 -0
  72. metadata +11 -6
  73. data/lib/active_support/core_ext/range/each.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb0921bb41abade78e004303dc1f7fb4f2ea47dd3f30effe50934cff4d99491e
4
- data.tar.gz: 64520b181d47ce4b0d61fa734ed07d69ef3da8e9da43b9f205893273ce2dc683
3
+ metadata.gz: 961314ec0e1413ca082492acda67d57e19e5011d13725707c3b3d83cb3e88b6c
4
+ data.tar.gz: '0918a0dcb857f0621acf8c0034cc568efceddbaf92991da1d73ea1a3ae892f40'
5
5
  SHA512:
6
- metadata.gz: 87f65a473e188c7eaa1335595ab2e24027a7b9fd1cd203f195cb895e00e56b0e67f338df288087f87b7be127680304e2d71b347fbd3f8b3b8aae0a3199333de6
7
- data.tar.gz: a8b5a241aab71e727ecf824e35bb1833e9fc50156872d2ba5e6c03a5ade4071d0a9f17ca12c297a2ee94368ec877590c9485af9a3e4004ce2b9b8d3ce5aff3dc
6
+ metadata.gz: d167935a467f95a7dd138a7498328e7f8bb5970ad79e33ea43267fe79d6a40f5515abc768f9aa995d15e8678638e34a4b1ce925797a216bc7b5b26ab8ea97be7
7
+ data.tar.gz: 01edbccd59380207d979f9a504619a862c475217eecd9c8972af5868e4f870e405a511babb6925a7723038c7da395a94ecbaf1a3e3e8fb1f4f07dd7300d0321a
data/CHANGELOG.md CHANGED
@@ -1,415 +1,371 @@
1
- ## Rails 8.0.5.1 (July 29, 2026) ##
1
+ ## Rails 8.1.0.beta1 (September 04, 2025) ##
2
2
 
3
- * No changes.
3
+ * Add `ActiveSupport::Cache::Store#namespace=` and `#namespace`.
4
4
 
5
+ Can be used as an alternative to `Store#clear` in some situations such as parallel
6
+ testing.
5
7
 
6
- ## Rails 8.0.5 (March 24, 2026) ##
8
+ *Nick Schwaderer*
7
9
 
8
- * Fix inflections to better handle overlapping acronyms.
10
+ * Create `parallel_worker_id` helper for running parallel tests. This allows users to
11
+ know which worker they are currently running in.
9
12
 
10
- ```ruby
11
- ActiveSupport::Inflector.inflections(:en) do |inflect|
12
- inflect.acronym "USD"
13
- inflect.acronym "USDC"
14
- end
13
+ *Nick Schwaderer*
15
14
 
16
- "USDC".underscore # => "usdc"
17
- ```
15
+ * Make the cache of `ActiveSupport::Cache::Strategy::LocalCache::Middleware` updatable.
18
16
 
19
- *Said Kaldybaev*
17
+ If the cache client at `Rails.cache` of a booted application changes, the corresponding
18
+ mounted middleware needs to update in order for request-local caches to be setup properly.
19
+ Otherwise, redundant cache operations will erroneously hit the datastore.
20
20
 
21
- * Silence Dalli 4.0+ warning when using `ActiveSupport::Cache::MemCacheStore`.
21
+ *Gannon McGibbon*
22
22
 
23
- *zzak*
23
+ * Add `assert_events_reported` test helper for `ActiveSupport::EventReporter`.
24
24
 
25
- * Make `delegate` and `delegate_missing_to` work in BasicObject subclasses.
25
+ This new assertion allows testing multiple events in a single block, regardless of order:
26
26
 
27
- *Rafael Mendonça França*
27
+ ```ruby
28
+ assert_events_reported([
29
+ { name: "user.created", payload: { id: 123 } },
30
+ { name: "email.sent", payload: { to: "user@example.com" } }
31
+ ]) do
32
+ create_user_and_send_welcome_email
33
+ end
34
+ ```
28
35
 
29
- * Fix `ActiveSupport::Inflector.humanize` with international characters.
36
+ *George Ma*
30
37
 
31
- ```ruby
32
- ActiveSupport::Inflector.humanize("áÉÍÓÚ") # => "Áéíóú"
33
- ActiveSupport::Inflector.humanize("аБВГДЕ") # => "Абвгде"
38
+ * Add `ActiveSupport::TimeZone#standard_name` method.
39
+
40
+ ``` ruby
41
+ zone = ActiveSupport::TimeZone['Hawaii']
42
+ # Old way
43
+ ActiveSupport::TimeZone::MAPPING[zone.name]
44
+ # New way
45
+ zone.standard_name # => 'Pacific/Honolulu'
34
46
  ```
35
47
 
36
- *Jose Luis Duran*
48
+ *Bogdan Gusiev*
37
49
 
50
+ * Add Structured Event Reporter, accessible via `Rails.event`.
38
51
 
39
- ## Rails 8.0.4.1 (March 23, 2026) ##
52
+ The Event Reporter provides a unified interface for producing structured events in Rails
53
+ applications:
40
54
 
41
- * Reject scientific notation in NumberConverter
55
+ ```ruby
56
+ Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
57
+ ```
42
58
 
43
- [CVE-2026-33176]
59
+ It supports adding tags to events:
44
60
 
45
- *Jean Boussier*
61
+ ```ruby
62
+ Rails.event.tagged("graphql") do
63
+ # Event includes tags: { graphql: true }
64
+ Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
65
+ end
66
+ ```
46
67
 
47
- * Fix `SafeBuffer#%` to preserve unsafe status
68
+ As well as context:
69
+ ```ruby
70
+ # All events will contain context: {request_id: "abc123", shop_id: 456}
71
+ Rails.event.set_context(request_id: "abc123", shop_id: 456)
72
+ ```
48
73
 
49
- [CVE-2026-33170]
74
+ Events are emitted to subscribers. Applications register subscribers to
75
+ control how events are serialized and emitted. Subscribers must implement
76
+ an `#emit` method, which receives the event hash:
50
77
 
51
- *Jean Boussier*
78
+ ```ruby
79
+ class LogSubscriber
80
+ def emit(event)
81
+ payload = event[:payload].map { |key, value| "#{key}=#{value}" }.join(" ")
82
+ source_location = event[:source_location]
83
+ log = "[#{event[:name]}] #{payload} at #{source_location[:filepath]}:#{source_location[:lineno]}"
84
+ Rails.logger.info(log)
85
+ end
86
+ end
87
+ ```
52
88
 
53
- * Improve performance of NumberToDelimitedConverter
89
+ *Adrianna Chang*
54
90
 
55
- [CVE-2026-33169]
91
+ * Make `ActiveSupport::Logger` `#freeze`-friendly.
56
92
 
57
- *Jean Boussier*
93
+ *Joshua Young*
58
94
 
95
+ * Make `ActiveSupport::Gzip.compress` deterministic based on input.
59
96
 
60
- ## Rails 8.0.4 (October 28, 2025) ##
97
+ `ActiveSupport::Gzip.compress` used to include a timestamp in the output,
98
+ causing consecutive calls with the same input data to have different output
99
+ if called during different seconds. It now always sets the timestamp to `0`
100
+ so that the output is identical for any given input.
61
101
 
62
- * Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple.
102
+ *Rob Brackett*
63
103
 
64
- *Olivier Bellone*
104
+ * Given an array of `Thread::Backtrace::Location` objects, the new method
105
+ `ActiveSupport::BacktraceCleaner#clean_locations` returns an array with the
106
+ clean ones:
65
107
 
66
- * Fix parallel tests hanging when worker processes die abruptly.
108
+ ```ruby
109
+ clean_locations = backtrace_cleaner.clean_locations(caller_locations)
110
+ ```
67
111
 
68
- Previously, if a worker process was killed (e.g., OOM killed, `kill -9`) during parallel
69
- test execution, the test suite would hang forever waiting for the dead worker.
112
+ Filters and silencers receive strings as usual. However, the `path`
113
+ attributes of the locations in the returned array are the original,
114
+ unfiltered ones, since locations are immutable.
70
115
 
71
- *Joshua Young*
116
+ *Xavier Noria*
72
117
 
73
- * Fix `NameError` when `class_attribute` is defined on instance singleton classes.
118
+ * Improve `CurrentAttributes` and `ExecutionContext` state managment in test cases.
74
119
 
75
- Previously, calling `class_attribute` on an instance's singleton class would raise
76
- a `NameError` when accessing the attribute through the instance.
120
+ Previously these two global state would be entirely cleared out whenever calling
121
+ into code that is wrapped by the Rails executor, typically Action Controller or
122
+ Active Job helpers:
77
123
 
78
124
  ```ruby
79
- object = MyClass.new
80
- object.singleton_class.class_attribute :foo, default: "bar"
81
- object.foo # previously raised NameError, now returns "bar"
125
+ test "#index works" do
126
+ CurrentUser.id = 42
127
+ get :index
128
+ CurrentUser.id == nil
129
+ end
82
130
  ```
83
131
 
84
- *Joshua Young*
85
-
132
+ Now re-entering the executor properly save and restore that state.
86
133
 
87
- ## Rails 8.0.3 (September 22, 2025) ##
134
+ *Jean Boussier*
88
135
 
89
- * `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unnecessary reloads with time travel test helpers
136
+ * The new method `ActiveSupport::BacktraceCleaner#first_clean_location`
137
+ returns the first clean location of the caller's call stack, or `nil`.
138
+ Locations are `Thread::Backtrace::Location` objects. Useful when you want to
139
+ report the application-level location where something happened as an object.
90
140
 
91
- *Jan Grodowski*
141
+ *Xavier Noria*
92
142
 
93
- * Fix `ActiveSupport::BroadcastLogger` from executing a block argument for each logger (tagged, info, etc.).
143
+ * FileUpdateChecker and EventedFileUpdateChecker ignore changes in Gem.path now.
94
144
 
95
- *Jared Armstrong*
145
+ *Ermolaev Andrey*, *zzak*
96
146
 
97
- * Make `ActiveSupport::Logger` `#freeze`-friendly.
147
+ * The new method `ActiveSupport::BacktraceCleaner#first_clean_frame` returns
148
+ the first clean frame of the caller's backtrace, or `nil`. Useful when you
149
+ want to report the application-level frame where something happened as a
150
+ string.
98
151
 
99
- *Joshua Young*
152
+ *Xavier Noria*
100
153
 
101
- * Fix `ActiveSupport::HashWithIndifferentAccess#transform_keys!` removing defaults.
154
+ * Always clear `CurrentAttributes` instances.
102
155
 
103
- *Hartley McGuire*
156
+ Previously `CurrentAttributes` instance would be reset at the end of requests.
157
+ Meaning its attributes would be re-initialized.
104
158
 
105
- * Fix `ActiveSupport::HashWithIndifferentAccess#tranform_keys!` to handle collisions.
159
+ This is problematic because it assume these objects don't hold any state
160
+ other than their declared attribute, which isn't always the case, and
161
+ can lead to state leak across request.
106
162
 
107
- If the transformation would result in a key equal to another not yet transformed one,
108
- it would result in keys being lost.
163
+ Now `CurrentAttributes` instances are abandoned at the end of a request,
164
+ and a new instance is created at the start of the next request.
109
165
 
110
- Before:
166
+ *Jean Boussier*, *Janko Marohnić*
111
167
 
112
- ```ruby
113
- >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
114
- => {"c" => 1}
115
- ```
168
+ * Add public API for `before_fork_hook` in parallel testing.
116
169
 
117
- After:
170
+ Introduces a public API for calling the before fork hooks implemented by parallel testing.
118
171
 
119
172
  ```ruby
120
- >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
121
- => {"b" => 1, "c" => 2}
173
+ parallelize_before_fork do
174
+ # perform an action before test processes are forked
175
+ end
122
176
  ```
123
177
 
124
- *Jason T Johnson*, *Jean Boussier*
178
+ *Eileen M. Uchitelle*
125
179
 
126
- **Note on overwrite precedence:**
180
+ * Implement ability to skip creating parallel testing databases.
127
181
 
128
- This fix also changed the overwrite precedence when distinct keys are transformed into the same key.
129
- The later key now overwrites the earlier one (matching standard Ruby `Hash` behavior).
130
- Previously, the earlier key's value was preserved.
182
+ With parallel testing, Rails will create a database per process. If this isn't
183
+ desirable or you would like to implement databases handling on your own, you can
184
+ now turn off this default behavior.
131
185
 
132
- Before:
186
+ To skip creating a database per process, you can change it via the
187
+ `parallelize` method:
133
188
 
134
189
  ```ruby
135
- >> {XY: 1, xy: 2}.with_indifferent_access.transform_keys!(&:downcase)
136
- => {"xy"=>1}
190
+ parallelize(workers: 10, parallelize_databases: false)
137
191
  ```
138
192
 
139
- After:
193
+ or via the application configuration:
140
194
 
141
195
  ```ruby
142
- >> {XY: 1, xy: 2}.with_indifferent_access.transform_keys!(&:downcase)
143
- => {"xy"=>2}
196
+ config.active_support.parallelize_databases = false
144
197
  ```
145
198
 
146
- * Fix `ActiveSupport::Cache::MemCacheStore#read_multi` to handle network errors.
199
+ *Eileen M. Uchitelle*
200
+
201
+ * Allow to configure maximum cache key sizes
147
202
 
148
- This method specifically wasn't handling network errors like other codepaths.
203
+ When the key exceeds the configured limit (250 bytes by default), it will be truncated and
204
+ the digest of the rest of the key appended to it.
149
205
 
150
- *Alessandro Dal Grande*
206
+ Note that previously `ActiveSupport::Cache::RedisCacheStore` allowed up to 1kb cache keys before
207
+ truncation, which is now reduced to 250 bytes.
151
208
 
152
- * Fix configuring `RedisCacheStore` with `raw: true`.
209
+ ```ruby
210
+ config.cache_store = :redis_cache_store, { max_key_size: 64 }
211
+ ```
153
212
 
154
213
  *fatkodima*
155
214
 
156
- * Fix `Enumerable#sole` for infinite collections.
215
+ * Use `UNLINK` command instead of `DEL` in `ActiveSupport::Cache::RedisCacheStore` for non-blocking deletion.
157
216
 
158
- *fatkodima*
217
+ *Aron Roh*
159
218
 
219
+ * Add `Cache#read_counter` and `Cache#write_counter`
160
220
 
161
- ## Rails 8.0.2.1 (August 13, 2025) ##
221
+ ```ruby
222
+ Rails.cache.write_counter("foo", 1)
223
+ Rails.cache.read_counter("foo") # => 1
224
+ Rails.cache.increment("foo")
225
+ Rails.cache.read_counter("foo") # => 2
226
+ ```
162
227
 
163
- * No changes.
228
+ *Alex Ghiculescu*
164
229
 
230
+ * Introduce ActiveSupport::Testing::ErrorReporterAssertions#capture_error_reports
165
231
 
166
- ## Rails 8.0.2 (March 12, 2025) ##
232
+ Captures all reported errors from within the block that match the given
233
+ error class.
167
234
 
168
- * Fix setting `to_time_preserves_timezone` from `new_framework_defaults_8_0.rb`.
235
+ ```ruby
236
+ reports = capture_error_reports(IOError) do
237
+ Rails.error.report(IOError.new("Oops"))
238
+ Rails.error.report(IOError.new("Oh no"))
239
+ Rails.error.report(StandardError.new)
240
+ end
169
241
 
170
- *fatkodima*
242
+ assert_equal 2, reports.size
243
+ assert_equal "Oops", reports.first.error.message
244
+ assert_equal "Oh no", reports.last.error.message
245
+ ```
171
246
 
172
- * Fix Active Support Cache `fetch_multi` when local store is active.
247
+ *Andrew Novoselac*
173
248
 
174
- `fetch_multi` now properly yield to the provided block for missing entries
175
- that have been recorded as such in the local store.
249
+ * Introduce ActiveSupport::ErrorReporter#add_middleware
176
250
 
177
- *Jean Boussier*
251
+ When reporting an error, the error context middleware will be called with the reported error
252
+ and base execution context. The stack may mutate the context hash. The mutated context will
253
+ then be passed to error subscribers. Middleware receives the same parameters as `ErrorReporter#report`.
178
254
 
179
- * Fix execution wrapping to report all exceptions, including `Exception`.
255
+ *Andrew Novoselac*, *Sam Schmidt*
256
+
257
+ * Change execution wrapping to report all exceptions, including `Exception`.
180
258
 
181
259
  If a more serious error like `SystemStackError` or `NoMemoryError` happens,
182
260
  the error reporter should be able to report these kinds of exceptions.
183
261
 
184
262
  *Gannon McGibbon*
185
263
 
186
- * Fix `RedisCacheStore` and `MemCacheStore` to also handle connection pool related errors.
187
-
188
- These errors are rescued and reported to `Rails.error`.
189
-
190
- *Jean Boussier*
191
-
192
- * Fix `ActiveSupport::Cache#read_multi` to respect version expiry when using local cache.
264
+ * `ActiveSupport::Testing::Parallelization.before_fork_hook` allows declaration of callbacks that
265
+ are invoked immediately before forking test workers.
193
266
 
194
- *zzak*
267
+ *Mike Dalessio*
195
268
 
196
- * Fix `ActiveSupport::MessageVerifier` and `ActiveSupport::MessageEncryptor` configuration of `on_rotation` callback.
269
+ * Allow the `#freeze_time` testing helper to accept a date or time argument.
197
270
 
198
271
  ```ruby
199
- verifier.rotate(old_secret).on_rotation { ... }
272
+ Time.current # => Sun, 09 Jul 2024 15:34:49 EST -05:00
273
+ freeze_time Time.current + 1.day
274
+ sleep 1
275
+ Time.current # => Mon, 10 Jul 2024 15:34:49 EST -05:00
200
276
  ```
201
277
 
202
- Now both work as documented.
203
-
204
- *Jean Boussier*
205
-
206
- * Fix `ActiveSupport::MessageVerifier` to always be able to verify both URL-safe and URL-unsafe payloads.
207
-
208
- This is to allow transitioning seemlessly from either configuration without immediately invalidating
209
- all previously generated signed messages.
210
-
211
- *Jean Boussier*, *Florent Beaurain*, *Ali Sepehri*
278
+ *Joshua Young*
212
279
 
213
- * Fix `cache.fetch` to honor the provided expiry when `:race_condition_ttl` is used.
280
+ * `ActiveSupport::JSON` now accepts options
214
281
 
282
+ It is now possible to pass options to `ActiveSupport::JSON`:
215
283
  ```ruby
216
- cache.fetch("key", expires_in: 1.hour, race_condition_ttl: 5.second) do
217
- "something"
218
- end
284
+ ActiveSupport::JSON.decode('{"key": "value"}', symbolize_names: true) # => { key: "value" }
219
285
  ```
220
286
 
221
- In the above example, the final cache entry would have a 10 seconds TTL instead
222
- of the requested 1 hour.
223
-
224
- *Dhia*
225
-
226
- * Better handle procs with splat arguments in `set_callback`.
227
-
228
- *Radamés Roriz*
229
-
230
- * Fix `String#mb_chars` to not mutate the receiver.
287
+ *matthaigh27*
231
288
 
232
- Previously it would call `force_encoding` on the receiver,
233
- now it dups the receiver first.
289
+ * `ActiveSupport::Testing::NotificationAssertions`'s `assert_notification` now matches against payload subsets by default.
234
290
 
235
- *Jean Boussier*
236
-
237
- * Improve `ErrorSubscriber` to also mark error causes as reported.
238
-
239
- This avoid some cases of errors being reported twice, notably in views because of how
240
- errors are wrapped in `ActionView::Template::Error`.
241
-
242
- *Jean Boussier*
243
-
244
- * Fix `Module#module_parent_name` to return the correct name after the module has been named.
245
-
246
- When called on an anonymous module, the return value wouldn't change after the module was given a name
247
- later by being assigned to a constant.
291
+ Previously the following assertion would fail due to excess key vals in the notification payload. Now with payload subset matching, it will pass.
248
292
 
249
293
  ```ruby
250
- mod = Module.new
251
- mod.module_parent_name # => "Object"
252
- MyModule::Something = mod
253
- mod.module_parent_name # => "MyModule"
294
+ assert_notification("post.submitted", title: "Cool Post") do
295
+ ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: "Cool Body")
296
+ end
254
297
  ```
255
298
 
256
- *Jean Boussier*
299
+ Additionally, you can now persist a matched notification for more customized assertions.
257
300
 
301
+ ```ruby
302
+ notification = assert_notification("post.submitted", title: "Cool Post") do
303
+ ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: Body.new("Cool Body"))
304
+ end
258
305
 
259
- ## Rails 8.0.1 (December 13, 2024) ##
260
-
261
- * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
262
-
263
- *Martin Emde*
306
+ assert_instance_of(Body, notification.payload[:body])
307
+ ```
264
308
 
265
- * Restore the ability to decorate methods generated by `class_attribute`.
309
+ *Nicholas La Roux*
266
310
 
267
- It always has been complicated to use Module#prepend or an alias method chain
268
- to decorate methods defined by `class_attribute`, but became even harder in 8.0.
311
+ * Deprecate `String#mb_chars` and `ActiveSupport::Multibyte::Chars`.
269
312
 
270
- This capability is now supported for both reader and writer methods.
313
+ These APIs are a relic of the Ruby 1.8 days when Ruby strings weren't encoding
314
+ aware. There is no legitimate reasons to need these APIs today.
271
315
 
272
316
  *Jean Boussier*
273
317
 
318
+ * Deprecate `ActiveSupport::Configurable`
274
319
 
275
- ## Rails 8.0.0.1 (December 10, 2024) ##
276
-
277
- * No changes.
278
-
320
+ *Sean Doyle*
279
321
 
280
- ## Rails 8.0.0 (November 07, 2024) ##
322
+ * `nil.to_query("key")` now returns `key`.
281
323
 
282
- * No changes.
324
+ Previously it would return `key=`, preventing round tripping with `Rack::Utils.parse_nested_query`.
283
325
 
326
+ *Erol Fornoles*
284
327
 
285
- ## Rails 8.0.0.rc2 (October 30, 2024) ##
286
-
287
- * No changes.
328
+ * Avoid wrapping redis in a `ConnectionPool` when using `ActiveSupport::Cache::RedisCacheStore` if the `:redis`
329
+ option is already a `ConnectionPool`.
288
330
 
331
+ *Joshua Young*
289
332
 
290
- ## Rails 8.0.0.rc1 (October 19, 2024) ##
333
+ * Alter `ERB::Util.tokenize` to return :PLAIN token with full input string when string doesn't contain ERB tags.
291
334
 
292
- * Remove deprecated support to passing an array of strings to `ActiveSupport::Deprecation#warn`.
335
+ *Martin Emde*
293
336
 
294
- *Rafael Mendonça França*
337
+ * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceded by multibyte characters.
295
338
 
296
- * Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
339
+ *Martin Emde*
297
340
 
298
- *Rafael Mendonça França*
341
+ * Add `ActiveSupport::Testing::NotificationAssertions` module to help with testing `ActiveSupport::Notifications`.
299
342
 
300
- * Remove deprecated `ActiveSupport::ProxyObject`.
343
+ *Nicholas La Roux*, *Yishu See*, *Sean Doyle*
301
344
 
302
- *Rafael Mendonça França*
345
+ * `ActiveSupport::CurrentAttributes#attributes` now will return a new hash object on each call.
303
346
 
304
- * Don't execute i18n watcher on boot. It shouldn't catch any file changes initially,
305
- and unnecessarily slows down boot of applications with lots of translations.
347
+ Previously, the same hash object was returned each time that method was called.
306
348
 
307
- *Gannon McGibbon*, *David Stosik*
349
+ *fatkodima*
308
350
 
309
- * Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
351
+ * `ActiveSupport::JSON.encode` supports CIDR notation.
310
352
 
311
353
  Previously:
312
354
 
313
355
  ```ruby
314
- { 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
356
+ ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0\""
315
357
  ```
316
358
 
317
359
  After this change:
318
360
 
319
361
  ```ruby
320
- { 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2
321
- ```
322
-
323
- This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding
324
- to not backport the fix and to make the change in a major release.
325
-
326
- *Jean Boussier*
327
-
328
- ## Rails 8.0.0.beta1 (September 26, 2024) ##
329
-
330
- * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
331
-
332
- *Adam Renberg Tamm*
333
-
334
- * Print test names when running `rails test -v` for parallel tests.
335
-
336
- *John Hawthorn*, *Abeid Ahmed*
337
-
338
- * Deprecate `Benchmark.ms` core extension.
339
-
340
- The `benchmark` gem will become bundled in Ruby 3.5
341
-
342
- *Earlopain*
343
-
344
- * `ActiveSupport::TimeWithZone#inspect` now uses ISO 8601 style time like `Time#inspect`
345
-
346
- *John Hawthorn*
347
-
348
- * `ActiveSupport::ErrorReporter#report` now assigns a backtrace to unraised exceptions.
349
-
350
- Previously reporting an un-raised exception would result in an error report without
351
- a backtrace. Now it automatically generates one.
352
-
353
- *Jean Boussier*
354
-
355
- * Add `escape_html_entities` option to `ActiveSupport::JSON.encode`.
356
-
357
- This allows for overriding the global configuration found at
358
- `ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
359
-
360
- This should be usable from controllers in the following manner:
361
- ```ruby
362
- class MyController < ApplicationController
363
- def index
364
- render json: { hello: "world" }, escape_html_entities: false
365
- end
366
- end
362
+ ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0/24\""
367
363
  ```
368
364
 
369
- *Nigel Baillie*
370
-
371
- * Raise when using key which can't respond to `#to_sym` in `EncryptedConfiguration`.
372
-
373
- As is the case when trying to use an Integer or Float as a key, which is unsupported.
374
-
375
- *zzak*
376
-
377
- * Deprecate addition and since between two `Time` and `ActiveSupport::TimeWithZone`.
378
-
379
- Previously adding time instances together such as `10.days.ago + 10.days.ago` or `10.days.ago.since(10.days.ago)` produced a nonsensical future date. This behavior is deprecated and will be removed in Rails 8.1.
380
-
381
- *Nick Schwaderer*
382
-
383
- * Support rfc2822 format for Time#to_fs & Date#to_fs.
384
-
385
- *Akshay Birajdar*
386
-
387
- * Optimize load time for `Railtie#initialize_i18n`. Filter `I18n.load_path`s passed to the file watcher to only those
388
- under `Rails.root`. Previously the watcher would grab all available locales, including those in gems
389
- which do not require a watcher because they won't change.
390
-
391
- *Nick Schwaderer*
392
-
393
- * Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
394
- by these values.
395
-
396
- *Igor Depolli*
397
-
398
- * Improve error message when using `assert_difference` or `assert_changes` with a
399
- proc by printing the proc's source code (MRI only).
400
-
401
- *Richard Böhme*, *Jean Boussier*
402
-
403
- * Add a new configuration value `:zone` for `ActiveSupport.to_time_preserves_timezone` and rename the previous `true` value to `:offset`. The new default value is `:zone`.
404
-
405
- *Jason Kim*, *John Hawthorn*
406
-
407
- * Align instrumentation `payload[:key]` in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.
408
-
409
- *Frederik Erbs Spang Thomsen*
365
+ *Taketo Takashima*
410
366
 
411
- * Fix `travel_to` to set usec 0 when `with_usec` is `false` and the given argument String or DateTime.
367
+ * Make `ActiveSupport::FileUpdateChecker` faster when checking many file-extensions.
412
368
 
413
- *mopp*
369
+ *Jonathan del Strother*
414
370
 
415
- Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activesupport/CHANGELOG.md) for previous changes.
371
+ Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activesupport/CHANGELOG.md) for previous changes.