activesupport 8.0.2.1 → 8.1.1

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