actionpack 8.0.4.1 → 8.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56c9a5bb5fecff6688e9769fc32a9e4ae9400700c9e9059f654c0d286ef53941
4
- data.tar.gz: 05f6cdd661fae12b4da50bed7c863720fe9aae79673324ba596bd85f9b9ae1f6
3
+ metadata.gz: 2effaa8c37f91de6cda898c8ebb9857da735e8c2064c46473f4bd52caa70466c
4
+ data.tar.gz: c42b8c6737bce6b429ea71f66a86fcdc7cd468887c110829b527296d253adbd5
5
5
  SHA512:
6
- metadata.gz: d7c75cb9c14e8bdf0a96465d506cf644a6ddf1bd580a3beff1e95e9859a8c0d4a06ab24dfca786386cdf8964451996bdf31ff041f3295734921e512d2a05af5d
7
- data.tar.gz: ccf3cd6ad220aca06944695be9fbf22a15de5bcedce1e9e86d4645453ae86b103473ce06bf326b74c7d669f7b4fe7f88138790819817f82841c4af1541ba9a57
6
+ metadata.gz: 8b23a24307dd4d5ffb5d2ac31618809026d8b9620b27382a7b23d321648796b45f6e90d199117b4cc69b39db4d6558ad3dbef075ce5e5543043c57ae5f5cda25
7
+ data.tar.gz: ace10e1524236d4cb72929262e3222c35a09a7abad52bc86b49abf979331261bdbd8860723afe96bc7e98e5a819b5cd62a1fd42f6ce7e31039b399facb61c409
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## Rails 8.0.5 (March 24, 2026) ##
2
+
3
+ * Add `config.action_controller.live_streaming_excluded_keys` to control execution state sharing in ActionController::Live.
4
+
5
+ When using ActionController::Live, actions are executed in a separate thread that shares
6
+ state from the parent thread. This new configuration allows applications to opt-out specific
7
+ state keys that should not be shared.
8
+
9
+ This is useful when streaming inside a `connected_to` block, where you may want
10
+ the streaming thread to use its own database connection context.
11
+
12
+ ```ruby
13
+ # config/application.rb
14
+ config.action_controller.live_streaming_excluded_keys = [:active_record_connected_to_stack]
15
+ ```
16
+
17
+ By default, all keys are shared.
18
+
19
+ *Eileen M. Uchitelle*
20
+
21
+
1
22
  ## Rails 8.0.4.1 (March 23, 2026) ##
2
23
 
3
24
  * No changes.
@@ -53,9 +53,50 @@ module ActionController
53
53
  # response.headers["Last-Modified"] = Time.now.httpdate # Add this line if your Rack version is 2.2.x
54
54
  # ...
55
55
  # end
56
+ #
57
+ # ## Streaming and Execution State
58
+ #
59
+ # When streaming, the action is executed in a separate thread. By default, this thread
60
+ # shares execution state from the parent thread.
61
+ #
62
+ # You can configure which execution state keys should be excluded from being shared
63
+ # using the `config.action_controller.live_streaming_excluded_keys` configuration:
64
+ #
65
+ # # config/application.rb
66
+ # config.action_controller.live_streaming_excluded_keys = [:active_record_connected_to_stack]
67
+ #
68
+ # This is useful when using ActionController::Live inside a `connected_to` block. For example,
69
+ # if the parent request is reading from a replica using `connected_to(role: :reading)`, you may
70
+ # want the streaming thread to use its own connection context instead of inheriting the read-only
71
+ # context:
72
+ #
73
+ # # Without configuration, streaming thread inherits read-only connection
74
+ # ActiveRecord::Base.connected_to(role: :reading) do
75
+ # @posts = Post.all
76
+ # render stream: true # Streaming thread cannot write to database
77
+ # end
78
+ #
79
+ # # With configuration, streaming thread gets fresh connection context
80
+ # # config.action_controller.live_streaming_excluded_keys = [:active_record_connected_to_stack]
81
+ # ActiveRecord::Base.connected_to(role: :reading) do
82
+ # @posts = Post.all
83
+ # render stream: true # Streaming thread can write to database if needed
84
+ # end
85
+ #
86
+ # Common keys you might want to exclude:
87
+ # - `:active_record_connected_to_stack` - Database connection routing and roles
88
+ # - `:active_record_prohibit_shard_swapping` - Shard swapping restrictions
89
+ #
90
+ # By default, no keys are excluded to maintain backward compatibility.
56
91
  module Live
57
92
  extend ActiveSupport::Concern
58
93
 
94
+ mattr_accessor :live_streaming_excluded_keys, default: []
95
+
96
+ included do
97
+ class_attribute :live_streaming_excluded_keys, instance_accessor: false, default: Live.live_streaming_excluded_keys
98
+ end
99
+
59
100
  module ClassMethods
60
101
  def make_response!(request)
61
102
  if (request.get_header("SERVER_PROTOCOL") || request.get_header("HTTP_VERSION")) == "HTTP/1.0"
@@ -282,7 +323,7 @@ module ActionController
282
323
  # Since we're processing the view in a different thread, copy the thread locals
