solid_objects 0.7.1 → 0.7.2
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 +4 -4
- data/CHANGELOG.md +13 -0
- data/app/controllers/solid_objects/components_controller.rb +30 -8
- data/docs/realtime.md +14 -0
- data/docs/roadmap.md +27 -6
- data/lib/solid_objects/component_renderer.rb +1 -0
- data/lib/solid_objects/version.rb +1 -1
- data/sig/generated/controllers/solid_objects/components_controller.rbs +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c9697331316791269c98ec881f02a59e7556c2ab2abf98c3feb662e5f8cf742
|
|
4
|
+
data.tar.gz: 12b0390bfcceca1362e7e1779bcb1562ea2e640259ca9ccefac9835b0b2d9a2e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1acdc877187c455dee2843527e8826a719ab66c2f3917233eb1d565c19b6662a9fd6d319213f3340ada04e60f2d299dff8ad675de8762f65e336630a40b7ef79
|
|
7
|
+
data.tar.gz: f69a34ac8c724164ec597ad3b78637d8537c1d76a527998aa50fa9f7bd7c3327244449be9555a2214c2a9ae7f019e119b5f35c58ad2d28528ea824aad0a0f538
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.2 - 2026-08-09
|
|
4
|
+
|
|
5
|
+
- Render batched component partials as HTML regardless of the request format.
|
|
6
|
+
The batch endpoint is requested with a JSON `Accept` header, so Rails looked
|
|
7
|
+
for JSON templates, raised `ActionView::MissingTemplate`, and the batch
|
|
8
|
+
returned 404 for applications whose components are ordinary
|
|
9
|
+
`.html.erb` partials. The outer response is still JSON. Single-component
|
|
10
|
+
refresh was never affected and is unchanged.
|
|
11
|
+
- Pass `registrations:` to `component_authorization_context`: one registration
|
|
12
|
+
for a single refresh, all of them for a batch, so applications no longer have
|
|
13
|
+
to inspect `params[:tokens]`. Callbacks accepting only `controller:` keep
|
|
14
|
+
working unchanged.
|
|
15
|
+
|
|
3
16
|
## 0.7.1 - 2026-08-09
|
|
4
17
|
|
|
5
18
|
- Retry a contended SQLite write outside a synchronous deadline. Asynchronous
|
|
@@ -43,10 +43,7 @@ module SolidObjects
|
|
|
43
43
|
return head :conflict
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
authorization_context =
|
|
47
|
-
.configuration
|
|
48
|
-
.component_authorization_context
|
|
49
|
-
.call(controller: self)
|
|
46
|
+
authorization_context = component_authorization_context(registrations)
|
|
50
47
|
frames = registrations.map do |registration|
|
|
51
48
|
rendered = ComponentRenderer.new(
|
|
52
49
|
snapshot:,
|
|
@@ -112,10 +109,7 @@ module SolidObjects
|
|
|
112
109
|
return head :conflict
|
|
113
110
|
end
|
|
114
111
|
|
|
115
|
-
authorization_context =
|
|
116
|
-
.configuration
|
|
117
|
-
.component_authorization_context
|
|
118
|
-
.call(controller: self)
|
|
112
|
+
authorization_context = component_authorization_context([ registration ])
|
|
119
113
|
rendered = ComponentRenderer.new(
|
|
120
114
|
snapshot:,
|
|
121
115
|
registration:,
|
|
@@ -138,6 +132,34 @@ module SolidObjects
|
|
|
138
132
|
head :bad_request
|
|
139
133
|
end
|
|
140
134
|
|
|
135
|
+
# Callbacks written before batching accept only `controller:`. Those keep
|
|
136
|
+
# working; a callback that also accepts `registrations:` receives one
|
|
137
|
+
# registration for a single refresh and all of them for a batch.
|
|
138
|
+
# @rbs (Array[ComponentRegistration]) -> untyped
|
|
139
|
+
def component_authorization_context(registrations)
|
|
140
|
+
callable = SolidObjects.configuration.component_authorization_context
|
|
141
|
+
return callable.call(controller: self) unless accepts_registrations?(callable)
|
|
142
|
+
|
|
143
|
+
callable.call(controller: self, registrations:)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# A lambda answers `parameters` directly; a callable object answers it
|
|
147
|
+
# through its `call` method.
|
|
148
|
+
# @rbs (untyped) -> bool
|
|
149
|
+
def accepts_registrations?(callable)
|
|
150
|
+
callable_parameters(callable).any? do |type, name|
|
|
151
|
+
type == :keyrest || (%i[key keyreq].include?(type) && name == :registrations)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# @rbs (untyped) -> Array[[ Symbol, Symbol ]]
|
|
156
|
+
def callable_parameters(callable)
|
|
157
|
+
return callable.parameters if callable.respond_to?(:parameters)
|
|
158
|
+
return callable.method(:call).parameters if callable.respond_to?(:call)
|
|
159
|
+
|
|
160
|
+
[]
|
|
161
|
+
end
|
|
162
|
+
|
|
141
163
|
# @rbs (ComponentRegistration) -> Hash[Symbol, untyped]
|
|
142
164
|
def registration_payload(registration)
|
|
143
165
|
{
|
data/docs/realtime.md
CHANGED
|
@@ -290,6 +290,20 @@ commonly resolve it to `Current.user`:
|
|
|
290
290
|
configuration.component_authorization_context = ->(controller:) { Current.user }
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
+
A callback may also accept `registrations:`, which receives one registration for
|
|
294
|
+
a single component refresh and every registration in the group for a batch
|
|
295
|
+
refresh. This avoids decoding `params[:tokens]` by hand when a policy depends on
|
|
296
|
+
which components were requested:
|
|
297
|
+
|
|
298
|
+
```ruby
|
|
299
|
+
configuration.component_authorization_context = lambda do |controller:, registrations:|
|
|
300
|
+
Current.user if registrations.all? { |registration| registration.component_key == controller.session[:seat] }
|
|
301
|
+
end
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Callbacks that accept only `controller:` continue to work; the extra keyword is
|
|
305
|
+
passed only to callables that declare it.
|
|
306
|
+
|
|
293
307
|
The three contexts are intentionally different:
|
|
294
308
|
|
|
295
309
|
| Boundary | Authorization context |
|
data/docs/roadmap.md
CHANGED
|
@@ -17,18 +17,26 @@
|
|
|
17
17
|
- One-shot and recurring reminders with `:latest` or `:all` catch-up
|
|
18
18
|
- Durable observable invalidations, scalar Turbo replacement, keyed ERB
|
|
19
19
|
components, signed component locals, and authorized replace or morph refresh
|
|
20
|
+
- Batched component refreshes: components sharing a signed `batch:` collapse to
|
|
21
|
+
one browser request per revision, served as HTML frames in a JSON envelope
|
|
22
|
+
- Personalized state payload broadcasts computed per subscriber under that
|
|
23
|
+
subscriber's authorization context, fenced by actor revision
|
|
20
24
|
- Reconciliation read APIs
|
|
21
25
|
- Installation doctor, authorization reference, fit guide, and legacy-state
|
|
22
26
|
migration cookbook
|
|
23
27
|
- Handler Active Record write isolation, same-database commit actions, ambient
|
|
24
|
-
transaction rejection, adapter lock/query deadlines,
|
|
25
|
-
diagnostics, and
|
|
28
|
+
transaction rejection, adapter lock/query deadlines, bounded SQLite lock
|
|
29
|
+
retries outside those deadlines, structured sync timeout diagnostics, and
|
|
30
|
+
result recovery
|
|
26
31
|
- Bounded message/process pruning, actor-type opt-in instance expiration,
|
|
27
32
|
graceful caller shutdown, committed state snapshots, and an opt-in Minitest
|
|
28
33
|
helper
|
|
29
34
|
- SQLite, PostgreSQL, and MySQL integration suites
|
|
30
35
|
- Inline RBS generation/validation, Steep, Standard Ruby, Solid Queue's exact
|
|
31
36
|
RuboCop policy, and a warning-free Brakeman scan
|
|
37
|
+
- A JavaScript suite covering the state payload and batched refresh browser
|
|
38
|
+
modules, run in CI with Node's test runner and jsdom, with every GitHub
|
|
39
|
+
Actions reference pinned to a commit SHA
|
|
32
40
|
|
|
33
41
|
## Partially implemented
|
|
34
42
|
|
|
@@ -36,14 +44,24 @@
|
|
|
36
44
|
role or run periodic maintenance automatically.
|
|
37
45
|
- Wake-up strategy: in-process signaling plus durable polling and injection are
|
|
38
46
|
implemented; PostgreSQL `LISTEN/NOTIFY` and optional Redis adapters are not.
|
|
47
|
+
Signaling cannot cross process boundaries, so a commit in a web process does
|
|
48
|
+
not wake a broadcast executor in a worker process; that delivery waits up to
|
|
49
|
+
`polling_interval`, 100 ms by default. This is the largest remaining term in
|
|
50
|
+
reactive update latency, and neither batching nor state payloads reduce it.
|
|
39
51
|
- Realtime: scalar and dependency-driven keyed ERB component replacement or
|
|
40
52
|
morphing, personalized refresh authorization, revision fencing, coalescing,
|
|
41
|
-
|
|
42
|
-
append intents are not.
|
|
53
|
+
reconnect convergence, batched refreshes, and personalized state payloads are
|
|
54
|
+
implemented; application-directed Turbo append intents are not. Batch
|
|
55
|
+
coalescing happens in the browser rather than the broadcast executor, so one
|
|
56
|
+
commit still sends one Action Cable message per changed observable even
|
|
57
|
+
though it costs one browser request.
|
|
43
58
|
- Backpressure: mailbox/payload/state/result caps and fair yields exist;
|
|
44
59
|
distributed per-actor rate limits and global admission control do not.
|
|
45
60
|
- Administration: actor and dead-letter views plus policy hooks exist; richer
|
|
46
61
|
filtering, audit records, and bulk-safe tools do not.
|
|
62
|
+
- Browser module coverage: the state payload and batched refresh modules have
|
|
63
|
+
JavaScript tests; `component_refresh.js`, which drives individual morph
|
|
64
|
+
refreshes, does not.
|
|
47
65
|
- Outboxes use portable status rows with polling indexes; future versions may
|
|
48
66
|
introduce narrow ready/claimed membership tables for very large outboxes.
|
|
49
67
|
|
|
@@ -51,7 +69,8 @@
|
|
|
51
69
|
|
|
52
70
|
1. Add automatic supervisor role replacement and periodic dead-process cleanup.
|
|
53
71
|
2. Add PostgreSQL notification and optional Redis wake-up adapters with latency
|
|
54
|
-
benchmarks and polling-race tests
|
|
72
|
+
benchmarks and polling-race tests, removing the cross-process polling delay
|
|
73
|
+
rather than shrinking it with a smaller `polling_interval`.
|
|
55
74
|
3. Add result lookup by request ID and broader deadlock retry classification.
|
|
56
75
|
4. Add scheduled retention and stale-process maintenance.
|
|
57
76
|
5. Add database/server-version checks and MySQL InnoDB verification at boot.
|
|
@@ -61,7 +80,9 @@
|
|
|
61
80
|
8. Expand security scanning and run compatibility CI across supported Rails and
|
|
62
81
|
Ruby versions.
|
|
63
82
|
9. Benchmark all workloads under documented hardware/database settings and
|
|
64
|
-
publish adapter-specific adoption measurements.
|
|
83
|
+
publish adapter-specific adoption measurements. Throughput, synchronous
|
|
84
|
+
latency, query counts, and the three reactive delivery paths are measured on
|
|
85
|
+
SQLite; adapter-specific and end-to-end browser measurements are not.
|
|
65
86
|
|
|
66
87
|
No production-ready claim should be made until these hardening milestones have
|
|
67
88
|
operational soak evidence.
|
|
@@ -21,6 +21,20 @@ module SolidObjects
|
|
|
21
21
|
# @rbs (Hash[Symbol, untyped]) -> void
|
|
22
22
|
def refresh: (Hash[Symbol, untyped]) -> void
|
|
23
23
|
|
|
24
|
+
# Callbacks written before batching accept only `controller:`. Those keep
|
|
25
|
+
# working; a callback that also accepts `registrations:` receives one
|
|
26
|
+
# registration for a single refresh and all of them for a batch.
|
|
27
|
+
# @rbs (Array[ComponentRegistration]) -> untyped
|
|
28
|
+
def component_authorization_context: (Array[ComponentRegistration]) -> untyped
|
|
29
|
+
|
|
30
|
+
# A lambda answers `parameters` directly; a callable object answers it
|
|
31
|
+
# through its `call` method.
|
|
32
|
+
# @rbs (untyped) -> bool
|
|
33
|
+
def accepts_registrations?: (untyped) -> bool
|
|
34
|
+
|
|
35
|
+
# @rbs (untyped) -> Array[[ Symbol, Symbol ]]
|
|
36
|
+
def callable_parameters: (untyped) -> Array[[ Symbol, Symbol ]]
|
|
37
|
+
|
|
24
38
|
# @rbs (ComponentRegistration) -> Hash[Symbol, untyped]
|
|
25
39
|
def registration_payload: (ComponentRegistration) -> Hash[Symbol, untyped]
|
|
26
40
|
|