phlex-reactive 0.13.0 → 0.13.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.
@@ -712,6 +712,41 @@ module Phlex
712
712
  defined?(::ActiveJob::Base) ? true : false
713
713
  end
714
714
 
715
+ # --- Async-action lifecycle / settles (issue #248) -----------------
716
+
717
+ # NOTE: there is deliberately NO settle_token_ttl. Issue #248's sketch had
718
+ # one for a fallback PULL token, but a settle has no pull lane at all — the
719
+ # client cannot poll "is the job done yet", and redeeming such a token at
720
+ # the defer endpoint would render the PRE-JOB component, which is the exact
721
+ # bug reply.pending exists to fix. A setting that cannot change behavior is
722
+ # worse than no setting: it tells an operator they can extend a wait window
723
+ # that is not governed by a token in the first place. The settle's wait is
724
+ # bounded by the JOB, not by a TTL.
725
+
726
+ # Window (ms) the AGGREGATE settle streams coalesce on — the count
727
+ # companion, the empty-state toggle, any companion refresh. They are
728
+ # idempotent replaces of stable targets, so a 177-row fan-out collapses to
729
+ # a handful of them instead of 177. The ROW streams are never coalesced.
730
+ # Needs pgbus with zoolutions/pgbus#465 on the peers path; without it the
731
+ # window is simply ignored. nil resets to the default.
732
+ attr_writer :settle_coalesce_window_ms
733
+
734
+ def settle_coalesce_window_ms
735
+ @settle_coalesce_window_ms ||= 50
736
+ end
737
+
738
+ # Can reply.pending mint a settle handle at all? A settle has NO pull
739
+ # fallback — the client cannot poll "is the job done yet" — so it needs
740
+ # the defer PUSH lane (durable pgbus one-shot stream + ActiveJob). A
741
+ # forced defer_transport of :fetch is therefore also a no.
742
+ #
743
+ # False does NOT break anything: reply.pending degrades to a plain
744
+ # enqueue (no pending markers, no handle, reactive_settle no-ops in the
745
+ # job) — today's behavior, never a permanently pending row.
746
+ def settle_capable?
747
+ defer_push_capable? && defer_transport != :fetch
748
+ end
749
+
715
750
  # DOM id of the host-app container a Response#flash appends into.
716
751
  # Default "flash"; override to match your layout's flash region.
717
752
  def flash_target
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-reactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -153,6 +153,7 @@ files:
153
153
  - lib/phlex/reactive/authorization.rb
154
154
  - lib/phlex/reactive/claude/skills/phlex-reactive-debugging/SKILL.md
155
155
  - lib/phlex/reactive/client_bindings.rb
156
+ - lib/phlex/reactive/collections.rb
156
157
  - lib/phlex/reactive/component.rb
157
158
  - lib/phlex/reactive/component/dsl.rb
158
159
  - lib/phlex/reactive/component/helpers.rb
@@ -178,8 +179,11 @@ files:
178
179
  - lib/phlex/reactive/mcp/tools/doctor_tool.rb
179
180
  - lib/phlex/reactive/mcp/tools/find_tool.rb
180
181
  - lib/phlex/reactive/param_schema.rb
182
+ - lib/phlex/reactive/pending.rb
181
183
  - lib/phlex/reactive/reply.rb
182
184
  - lib/phlex/reactive/response.rb
185
+ - lib/phlex/reactive/settle.rb
186
+ - lib/phlex/reactive/settles.rb
183
187
  - lib/phlex/reactive/show_conditions.rb
184
188
  - lib/phlex/reactive/stream.rb
185
189
  - lib/phlex/reactive/streamable.rb