283
324
  # from the main thread to the child thread. :'(
284
325
  locals.each { |k, v| t2[k] = v }
285
- ActiveSupport::IsolatedExecutionState.share_with(t1)
326
+ ActiveSupport::IsolatedExecutionState.share_with(t1, except: self.class.live_streaming_excluded_keys)
286
327
 
287
328
  begin
288
329
  super(name)
@@ -31,6 +31,10 @@ module ActionController
31
31
  ActionController::Helpers.helpers_path = app.helpers_paths
32
32
  end
33
33
 
34
+ initializer "action_controller.live_streaming_excluded_keys" do |app|
35
+ ActionController::Live.live_streaming_excluded_keys = app.config.action_controller.live_streaming_excluded_keys
36
+ end
37
+
34
38
  initializer "action_controller.parameters_config" do |app|
35
39
  options = app.config.action_controller
36
40
 
@@ -80,6 +84,7 @@ module ActionController
80
84
  :action_on_unpermitted_parameters,
81
85
  :always_permitted_parameters,
82
86
  :wrap_parameters_by_default,
87
+ :live_streaming_excluded_keys
83
88
  )
84
89
 
85
90
  filtered_options.each do |k, v|
@@ -65,7 +65,7 @@ module ActionDispatch
65
65
  content_type = Mime[:text]
66
66
  end
67
67
 
68
- if request.head?
68
+ if request.raw_request_method == "HEAD"
69
69
  render(wrapper.status_code, "", content_type)
70
70
  elsif api_request?(content_type)
71
71
  render_for_api_request(content_type, wrapper)
@@ -184,7 +184,7 @@ module ActionDispatch
184
184
  # Returns `true` if the session is mimicking a secure HTTPS request.
185
185
  #
186
186
  # if session.https?
187
- # ...
187
+ # # ...
188
188
  # end
189
189
  def https?
190
190
  @https
@@ -203,7 +203,7 @@ module ActionDispatch
203
203
  # * `env`: Additional env to pass, as a Hash. The headers will be merged into
204
204
  # the Rack env hash.
205
205
  # * `xhr`: Set to `true` if you want to make an Ajax request. Adds request
206
- # headers characteristic of XMLHttpRequest e.g. HTTP_X_REQUESTED_WITH. The
206
+ # headers characteristic of `XMLHttpRequest`, e.g. `HTTP_X_REQUESTED_WITH`. The
207
207
  # headers will be merged into the Rack env hash.
208
208
  # * `as`: Used for encoding the request with different content type. Supports
209
209
  # `:json` by default and will set the appropriate request headers. The
@@ -218,9 +218,10 @@ module ActionDispatch
218
218
  # This method returns the response status, after performing the request.
219
219
  # Furthermore, if this method was called from an ActionDispatch::IntegrationTest
220
220
  # object, then that object's `@response` instance variable will point to a
221
- # Response object which one can use to inspect the details of the response.
221
+ # ActionDispatch::TestResponse object which one can use to inspect the details of the response.
222
222
  #
223
223
  # Example:
224
+ #
224
225
  # process :get, '/author', params: { since: 201501011400 }
225
226
  def process(method, path, params: nil, headers: nil, env: nil, xhr: false, as: nil)
226
227
  request_encoder = RequestEncoder.encoder(as)
@@ -11,8 +11,8 @@ module ActionPack
11
11
  module VERSION
12
12
  MAJOR = 8
13
13
  MINOR = 0
14
- TINY = 4
15
- PRE = "1"
14
+ TINY = 5
15
+ PRE = nil
16
16
 
17
17
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.4.1
4
+ version: 8.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 8.0.4.1
18
+ version: 8.0.5
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 8.0.4.1
25
+ version: 8.0.5
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: nokogiri
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -127,28 +127,28 @@ dependencies:
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 8.0.4.1
130
+ version: 8.0.5
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 8.0.4.1
137
+ version: 8.0.5
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: activemodel
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 8.0.4.1
144
+ version: 8.0.5
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - '='
150
150
  - !ruby/object:Gem::Version
151
- version: 8.0.4.1
151
+ version: 8.0.5
152
152
  description: Web apps on Rails. Simple, battle-tested conventions for building and
153
153
  testing MVC web applications. Works with any Rack-compatible server.
154
154
  email: david@loudthinking.com
@@ -349,10 +349,10 @@ licenses:
349
349
  - MIT
350
350
  metadata:
351
351
  bug_tracker_uri: https://github.com/rails/rails/issues
352
- changelog_uri: https://github.com/rails/rails/blob/v8.0.4.1/actionpack/CHANGELOG.md
353
- documentation_uri: https://api.rubyonrails.org/v8.0.4.1/
352
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.5/actionpack/CHANGELOG.md
353
+ documentation_uri: https://api.rubyonrails.org/v8.0.5/
354
354
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
355
- source_code_uri: https://github.com/rails/rails/tree/v8.0.4.1/actionpack
355
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.5/actionpack
356
356
  rubygems_mfa_required: 'true'
357
357
  rdoc_options: []
358
358
  require_paths: