@adonis-agora/durable 0.45.0 → 0.46.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 (92) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/assets/spa/assets/index-CL6q2kMB.js +16 -0
  3. package/dist/assets/spa/assets/index-CL6q2kMB.js.map +1 -0
  4. package/dist/assets/spa/index.html +1 -1
  5. package/dist/src/admission-redis/redis-admission-backend.d.ts +1 -0
  6. package/dist/src/admission-redis/redis-admission-backend.d.ts.map +1 -1
  7. package/dist/src/admission-redis/redis-admission-backend.js +4 -1
  8. package/dist/src/admission-redis/redis-admission-backend.js.map +1 -1
  9. package/dist/src/codec-state-store.d.ts +9 -1
  10. package/dist/src/codec-state-store.d.ts.map +1 -1
  11. package/dist/src/codec-state-store.js +20 -0
  12. package/dist/src/codec-state-store.js.map +1 -1
  13. package/dist/src/commands/worker.d.ts.map +1 -1
  14. package/dist/src/commands/worker.js +2 -0
  15. package/dist/src/commands/worker.js.map +1 -1
  16. package/dist/src/completion.d.ts +2 -0
  17. package/dist/src/completion.d.ts.map +1 -1
  18. package/dist/src/completion.js +5 -0
  19. package/dist/src/completion.js.map +1 -1
  20. package/dist/src/control-plane-redis/redis-control-plane.d.ts.map +1 -1
  21. package/dist/src/control-plane-redis/redis-control-plane.js +3 -2
  22. package/dist/src/control-plane-redis/redis-control-plane.js.map +1 -1
  23. package/dist/src/dashboard/index.d.ts +1 -1
  24. package/dist/src/dashboard/index.js +1 -1
  25. package/dist/src/diagnostics-bridge.d.ts +4 -1
  26. package/dist/src/diagnostics-bridge.d.ts.map +1 -1
  27. package/dist/src/diagnostics-bridge.js +9 -3
  28. package/dist/src/diagnostics-bridge.js.map +1 -1
  29. package/dist/src/engine.d.ts +50 -1
  30. package/dist/src/engine.d.ts.map +1 -1
  31. package/dist/src/engine.js +178 -47
  32. package/dist/src/engine.js.map +1 -1
  33. package/dist/src/errors.d.ts +16 -1
  34. package/dist/src/errors.d.ts.map +1 -1
  35. package/dist/src/errors.js +4 -1
  36. package/dist/src/errors.js.map +1 -1
  37. package/dist/src/fan-join.d.ts +61 -0
  38. package/dist/src/fan-join.d.ts.map +1 -0
  39. package/dist/src/fan-join.js +97 -0
  40. package/dist/src/fan-join.js.map +1 -0
  41. package/dist/src/index.d.ts +2 -1
  42. package/dist/src/index.d.ts.map +1 -1
  43. package/dist/src/index.js +2 -1
  44. package/dist/src/index.js.map +1 -1
  45. package/dist/src/interfaces.d.ts +58 -9
  46. package/dist/src/interfaces.d.ts.map +1 -1
  47. package/dist/src/interfaces.js.map +1 -1
  48. package/dist/src/run-waiting.d.ts +6 -1
  49. package/dist/src/run-waiting.d.ts.map +1 -1
  50. package/dist/src/run-waiting.js +19 -0
  51. package/dist/src/run-waiting.js.map +1 -1
  52. package/dist/src/safe-subscribe.d.ts +11 -0
  53. package/dist/src/safe-subscribe.d.ts.map +1 -0
  54. package/dist/src/safe-subscribe.js +24 -0
  55. package/dist/src/safe-subscribe.js.map +1 -0
  56. package/dist/src/scheduler.d.ts +1 -1
  57. package/dist/src/scheduler.d.ts.map +1 -1
  58. package/dist/src/scheduler.js +4 -0
  59. package/dist/src/scheduler.js.map +1 -1
  60. package/dist/src/schedules.d.ts +2 -0
  61. package/dist/src/schedules.d.ts.map +1 -1
  62. package/dist/src/schedules.js +4 -0
  63. package/dist/src/schedules.js.map +1 -1
  64. package/dist/src/stores/lucid.d.ts +4 -1
  65. package/dist/src/stores/lucid.d.ts.map +1 -1
  66. package/dist/src/stores/lucid.js +62 -0
  67. package/dist/src/stores/lucid.js.map +1 -1
  68. package/dist/src/telescope/data-providers.d.ts.map +1 -1
  69. package/dist/src/telescope/data-providers.js +13 -3
  70. package/dist/src/telescope/data-providers.js.map +1 -1
  71. package/dist/src/testing/in-memory-state-store.d.ts +4 -1
  72. package/dist/src/testing/in-memory-state-store.d.ts.map +1 -1
  73. package/dist/src/testing/in-memory-state-store.js +18 -0
  74. package/dist/src/testing/in-memory-state-store.js.map +1 -1
  75. package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
  76. package/dist/src/testing-kit/state-store-conformance.js +105 -0
  77. package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
  78. package/dist/src/transports/bullmq/bullmq-transport.d.ts +10 -0
  79. package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
  80. package/dist/src/transports/bullmq/bullmq-transport.js +48 -10
  81. package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
  82. package/dist/src/transports/factory.d.ts +9 -0
  83. package/dist/src/transports/factory.d.ts.map +1 -1
  84. package/dist/src/transports/factory.js +2 -0
  85. package/dist/src/transports/factory.js.map +1 -1
  86. package/dist/src/workflow-ctx.d.ts.map +1 -1
  87. package/dist/src/workflow-ctx.js +214 -70
  88. package/dist/src/workflow-ctx.js.map +1 -1
  89. package/package.json +5 -5
  90. package/skills/durable-workflows/SKILL.md +4 -1
  91. package/dist/assets/spa/assets/index-BCFDK6g_.js +0 -16
  92. package/dist/assets/spa/assets/index-BCFDK6g_.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @adonis-agora/durable
2
2
 
3
+ ## 0.46.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(deps): update dependency @adonis-agora/filter to v0.11.0 ([#326](https://github.com/DavideCarvalho/adonis-agora-durable/issues/326))
8
+
9
+ ## 0.46.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#321](https://github.com/DavideCarvalho/adonis-agora-durable/pull/321) [`1dcbdc6`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/1dcbdc642ab781ed0313b890c9c30342af893118) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Shutdown fixes. No unhandled "Connection is closed." when closing while pub/sub subscriptions are still connecting (BullMQ transport, Redis control plane, Redis admission backend): the rejection is ignored once closing has begun, otherwise sent to the transport's `onError` or logged. `BullMQTransport.close()` closes workers first, then queues, under one `closeTimeoutMs` deadline (default 5000, `0` skips the wait; also available on `transports.bullmq()`, which now forwards `onError` too) and always disconnects, so an in-flight step can still publish its result. New `WorkflowEngine.beginDrain()` (called by `drain()` and by the worker loop the moment a stop is requested) sets `draining`: recovery, timer, pending, schedule and timeout sweeps stop locking or starting runs mid-tick, and `runOne` refuses broker-delivered runs.
14
+
15
+ - [#320](https://github.com/DavideCarvalho/adonis-agora-durable/pull/320) [`27579ca`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/27579ca668c419ac0cc67686da7e7ed2400d37f1) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - `ctx.all` costs O(N) for a fan of N children, sends wide fans in batches, can cap how many children run at once, and folds a settled fan into one checkpoint
16
+
17
+ Previously every settled child could wake the parent, and each wake replayed the whole fan: the parent re-registered a waiter (`putSignalWaiter`), took any buffered completion (`takeBufferedSignal`) and looked up the run (`getRun`) for every child still out. In the in-memory store, a 200-child fan whose children settle one at a time went from 22 parent replays, 1,142 `putSignalWaiter`, 1,163 `takeBufferedSignal` and 1,587 `getRun` calls to 1 replay, 0, 0 and 603. A settled 1,000-child fan now leaves the parent 1 checkpoint row instead of 1,000.
18
+
19
+ - **Join barrier.** A settling child no longer wakes the parent while siblings in the same fan still have waiters. The last child to settle wakes it. A failed child of a `failFast` fan still wakes it immediately.
20
+ - **Batched dispatch.** The fan is registered 500 children at a time through the new `StateStore.registerChildWaits`, which writes the waiters and the `running` placeholders in one transaction. Its existing checkpoints are read with one prefix query instead of one lookup per child, and the first dispatch no longer looks up each child's run or buffered completion. A child that already ran to completion under its fan id is still delivered: the deferred start that finds it settled re-delivers its completion to the waiter. Sending a 1,200-child fan takes 3 store writes and 1 read from the parent.
21
+ - **`concurrency` option.** `ctx.all(wf, inputs, { concurrency: 1000 })` keeps at most 1,000 children running. They go out in waves of `floor(concurrency / 2)`, two waves at a time (an odd limit runs one child under it), and the parent sends the next wave as soon as one settles. Wave children carry the wave in their id (`<runId>.all.<firstSeq>.w<k>.<i>`). A limit at or above the fan size keeps the unbounded ids. A non-positive or fractional limit fails the run.
22
+ - **Folding settled fans.** Once a fan of 100+ children (or one wave of it) settles with every child successful, its per-child checkpoints are replaced, atomically, by one `fan:<child id base>` checkpoint holding the outputs in order, through the new `StateStore.compactCheckpoints`. Every later turn of the parent then loads one row for the fan instead of one per child. Replay expands the folded checkpoint back in memory; `getRunChildren`, cancel cascades, `deleteRun` and `purgeRuns` still reach every child; and runs written before the upgrade replay unchanged. A group with a failed child stays unfolded so `requeue` can retry it, and a fan under 100 children keeps per-child checkpoints for the dashboard.
23
+ - **No waiter re-registration on replay.** A child's running placeholder is only written with or after its waiter, so neither `ctx.all` nor `ctx.child` re-puts it on replay. `requeue` (the dashboard retry) now puts the waiter itself when it turns a failed child back into a `running` placeholder. If a successful `~retry~` of that child is already buffered, `requeue` settles the checkpoint with it directly.
24
+ - **Lost-wake re-drive.** A wake that finds the parent's lease held is dropped. If a `ctx.all` fan or wave, or a `ctx.child`, settled during such a turn, the parent re-drives itself once the turn releases the lease, instead of waiting for the `reconcileMs` sweep.
25
+ - **Run-scoped waiter reads.** `getRunChildren` (and the cancel, delete and purge walks built on it) and `engine.listSignalWaitersByRunIds` read through `listSignalWaitersByRunIds` in batches of 500 run ids, backed by the existing `durable_signal_waiters_run_idx` index; only a store without that method scans every waiter.
26
+ - **Dashboard.** A folded group renders as its child-run count (`150 child runs`), and a fan of folded waves is labelled `child runs ×N`, instead of the raw `fan:` checkpoint name.
27
+ - **Telescope.** The current-state gauges and the state breakdown count through the new `engine.countRuns` (a `COUNT` on the Lucid store) instead of listing up to 10,000 runs per status and reporting the length, which capped at 10,000 and read every row. Events of a child run started by `ctx.all`, `ctx.child` or `ctx.startChild` (without a caller-chosen id) carry `parentRunId` on the diagnostics bus, so every child of one parent is one filter away. `parentRunIdOf(runId)` is exported.
28
+
29
+ New optional `StateStore` methods, implemented by the Lucid and in-memory stores and forwarded by `CodecStateStore`, and covered by the conformance kit: `hasSignalWaiter(runId, tokenPrefix)`, `registerChildWaits(entries)` and `compactCheckpoints(runId, fromSeq, toSeq, into)`. A custom store without them keeps working: without `hasSignalWaiter` the parent replays once per settled child, without `registerChildWaits` the waiters and placeholders are written one by one, and without `compactCheckpoints` settled fans are not folded. No schema change: the Lucid store's `run_id` index on `durable_signal_waiters` already exists.
30
+
31
+ A `failFast` fan's `parallelGroup` is now `all:<seq>:failFast` (it was `all:<seq>`), which is how the barrier knows to wake on the first failure. A `failFast` run already suspended before the upgrade is treated as `waitAll` by the barrier: it still throws its `GatherError`, but only once the whole fan has settled.
32
+
3
33
  ## 0.45.0
4
34
 
5
35
  ### Minor Changes