edda-framework 0.16.2__tar.gz → 0.17.0__tar.gz

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 (362) hide show
  1. {edda_framework-0.16.2 → edda_framework-0.17.0}/PKG-INFO +93 -21
  2. {edda_framework-0.16.2 → edda_framework-0.17.0}/README.md +92 -20
  3. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/durable-execution/replay.md +14 -1
  4. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/events/cloudevents-http-binding.md +33 -1
  5. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/events/wait-event.md +3 -1
  6. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/messages.md +85 -58
  7. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/retry.md +7 -0
  8. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/saga-compensation.md +8 -0
  9. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/workflows-activities.md +18 -14
  10. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/getting-started/concepts.md +4 -0
  11. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/getting-started/installation.md +15 -0
  12. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/integrations/mcp.md +2 -1
  13. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/__init__.py +14 -1
  14. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/activity.py +74 -31
  15. edda_framework-0.17.0/edda/actors.py +201 -0
  16. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/app.py +164 -53
  17. edda_framework-0.17.0/edda/blobs.py +49 -0
  18. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/channels.py +328 -107
  19. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/compensation.py +26 -2
  20. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/context.py +227 -15
  21. edda_framework-0.17.0/edda/exceptions.py +152 -0
  22. edda_framework-0.17.0/edda/fs.py +115 -0
  23. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/opentelemetry/hooks.py +1 -0
  24. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/locking.py +190 -11
  25. edda_framework-0.17.0/edda/migrations/mysql/20261123000000_outbox_claimed_at.sql +5 -0
  26. edda_framework-0.17.0/edda/migrations/mysql/20261201000000_actor_registry.sql +24 -0
  27. edda_framework-0.17.0/edda/migrations/mysql/20261202000000_actor_capabilities.sql +15 -0
  28. edda_framework-0.17.0/edda/migrations/mysql/20261203000000_payload_blobs.sql +11 -0
  29. edda_framework-0.17.0/edda/migrations/mysql/20261204000000_actor_fs.sql +13 -0
  30. edda_framework-0.17.0/edda/migrations/mysql/20261205000000_actor_tasks.sql +15 -0
  31. edda_framework-0.17.0/edda/migrations/mysql/20261206000000_actor_tasks_claimed_at.sql +7 -0
  32. edda_framework-0.17.0/edda/migrations/mysql/20261207000000_add_sandboxed.sql +5 -0
  33. edda_framework-0.17.0/edda/migrations/mysql/20261208000000_widen_actor_owner_columns.sql +15 -0
  34. edda_framework-0.17.0/edda/migrations/postgresql/20261123000000_outbox_claimed_at.sql +5 -0
  35. edda_framework-0.17.0/edda/migrations/postgresql/20261201000000_actor_registry.sql +23 -0
  36. edda_framework-0.17.0/edda/migrations/postgresql/20261202000000_actor_capabilities.sql +15 -0
  37. edda_framework-0.17.0/edda/migrations/postgresql/20261203000000_payload_blobs.sql +11 -0
  38. edda_framework-0.17.0/edda/migrations/postgresql/20261204000000_actor_fs.sql +13 -0
  39. edda_framework-0.17.0/edda/migrations/postgresql/20261205000000_actor_tasks.sql +15 -0
  40. edda_framework-0.17.0/edda/migrations/postgresql/20261206000000_actor_tasks_claimed_at.sql +7 -0
  41. edda_framework-0.17.0/edda/migrations/postgresql/20261207000000_add_sandboxed.sql +5 -0
  42. edda_framework-0.17.0/edda/migrations/postgresql/20261208000000_widen_actor_owner_columns.sql +7 -0
  43. edda_framework-0.17.0/edda/migrations/sqlite/20261123000000_outbox_claimed_at.sql +5 -0
  44. edda_framework-0.17.0/edda/migrations/sqlite/20261201000000_actor_registry.sql +23 -0
  45. edda_framework-0.17.0/edda/migrations/sqlite/20261202000000_actor_capabilities.sql +15 -0
  46. edda_framework-0.17.0/edda/migrations/sqlite/20261203000000_payload_blobs.sql +11 -0
  47. edda_framework-0.17.0/edda/migrations/sqlite/20261204000000_actor_fs.sql +13 -0
  48. edda_framework-0.17.0/edda/migrations/sqlite/20261205000000_actor_tasks.sql +15 -0
  49. edda_framework-0.17.0/edda/migrations/sqlite/20261206000000_actor_tasks_claimed_at.sql +7 -0
  50. edda_framework-0.17.0/edda/migrations/sqlite/20261207000000_add_sandboxed.sql +5 -0
  51. edda_framework-0.17.0/edda/migrations/sqlite/20261208000000_widen_actor_owner_columns.sql +7 -0
  52. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/replay.py +243 -267
  53. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/storage/migrations.py +14 -11
  54. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/storage/protocol.py +229 -10
  55. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/storage/sqlalchemy_storage.py +1711 -208
  56. edda_framework-0.17.0/edda/supervisor.py +310 -0
  57. edda_framework-0.17.0/edda/tasks.py +284 -0
  58. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/workflow.py +24 -6
  59. {edda_framework-0.16.2 → edda_framework-0.17.0}/pyproject.toml +1 -1
  60. edda_framework-0.17.0/schema/.github/workflows/tla.yml +51 -0
  61. {edda_framework-0.16.2 → edda_framework-0.17.0}/schema/.gitignore +2 -0
  62. edda_framework-0.17.0/schema/SEMANTICS.md +351 -0
  63. {edda_framework-0.16.2 → edda_framework-0.17.0}/schema/docs/column-values.md +10 -0
  64. edda_framework-0.17.0/schema/spec/ActorFS.tla +117 -0
  65. edda_framework-0.17.0/schema/spec/ActorFS_lww_monotonic.cfg +7 -0
  66. edda_framework-0.17.0/schema/spec/ActorFS_new.cfg +8 -0
  67. edda_framework-0.17.0/schema/spec/ActorFS_old.cfg +7 -0
  68. edda_framework-0.17.0/schema/spec/CompetingMessageClaim.tla +127 -0
  69. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit.tla +132 -0
  70. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit_atomic_lost.cfg +7 -0
  71. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit_atomic_once.cfg +7 -0
  72. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit_fixed.cfg +7 -0
  73. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit_split_lost.cfg +7 -0
  74. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit_split_once.cfg +7 -0
  75. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit_waitonly_lost.cfg +7 -0
  76. edda_framework-0.17.0/schema/spec/CompetingMessageClaimSplit_waitonly_once.cfg +7 -0
  77. edda_framework-0.17.0/schema/spec/CompetingMessageClaim_new.cfg +10 -0
  78. edda_framework-0.17.0/schema/spec/CompetingMessageClaim_old.cfg +11 -0
  79. edda_framework-0.17.0/schema/spec/EpochFencing.tla +87 -0
  80. edda_framework-0.17.0/schema/spec/EpochFencingRuns.tla +107 -0
  81. edda_framework-0.17.0/schema/spec/EpochFencingRuns_epoch.cfg +6 -0
  82. edda_framework-0.17.0/schema/spec/EpochFencingRuns_none.cfg +6 -0
  83. edda_framework-0.17.0/schema/spec/EpochFencingRuns_witness.cfg +6 -0
  84. edda_framework-0.17.0/schema/spec/EpochFencingRuns_worker.cfg +6 -0
  85. edda_framework-0.17.0/schema/spec/EpochFencingRuns_worker1.cfg +6 -0
  86. edda_framework-0.17.0/schema/spec/EpochFencing_new.cfg +8 -0
  87. edda_framework-0.17.0/schema/spec/EpochFencing_old.cfg +9 -0
  88. edda_framework-0.17.0/schema/spec/InstanceClaim.tla +196 -0
  89. edda_framework-0.17.0/schema/spec/InstanceClaimVerdict.tla +116 -0
  90. edda_framework-0.17.0/schema/spec/InstanceClaimVerdict_changedrows.cfg +6 -0
  91. edda_framework-0.17.0/schema/spec/InstanceClaimVerdict_changedrows_live.cfg +6 -0
  92. edda_framework-0.17.0/schema/spec/InstanceClaimVerdict_foundrows.cfg +6 -0
  93. edda_framework-0.17.0/schema/spec/InstanceClaimVerdict_foundrows_live.cfg +6 -0
  94. edda_framework-0.17.0/schema/spec/InstanceClaim_atomic_unfenced.cfg +9 -0
  95. edda_framework-0.17.0/schema/spec/InstanceClaim_live.cfg +9 -0
  96. edda_framework-0.17.0/schema/spec/InstanceClaim_new.cfg +9 -0
  97. edda_framework-0.17.0/schema/spec/InstanceClaim_old.cfg +11 -0
  98. edda_framework-0.17.0/schema/spec/InstanceClaim_racy_fenced.cfg +9 -0
  99. edda_framework-0.17.0/schema/spec/README.md +97 -0
  100. edda_framework-0.17.0/schema/spec/SupervisorRestart.tla +108 -0
  101. edda_framework-0.17.0/schema/spec/SupervisorRestartCAS.tla +84 -0
  102. edda_framework-0.17.0/schema/spec/SupervisorRestartCAS_nonsticky.cfg +6 -0
  103. edda_framework-0.17.0/schema/spec/SupervisorRestartCAS_snapshot.cfg +6 -0
  104. edda_framework-0.17.0/schema/spec/SupervisorRestartCAS_sticky.cfg +6 -0
  105. edda_framework-0.17.0/schema/spec/SupervisorRestart_racy.cfg +7 -0
  106. edda_framework-0.17.0/schema/spec/SupervisorRestart_strict.cfg +7 -0
  107. edda_framework-0.17.0/schema/spec/TaskClaim.tla +92 -0
  108. edda_framework-0.17.0/schema/spec/TaskClaimReadBack.tla +84 -0
  109. edda_framework-0.17.0/schema/spec/TaskClaimReadBack_byid.cfg +6 -0
  110. edda_framework-0.17.0/schema/spec/TaskClaimReadBack_order.cfg +6 -0
  111. edda_framework-0.17.0/schema/spec/TaskClaim_new.cfg +8 -0
  112. edda_framework-0.17.0/schema/spec/TaskClaim_old.cfg +9 -0
  113. edda_framework-0.17.0/schema/spec/TaskReclaim.tla +110 -0
  114. edda_framework-0.17.0/schema/spec/TaskReclaimAttempts.tla +73 -0
  115. edda_framework-0.17.0/schema/spec/TaskReclaimAttempts_attempt.cfg +6 -0
  116. edda_framework-0.17.0/schema/spec/TaskReclaimAttempts_claimant.cfg +6 -0
  117. edda_framework-0.17.0/schema/spec/TaskReclaim_new.cfg +8 -0
  118. edda_framework-0.17.0/schema/spec/TaskReclaim_old.cfg +8 -0
  119. edda_framework-0.17.0/schema/spec/WaitRegistration.tla +170 -0
  120. edda_framework-0.17.0/schema/spec/WaitRegistrationSub.tla +133 -0
  121. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_fixed.cfg +6 -0
  122. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_fixed_guarded.cfg +6 -0
  123. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_guardonly_reg.cfg +6 -0
  124. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_guardonly_res.cfg +6 -0
  125. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_head_reg.cfg +6 -0
  126. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_head_res.cfg +6 -0
  127. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_noclear_reg.cfg +6 -0
  128. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_noclear_res.cfg +6 -0
  129. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_unfencedreg_reg.cfg +6 -0
  130. edda_framework-0.17.0/schema/spec/WaitRegistrationSub_unfencedreg_res.cfg +6 -0
  131. edda_framework-0.17.0/schema/spec/WaitRegistration_new.cfg +10 -0
  132. edda_framework-0.17.0/schema/spec/WaitRegistration_old.cfg +11 -0
  133. edda_framework-0.17.0/schema/spec/WaitRegistration_residual.cfg +11 -0
  134. edda_framework-0.17.0/schema/spec/WaitRegistration_sweep.cfg +11 -0
  135. edda_framework-0.17.0/schema/spec/actorfs_check_test.go +165 -0
  136. edda_framework-0.17.0/schema/spec/claim_check_test.go +387 -0
  137. edda_framework-0.17.0/schema/spec/competing_claim_test.go +194 -0
  138. edda_framework-0.17.0/schema/spec/epoch_check_test.go +128 -0
  139. edda_framework-0.17.0/schema/spec/go.mod +3 -0
  140. edda_framework-0.17.0/schema/spec/supervisorrestart_check_test.go +131 -0
  141. edda_framework-0.17.0/schema/spec/taskclaim_check_test.go +135 -0
  142. edda_framework-0.17.0/schema/spec/taskreclaim_check_test.go +125 -0
  143. edda_framework-0.17.0/schema/spec/tlc-check.sh +45 -0
  144. edda_framework-0.17.0/schema/spec/tlc-matrix.txt +68 -0
  145. edda_framework-0.17.0/schema/spec/wait_check_test.go +256 -0
  146. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/conftest.py +80 -11
  147. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/opentelemetry/test_hooks.py +3 -1
  148. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_activity.py +2 -2
  149. edda_framework-0.17.0/tests/test_actor_fs.py +234 -0
  150. edda_framework-0.17.0/tests/test_actor_registry.py +242 -0
  151. edda_framework-0.17.0/tests/test_blobs.py +37 -0
  152. edda_framework-0.17.0/tests/test_capability.py +191 -0
  153. edda_framework-0.17.0/tests/test_channel_capability.py +215 -0
  154. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_channel_competing.py +241 -2
  155. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_cross_language_channel.py +60 -23
  156. edda_framework-0.17.0/tests/test_deadlines.py +75 -0
  157. edda_framework-0.17.0/tests/test_epoch_fencing.py +1041 -0
  158. edda_framework-0.17.0/tests/test_kernel_access.py +737 -0
  159. edda_framework-0.17.0/tests/test_kernel_rules.py +754 -0
  160. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_message_delivery_lock.py +6 -2
  161. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_messages.py +5 -3
  162. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_migrations_integration.py +18 -4
  163. edda_framework-0.17.0/tests/test_migrations_lookup.py +21 -0
  164. edda_framework-0.17.0/tests/test_receive_payloads.py +96 -0
  165. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_receive_timeout.py +2 -3
  166. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_recur.py +37 -62
  167. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_recur_cleanup.py +17 -37
  168. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_replay.py +2 -1
  169. edda_framework-0.17.0/tests/test_sandboxed.py +207 -0
  170. edda_framework-0.17.0/tests/test_session_timezone.py +213 -0
  171. edda_framework-0.17.0/tests/test_sqlite_conflicts.py +161 -0
  172. edda_framework-0.17.0/tests/test_supervisor.py +424 -0
  173. edda_framework-0.17.0/tests/test_task_settle.py +44 -0
  174. edda_framework-0.17.0/tests/test_tasks.py +481 -0
  175. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_transactions.py +63 -0
  176. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_workflow_auto_register.py +9 -0
  177. {edda_framework-0.16.2 → edda_framework-0.17.0}/uv.lock +1 -1
  178. edda_framework-0.16.2/edda/exceptions.py +0 -64
  179. {edda_framework-0.16.2 → edda_framework-0.17.0}/.github/workflows/ci.yml +0 -0
  180. {edda_framework-0.16.2 → edda_framework-0.17.0}/.github/workflows/docs.yml +0 -0
  181. {edda_framework-0.16.2 → edda_framework-0.17.0}/.github/workflows/release.yml +0 -0
  182. {edda_framework-0.16.2 → edda_framework-0.17.0}/.gitignore +0 -0
  183. {edda_framework-0.16.2 → edda_framework-0.17.0}/.gitmodules +0 -0
  184. {edda_framework-0.16.2 → edda_framework-0.17.0}/.python-version +0 -0
  185. {edda_framework-0.16.2 → edda_framework-0.17.0}/Justfile +0 -0
  186. {edda_framework-0.16.2 → edda_framework-0.17.0}/LICENSE +0 -0
  187. {edda_framework-0.16.2 → edda_framework-0.17.0}/demo_app.py +0 -0
  188. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/api/reference.md +0 -0
  189. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/events/postgres-notify.md +0 -0
  190. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/hooks.md +0 -0
  191. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/core-features/transactional-outbox.md +0 -0
  192. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/examples/ecommerce.md +0 -0
  193. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/examples/events.md +0 -0
  194. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/examples/fastapi-integration.md +0 -0
  195. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/examples/saga.md +0 -0
  196. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/examples/simple.md +0 -0
  197. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/getting-started/first-workflow.md +0 -0
  198. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/getting-started/quick-start.md +0 -0
  199. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/index.md +0 -0
  200. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/integrations/llamaindex.md +0 -0
  201. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/integrations/mirascope.md +0 -0
  202. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/integrations/opentelemetry.md +0 -0
  203. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/integrations/pydantic-graph.md +0 -0
  204. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/integrations/pydantic-rpc.md +0 -0
  205. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/cloudevents-cli-trigger.png +0 -0
  206. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/compensation-execution.png +0 -0
  207. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/detail-page-loan-approval.png +0 -0
  208. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/detail-page-match-case.png +0 -0
  209. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/nested-pydantic-form.png +0 -0
  210. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/start-workflow-form-pydantic.png +0 -0
  211. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/wait-event-visualization.png +0 -0
  212. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/workflow-list-view.png +0 -0
  213. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/images/workflow-selection-dropdown.png +0 -0
  214. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/setup.md +0 -0
  215. {edda_framework-0.16.2 → edda_framework-0.17.0}/docs/viewer-ui/visualization.md +0 -0
  216. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/hooks.py +0 -0
  217. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/__init__.py +0 -0
  218. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/graph/__init__.py +0 -0
  219. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/graph/context.py +0 -0
  220. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/graph/exceptions.py +0 -0
  221. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/graph/graph.py +0 -0
  222. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/graph/nodes.py +0 -0
  223. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/llamaindex/__init__.py +0 -0
  224. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/llamaindex/events.py +0 -0
  225. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/llamaindex/exceptions.py +0 -0
  226. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/llamaindex/workflow.py +0 -0
  227. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mcp/__init__.py +0 -0
  228. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mcp/decorators.py +0 -0
  229. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mcp/server.py +0 -0
  230. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mirascope/__init__.py +0 -0
  231. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mirascope/agent.py +0 -0
  232. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mirascope/call.py +0 -0
  233. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mirascope/decorator.py +0 -0
  234. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/mirascope/types.py +0 -0
  235. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/integrations/opentelemetry/__init__.py +0 -0
  236. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/migrations/mysql/20251217000000_initial_schema.sql +0 -0
  237. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/migrations/postgresql/20251217000000_initial_schema.sql +0 -0
  238. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/migrations/sqlite/20251217000000_initial_schema.sql +0 -0
  239. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/outbox/__init__.py +0 -0
  240. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/outbox/relayer.py +0 -0
  241. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/outbox/transactional.py +0 -0
  242. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/pydantic_utils.py +0 -0
  243. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/retry.py +0 -0
  244. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/serialization/__init__.py +0 -0
  245. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/serialization/base.py +0 -0
  246. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/serialization/json.py +0 -0
  247. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/storage/__init__.py +0 -0
  248. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/storage/models.py +0 -0
  249. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/storage/notify_base.py +0 -0
  250. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/storage/pg_notify.py +0 -0
  251. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/viewer_app.py +0 -0
  252. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/viewer_ui/__init__.py +0 -0
  253. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/viewer_ui/app.py +0 -0
  254. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/viewer_ui/components.py +0 -0
  255. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/viewer_ui/data_service.py +0 -0
  256. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/viewer_ui/theme.py +0 -0
  257. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/visualizer/__init__.py +0 -0
  258. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/visualizer/ast_analyzer.py +0 -0
  259. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/visualizer/mermaid_generator.py +0 -0
  260. {edda_framework-0.16.2 → edda_framework-0.17.0}/edda/wsgi.py +0 -0
  261. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/__init__.py +0 -0
  262. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/cancellable_workflow.py +0 -0
  263. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/compensation_workflow.py +0 -0
  264. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/event_waiting_app.py +0 -0
  265. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/event_waiting_workflow.py +0 -0
  266. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/event_waiting_workflow_complete.py +0 -0
  267. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/graph/__init__.py +0 -0
  268. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/graph/demo_graph.py +0 -0
  269. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/graph/demo_graph_sleep.py +0 -0
  270. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/graph/demo_graph_wait_event.py +0 -0
  271. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/llamaindex/__init__.py +0 -0
  272. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/llamaindex/demo_workflow.py +0 -0
  273. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/long_running_loop.py +0 -0
  274. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mcp/README.md +0 -0
  275. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mcp/order_processing_mcp.py +0 -0
  276. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mcp/prompts_example.py +0 -0
  277. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mcp/remote_server_example.py +0 -0
  278. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mcp/simple_mcp_server.py +0 -0
  279. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/message_passing.py +0 -0
  280. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mirascope/__init__.py +0 -0
  281. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mirascope/durable_agent.py +0 -0
  282. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mirascope/multi_turn.py +0 -0
  283. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mirascope/simple_call.py +0 -0
  284. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/mirascope/with_tools.py +0 -0
  285. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/observability_with_logfire.py +0 -0
  286. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/observability_with_opentelemetry.py +0 -0
  287. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/pydantic_rpc_integration.py +0 -0
  288. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/pydantic_saga.py +0 -0
  289. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/retry_example.py +0 -0
  290. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/retry_with_compensation.py +0 -0
  291. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/simple_workflow.py +0 -0
  292. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/typeddict_example.py +0 -0
  293. {edda_framework-0.16.2 → edda_framework-0.17.0}/examples/with_outbox.py +0 -0
  294. {edda_framework-0.16.2 → edda_framework-0.17.0}/schema/.dbmate.yml +0 -0
  295. {edda_framework-0.16.2 → edda_framework-0.17.0}/schema/LICENSE +0 -0
  296. {edda_framework-0.16.2 → edda_framework-0.17.0}/schema/README.md +0 -0
  297. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/__init__.py +0 -0
  298. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/__init__.py +0 -0
  299. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mcp/__init__.py +0 -0
  300. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mcp/test_cancel.py +0 -0
  301. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mcp/test_integration.py +0 -0
  302. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mcp/test_jsonrpc.py +0 -0
  303. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mcp/test_prompts.py +0 -0
  304. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mcp/test_server.py +0 -0
  305. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mirascope/__init__.py +0 -0
  306. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mirascope/test_agent.py +0 -0
  307. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mirascope/test_call.py +0 -0
  308. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mirascope/test_decorator.py +0 -0
  309. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/mirascope/test_types.py +0 -0
  310. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/integrations/opentelemetry/__init__.py +0 -0
  311. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_activity_retry.py +0 -0
  312. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_activity_sync.py +0 -0
  313. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_app.py +0 -0
  314. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_ast_analyzer.py +0 -0
  315. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_atomic_wait_event.py +0 -0
  316. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_auto_migration.py +0 -0
  317. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_binary_data.py +0 -0
  318. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_channel_direct.py +0 -0
  319. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_channel_mode_locking.py +0 -0
  320. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_channel_transactional.py +0 -0
  321. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_cloudevents_http_binding.py +0 -0
  322. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_compensation.py +0 -0
  323. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_compensation_crash_recovery.py.wip +0 -0
  324. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_concurrent_outbox.py +0 -0
  325. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_context.py +0 -0
  326. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_ctx_session.py +0 -0
  327. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_distributed_event_delivery.py +0 -0
  328. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_events.py +0 -0
  329. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_graph_integration.py +0 -0
  330. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_instance_id_routing.py +0 -0
  331. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_lock_race_condition.py +0 -0
  332. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_lock_timeout_customization.py +0 -0
  333. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_locking.py +0 -0
  334. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_mermaid_escape.py +0 -0
  335. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_message_cleanup.py +0 -0
  336. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_multidb_storage.py +0 -0
  337. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_outbox.py +0 -0
  338. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_pg_notify.py +0 -0
  339. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_polling_optimization.py +0 -0
  340. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_pydantic_activity.py +0 -0
  341. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_pydantic_enum.py +0 -0
  342. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_pydantic_events.py +0 -0
  343. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_pydantic_saga.py +0 -0
  344. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_pydantic_utils.py +0 -0
  345. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_received_event.py +0 -0
  346. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_retry_policy.py +0 -0
  347. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_saga_parameter_extraction.py +0 -0
  348. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_serialization.py +0 -0
  349. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_skip_locked.py +0 -0
  350. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_stale_workflow_recovery.py +0 -0
  351. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_storage.py +0 -0
  352. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_storage_mysql.py +0 -0
  353. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_storage_postgresql.py +0 -0
  354. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_version.py +0 -0
  355. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_viewer_pagination.py +0 -0
  356. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_viewer_pydantic_form.py +0 -0
  357. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_viewer_start_saga.py +0 -0
  358. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_wait_timer.py +0 -0
  359. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_workflow.py +0 -0
  360. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_workflow_cancellation.py +0 -0
  361. {edda_framework-0.16.2 → edda_framework-0.17.0}/tests/test_workflow_resumption.py +0 -0
  362. {edda_framework-0.16.2 → edda_framework-0.17.0}/zensical.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: edda-framework
3
- Version: 0.16.2
3
+ Version: 0.17.0
4
4
  Summary: Lightweight Durable Execution Framework
5
5
  Project-URL: Homepage, https://github.com/i2y/edda
6
6
  Project-URL: Documentation, https://github.com/i2y/edda#readme
@@ -98,6 +98,7 @@ For detailed documentation, visit [https://i2y.github.io/edda/](https://i2y.gith
98
98
  - ☁️ **CloudEvents Support**: Native support for CloudEvents protocol
99
99
  - ⏱️ **Event & Timer Waiting**: Free up worker resources while waiting for events or timers, resume on any available worker
100
100
  - 📬 **Channel-based Messaging**: Actor-model style communication with competing (job queue) and broadcast (fan-out) modes
101
+ - 🧩 **Actor OS Primitives**: Names, monitors, capabilities and sealed channels, tasks, an actor filesystem and supervision trees, shared with Romancy (Go) and Shikibu (Ruby)
101
102
  - ⚡ **Instant Notifications**: PostgreSQL LISTEN/NOTIFY for near-instant event delivery (optional)
102
103
  - 🤖 **MCP Integration**: Expose durable workflows as AI tools via Model Context Protocol
103
104
  - 🧠 **Mirascope Integration**: Durable LLM calls
@@ -294,6 +295,12 @@ pip install "git+https://github.com/i2y/edda.git[postgresql,viewer]"
294
295
  | **PostgreSQL** | Production, multi-process/multi-pod systems | ✅ Yes | ✅ Yes | **Recommended for production** - Full support for database-based exclusive control and concurrent workflows |
295
296
  | **MySQL** | Production with existing MySQL infrastructure | ✅ Yes | ✅ Yes | Suitable for production - Good choice if you already use MySQL |
296
297
 
298
+ **Session settings**: Edda sets the session time zone to UTC (PostgreSQL and MySQL) and the isolation level to `READ COMMITTED` (MySQL) on every connection. This also applies to an engine you create yourself and pass to `SQLAlchemyStorage`, including connections it opened before the storage was created. An explicit `isolation_level` on your engine is kept.
299
+
300
+ **MySQL identifiers**: MySQL compares identifiers (instance IDs, channel names, actor names, paths, capability targets) with the database collation. The default `utf8mb4_0900_ai_ci` ignores case and accents, so `Orders` and `orders` are the same channel. For exact matching create the database with `utf8mb4_0900_bin`. Never change the collation of single columns. Migration `20261208000000_widen_actor_owner_columns` widens the MySQL instance-id columns of the actor tables to `VARCHAR(255)`.
301
+
302
+ **SQLite**: File-backed SQLite databases run in WAL mode, so `-wal` and `-shm` files appear next to the database (do not use a network filesystem). An activity that hits a SQLite write conflict is restarted in a new transaction; this does not count as a retry.
303
+
297
304
  **Important**: For multi-process or multi-pod deployments (K8s, Docker Compose with multiple replicas, etc.), you **must** use PostgreSQL or MySQL. SQLite supports multiple async workers within a single process, but its table-level locking makes it unsuitable for multi-process/multi-pod scenarios.
298
305
 
299
306
  > **Tip**: For PostgreSQL, install the `postgres-notify` extra for near-instant event delivery using LISTEN/NOTIFY instead of polling.
@@ -546,6 +553,7 @@ Multiple workers can safely process workflows using database-based exclusive con
546
553
 
547
554
  - Edda uses database-based locks (not Redis or ZooKeeper)
548
555
  - Each workflow instance runs on only one worker at a time
556
+ - A worker claims only instances of the workflows it has registered, so every worker must register the workflows it should run
549
557
  - If a worker crashes, another worker automatically resumes
550
558
  - No additional infrastructure required
551
559
 
@@ -660,7 +668,8 @@ app = EddaApp(
660
668
  **CloudEvents handling**:
661
669
  - All HTTP requests (any path) are accepted as CloudEvents
662
670
  - Events without matching workflow handlers are silently discarded
663
- - Special endpoint: `POST /cancel/{instance_id}` for workflow cancellation
671
+ - Special endpoint: `POST /cancel/{instance_id}` for workflow cancellation. `running`, `waiting_*` and `recurred` instances can be cancelled; an instance that is running its compensations cannot (the request is refused and the compensations run to the end)
672
+ - An event for a channel sealed for `channel_pub` must carry the token in the `capabilitytoken` extension attribute (binary mode: `ce-capabilitytoken` header). Otherwise the endpoint answers 403 `{"error", "error_type": "Forbidden", "retryable": false}` and nothing is published. The attribute is not stored
664
673
  - Automatic CloudEvents validation and parsing
665
674
  - Works with CloudEvents-compatible systems (Knative Eventing, CloudEvents SDKs, etc.)
666
675
 
@@ -748,10 +757,9 @@ async def job_worker(ctx: WorkflowContext, worker_id: str):
748
757
  # Subscribe with competing mode - each job goes to ONE worker only
749
758
  await subscribe(ctx, channel="jobs", mode="competing")
750
759
 
751
- while True:
752
- job = await receive(ctx, channel="jobs") # Get next job
753
- await process_job(ctx, job.data)
754
- await ctx.recur(worker_id) # Continue processing
760
+ job = await receive(ctx, channel="jobs") # Get next job
761
+ await process_job(ctx, job.data)
762
+ await ctx.recur(worker_id=worker_id) # Continue with fresh history
755
763
 
756
764
  # Notification Handler - receives ALL messages (broadcast mode)
757
765
  @workflow
@@ -759,10 +767,9 @@ async def notification_handler(ctx: WorkflowContext, handler_id: str):
759
767
  # Subscribe with broadcast mode - ALL handlers receive each message
760
768
  await subscribe(ctx, channel="notifications", mode="broadcast")
761
769
 
762
- while True:
763
- msg = await receive(ctx, channel="notifications")
764
- await send_notification(ctx, msg.data)
765
- await ctx.recur(handler_id)
770
+ msg = await receive(ctx, channel="notifications")
771
+ await send_notification(ctx, msg.data)
772
+ await ctx.recur(handler_id=handler_id)
766
773
 
767
774
  # Publish to channel (all subscribers or one competing subscriber)
768
775
  await publish(ctx, channel="jobs", data={"task": "send_report"})
@@ -778,13 +785,77 @@ await send_to(ctx, instance_id="workflow-123", channel="approval", data={"approv
778
785
  **Key features**:
779
786
  - **Channel-based messaging**: Messages are delivered to workflows waiting on specific channels
780
787
  - **Competing vs Broadcast**: Choose semantics per subscription
781
- - **Direct messaging**: `send_to()` for workflow-to-workflow communication
788
+ - **Direct messaging**: `send_to(ctx, instance_id, data, channel=...)` delivers to `"{channel}:{instance_id}"`; the receiver subscribes with `mode="direct"`
789
+ - **Payloads**: `receive()` returns the published value as it was sent: any JSON value (dict, list, str, int, float, bool, None) or `bytes`. `publish()` and `send_to()` take `data: Any`
790
+ - **Workflow code only**: `receive()` called inside an activity raises `TerminalError`. `publish()` and `send_to()` inside an activity join the activity's transaction and deliver after commit
782
791
  - **Database-backed**: All messages are persisted for durability
783
792
  - **Lock-first delivery**: Safe for multi-worker environments
793
+ - **Replay-safe**: Called from workflow code, `publish()` and `send_to()` are recorded steps; a replay does not publish again
794
+ - **Sealed channels**: Once a `channel_pub` or `channel_sub` capability is issued for a channel, publishing or receiving on it (including its direct channels) requires a token, passed as `capability_token=`
795
+ - **Seals outlast expiry**: an expired grant keeps its channel sealed; only revoking the last grant re-opens it. `revoke_capability` works only for the instance that issued the capability and `unregister_name` only for the instance that holds the name (`NotOwnerError` otherwise; an unknown ID or an unbound name is a no-op). A sweep never removes the newest grant of a channel
796
+ - **Capability key**: `EddaApp(capability_key=...)` (or `DURAX_CAPABILITY_KEY`) derives every new secret as the HMAC-SHA256 of the capability ID, and history then records no token. Without a key the token is stored in history. Keep the key the same on all workers while the issuing instances are alive
797
+ - **CloudEvents ingress**: an event for a channel sealed for `channel_pub` needs a valid token in the `capabilitytoken` extension (`ce-capabilitytoken` header in binary mode), or the endpoint answers 403
798
+ - **Direct channels are private**: only the receiving instance can `subscribe`, `receive` or read (`read_channel_since`, `read_channel_after`) its `"{channel}:{instance_id}"`. For another existing instance these raise `ChannelPermissionError` whatever the seal state; `send_to()` and targeted CloudEvents to it stay allowed
799
+
800
+ ### Actor Primitives
801
+
802
+ Workflows double as actors of a kernel shared with Romancy and Shikibu (same schema, same semantics). The primitives live in their own modules:
803
+
804
+ - **`edda.actors`**: `register_name`, `unregister_name`, `whereis`, `monitor`, `unmonitor`, `issue_capability` (`expires_at=` issues an expiring capability), `check_capability`, `revoke_capability`
805
+ - **`edda.tasks`**: `post_task`, `claim_task`, `complete_task`, `fail_task`, `list_tasks`, `wait_task`, `wait_any_task`, `read_channel_since` (raises `CursorNotFoundError` when the cursor message is not on the channel), `read_channel_after` (numeric `id` cursor, `0` = from the start; keeps working after the cursor message is deleted). Returned messages carry `id` and `message_id`
806
+ - **`edda.fs`** (inside activities only): `fs_read`, `fs_write`, `fs_list`, `fs_delete`
807
+ - **`edda.blobs`**: `store_payload`, `load_payload`, `stat_payload`
808
+ - **`edda.supervisor`**: `define_supervisor`, `ChildSpec`, `Strategy`, `RestartMode`
809
+
810
+ ```python
811
+ from edda import workflow, subscribe, receive, WorkflowContext
812
+ from edda.actors import whereis, monitor
813
+ from edda.supervisor import ChildSpec, RestartMode, Strategy, define_supervisor
814
+
815
+ @workflow
816
+ async def watcher(ctx: WorkflowContext) -> str:
817
+ target = await whereis(ctx, "ingest")
818
+ if target is None:
819
+ return "not running"
820
+ # The DOWN message arrives on this instance's direct channel
821
+ await subscribe(ctx, channel="down", mode="direct")
822
+ await monitor(ctx, target, "down")
823
+ msg = await receive(ctx, channel="down")
824
+ return msg.data["status"] # "completed", "failed" or "cancelled" (a recurring instance stays alive: no DOWN)
825
+
826
+ sup = define_supervisor(
827
+ "pipeline-sup",
828
+ strategy=Strategy.ONE_FOR_ONE,
829
+ max_restarts=5,
830
+ within_seconds=60,
831
+ children=[ChildSpec(name="ingest", workflow="ingest", restart=RestartMode.PERMANENT)],
832
+ )
833
+ # instance_id = await sup.start()
834
+ ```
835
+
836
+ Called from workflow code, every primitive is a recorded step: a replay returns the recorded outcome, exceptions included, instead of running it again. A primitive with a side effect first proves that the run still holds the instance lock, so a run that lost its lease changes nothing (`LockLostError`). Only kernel errors that carry a code are recorded (`task_conflict`, `task_not_found`, `actor_name_taken`, `fs_conflict`, `sandboxed`, `channel_forbidden`, `not_owner`, `cursor_not_found`, `invalid_argument`).
837
+
838
+ Any other failure aborts the run: a database error inside a primitive or around an activity attempt (raised as `RunAbortedError`), a lost lock (`LockLostError`), or a shutdown. An aborted run is not failed and nothing is compensated; the instance stays `running` and a later run replays it. `RunAbortedError` derives from `BaseException`, so `except Exception:` does not swallow it. Do not catch either error. Task handlers and supervised children are at-least-once and must be idempotent.
839
+
840
+ ### Sandboxed Actors
841
+
842
+ Workflows can be started as sandboxed actors when they should receive only explicitly delegated capabilities:
843
+
844
+ ```python
845
+ child_id = await untrusted_workflow.start(sandboxed=True, input=value)
846
+ ```
847
+
848
+ Sandboxing enforces three rules:
849
+
850
+ - A sandboxed workflow cannot mint new capabilities with `issue_capability`.
851
+ - Children started by a sandboxed workflow inherit the sandbox flag. A `recur()` continues the same instance and keeps its flag.
852
+ - Only an unsandboxed parent (or an external caller) may use `sandboxed=True` for a child.
853
+
854
+ Delegation itself uses the existing capability tokens: pass tokens the child needs in its input. Edda itself enforces these rules. Code in the worker process that uses the storage directly can bypass them, and database-level isolation (for example PostgreSQL row-level security) is not provided.
784
855
 
785
856
  ### Workflow Recurrence
786
857
 
787
- Long-running workflows can use `ctx.recur()` to restart with fresh history while maintaining the same instance ID. This is essential for workflows that run indefinitely (job workers, notification handlers, etc.):
858
+ Long-running workflows can use `ctx.recur()` to continue with fresh history. This is essential for workflows that run indefinitely (job workers, notification handlers, etc.):
788
859
 
789
860
  ```python
790
861
  from edda import workflow, subscribe, receive, WorkflowContext
@@ -797,16 +868,17 @@ async def job_worker(ctx: WorkflowContext, worker_id: str):
797
868
  job = await receive(ctx, channel="jobs")
798
869
  await process_job(ctx, job.data)
799
870
 
800
- # Archive history and restart with same instance_id
801
- # Prevents unbounded history growth
802
- await ctx.recur(worker_id)
871
+ # Archive history and continue on the same instance id
872
+ # (keyword arguments become the next iteration's input)
873
+ await ctx.recur(worker_id=worker_id)
803
874
  ```
804
875
 
805
- **Key benefits**:
806
- - **Prevents history growth**: Archives old history, starts fresh
807
- - **Maintains instance ID**: Same workflow continues logically
808
- - **Preserves subscriptions**: Channel subscriptions survive recurrence
809
- - **Enables infinite loops**: Essential for long-running workers
876
+ **How it works**:
877
+ - **Prevents history growth**: The current history is archived to `workflow_history_archive`, and the next iteration starts fresh
878
+ - **Same instance id**: `recur()` archives the history, clears the instance's subscriptions, timers, group memberships and registered compensations, stores the new input and continues on the same instance id. Between iterations the status is `recurred`, which counts as alive: no DOWN message is sent and registered names stay bound. There is no `continued_from` chain
879
+ - **Subscribe again**: Subscriptions are cleared, so subscribe again at the start of the workflow (as above). A broadcast channel you subscribe to again continues after the last message delivered to the instance; competing messages wait in the channel
880
+ - **Identity survives**: Names, monitors, issued capabilities, tasks, the actor FS (`/actor/{id}/`) and the sandbox flag all stay with the instance. A supervisor keeps its id across recurs, so its children's ids stay stable too
881
+ - **Compensations**: Each iteration is a finished unit; a failure in a later iteration does not undo an earlier one
810
882
 
811
883
  ### ASGI Integration
812
884
 
@@ -924,7 +996,7 @@ Each `@durable_tool` automatically generates **four MCP tools**:
924
996
  1. **Main tool** (`process_order`): Starts the workflow, returns instance ID
925
997
  2. **Status tool** (`process_order_status`): Checks workflow progress with completed activity count and suggested poll interval
926
998
  3. **Result tool** (`process_order_result`): Gets final result when completed
927
- 4. **Cancel tool** (`process_order_cancel`): Cancels workflow if running or waiting, executes compensation handlers
999
+ 4. **Cancel tool** (`process_order_cancel`): Cancels workflow if running or waiting, executes compensation handlers (refused while the workflow is already running its compensations)
928
1000
 
929
1001
  This enables AI assistants to work with workflows that take minutes, hours, or even days to complete, with full control over the workflow lifecycle.
930
1002
 
@@ -29,6 +29,7 @@ For detailed documentation, visit [https://i2y.github.io/edda/](https://i2y.gith
29
29
  - ☁️ **CloudEvents Support**: Native support for CloudEvents protocol
30
30
  - ⏱️ **Event & Timer Waiting**: Free up worker resources while waiting for events or timers, resume on any available worker
31
31
  - 📬 **Channel-based Messaging**: Actor-model style communication with competing (job queue) and broadcast (fan-out) modes
32
+ - 🧩 **Actor OS Primitives**: Names, monitors, capabilities and sealed channels, tasks, an actor filesystem and supervision trees, shared with Romancy (Go) and Shikibu (Ruby)
32
33
  - ⚡ **Instant Notifications**: PostgreSQL LISTEN/NOTIFY for near-instant event delivery (optional)
33
34
  - 🤖 **MCP Integration**: Expose durable workflows as AI tools via Model Context Protocol
34
35
  - 🧠 **Mirascope Integration**: Durable LLM calls
@@ -225,6 +226,12 @@ pip install "git+https://github.com/i2y/edda.git[postgresql,viewer]"
225
226
  | **PostgreSQL** | Production, multi-process/multi-pod systems | ✅ Yes | ✅ Yes | **Recommended for production** - Full support for database-based exclusive control and concurrent workflows |
226
227
  | **MySQL** | Production with existing MySQL infrastructure | ✅ Yes | ✅ Yes | Suitable for production - Good choice if you already use MySQL |
227
228
 
229
+ **Session settings**: Edda sets the session time zone to UTC (PostgreSQL and MySQL) and the isolation level to `READ COMMITTED` (MySQL) on every connection. This also applies to an engine you create yourself and pass to `SQLAlchemyStorage`, including connections it opened before the storage was created. An explicit `isolation_level` on your engine is kept.
230
+
231
+ **MySQL identifiers**: MySQL compares identifiers (instance IDs, channel names, actor names, paths, capability targets) with the database collation. The default `utf8mb4_0900_ai_ci` ignores case and accents, so `Orders` and `orders` are the same channel. For exact matching create the database with `utf8mb4_0900_bin`. Never change the collation of single columns. Migration `20261208000000_widen_actor_owner_columns` widens the MySQL instance-id columns of the actor tables to `VARCHAR(255)`.
232
+
233
+ **SQLite**: File-backed SQLite databases run in WAL mode, so `-wal` and `-shm` files appear next to the database (do not use a network filesystem). An activity that hits a SQLite write conflict is restarted in a new transaction; this does not count as a retry.
234
+
228
235
  **Important**: For multi-process or multi-pod deployments (K8s, Docker Compose with multiple replicas, etc.), you **must** use PostgreSQL or MySQL. SQLite supports multiple async workers within a single process, but its table-level locking makes it unsuitable for multi-process/multi-pod scenarios.
229
236
 
230
237
  > **Tip**: For PostgreSQL, install the `postgres-notify` extra for near-instant event delivery using LISTEN/NOTIFY instead of polling.
@@ -477,6 +484,7 @@ Multiple workers can safely process workflows using database-based exclusive con
477
484
 
478
485
  - Edda uses database-based locks (not Redis or ZooKeeper)
479
486
  - Each workflow instance runs on only one worker at a time
487
+ - A worker claims only instances of the workflows it has registered, so every worker must register the workflows it should run
480
488
  - If a worker crashes, another worker automatically resumes
481
489
  - No additional infrastructure required
482
490
 
@@ -591,7 +599,8 @@ app = EddaApp(
591
599
  **CloudEvents handling**:
592
600
  - All HTTP requests (any path) are accepted as CloudEvents
593
601
  - Events without matching workflow handlers are silently discarded
594
- - Special endpoint: `POST /cancel/{instance_id}` for workflow cancellation
602
+ - Special endpoint: `POST /cancel/{instance_id}` for workflow cancellation. `running`, `waiting_*` and `recurred` instances can be cancelled; an instance that is running its compensations cannot (the request is refused and the compensations run to the end)
603
+ - An event for a channel sealed for `channel_pub` must carry the token in the `capabilitytoken` extension attribute (binary mode: `ce-capabilitytoken` header). Otherwise the endpoint answers 403 `{"error", "error_type": "Forbidden", "retryable": false}` and nothing is published. The attribute is not stored
595
604
  - Automatic CloudEvents validation and parsing
596
605
  - Works with CloudEvents-compatible systems (Knative Eventing, CloudEvents SDKs, etc.)
597
606
 
@@ -679,10 +688,9 @@ async def job_worker(ctx: WorkflowContext, worker_id: str):
679
688
  # Subscribe with competing mode - each job goes to ONE worker only
680
689
  await subscribe(ctx, channel="jobs", mode="competing")
681
690
 
682
- while True:
683
- job = await receive(ctx, channel="jobs") # Get next job
684
- await process_job(ctx, job.data)
685
- await ctx.recur(worker_id) # Continue processing
691
+ job = await receive(ctx, channel="jobs") # Get next job
692
+ await process_job(ctx, job.data)
693
+ await ctx.recur(worker_id=worker_id) # Continue with fresh history
686
694
 
687
695
  # Notification Handler - receives ALL messages (broadcast mode)
688
696
  @workflow
@@ -690,10 +698,9 @@ async def notification_handler(ctx: WorkflowContext, handler_id: str):
690
698
  # Subscribe with broadcast mode - ALL handlers receive each message
691
699
  await subscribe(ctx, channel="notifications", mode="broadcast")
692
700
 
693
- while True:
694
- msg = await receive(ctx, channel="notifications")
695
- await send_notification(ctx, msg.data)
696
- await ctx.recur(handler_id)
701
+ msg = await receive(ctx, channel="notifications")
702
+ await send_notification(ctx, msg.data)
703
+ await ctx.recur(handler_id=handler_id)
697
704
 
698
705
  # Publish to channel (all subscribers or one competing subscriber)
699
706
  await publish(ctx, channel="jobs", data={"task": "send_report"})
@@ -709,13 +716,77 @@ await send_to(ctx, instance_id="workflow-123", channel="approval", data={"approv
709
716
  **Key features**:
710
717
  - **Channel-based messaging**: Messages are delivered to workflows waiting on specific channels
711
718
  - **Competing vs Broadcast**: Choose semantics per subscription
712
- - **Direct messaging**: `send_to()` for workflow-to-workflow communication
719
+ - **Direct messaging**: `send_to(ctx, instance_id, data, channel=...)` delivers to `"{channel}:{instance_id}"`; the receiver subscribes with `mode="direct"`
720
+ - **Payloads**: `receive()` returns the published value as it was sent: any JSON value (dict, list, str, int, float, bool, None) or `bytes`. `publish()` and `send_to()` take `data: Any`
721
+ - **Workflow code only**: `receive()` called inside an activity raises `TerminalError`. `publish()` and `send_to()` inside an activity join the activity's transaction and deliver after commit
713
722
  - **Database-backed**: All messages are persisted for durability
714
723
  - **Lock-first delivery**: Safe for multi-worker environments
724
+ - **Replay-safe**: Called from workflow code, `publish()` and `send_to()` are recorded steps; a replay does not publish again
725
+ - **Sealed channels**: Once a `channel_pub` or `channel_sub` capability is issued for a channel, publishing or receiving on it (including its direct channels) requires a token, passed as `capability_token=`
726
+ - **Seals outlast expiry**: an expired grant keeps its channel sealed; only revoking the last grant re-opens it. `revoke_capability` works only for the instance that issued the capability and `unregister_name` only for the instance that holds the name (`NotOwnerError` otherwise; an unknown ID or an unbound name is a no-op). A sweep never removes the newest grant of a channel
727
+ - **Capability key**: `EddaApp(capability_key=...)` (or `DURAX_CAPABILITY_KEY`) derives every new secret as the HMAC-SHA256 of the capability ID, and history then records no token. Without a key the token is stored in history. Keep the key the same on all workers while the issuing instances are alive
728
+ - **CloudEvents ingress**: an event for a channel sealed for `channel_pub` needs a valid token in the `capabilitytoken` extension (`ce-capabilitytoken` header in binary mode), or the endpoint answers 403
729
+ - **Direct channels are private**: only the receiving instance can `subscribe`, `receive` or read (`read_channel_since`, `read_channel_after`) its `"{channel}:{instance_id}"`. For another existing instance these raise `ChannelPermissionError` whatever the seal state; `send_to()` and targeted CloudEvents to it stay allowed
730
+
731
+ ### Actor Primitives
732
+
733
+ Workflows double as actors of a kernel shared with Romancy and Shikibu (same schema, same semantics). The primitives live in their own modules:
734
+
735
+ - **`edda.actors`**: `register_name`, `unregister_name`, `whereis`, `monitor`, `unmonitor`, `issue_capability` (`expires_at=` issues an expiring capability), `check_capability`, `revoke_capability`
736
+ - **`edda.tasks`**: `post_task`, `claim_task`, `complete_task`, `fail_task`, `list_tasks`, `wait_task`, `wait_any_task`, `read_channel_since` (raises `CursorNotFoundError` when the cursor message is not on the channel), `read_channel_after` (numeric `id` cursor, `0` = from the start; keeps working after the cursor message is deleted). Returned messages carry `id` and `message_id`
737
+ - **`edda.fs`** (inside activities only): `fs_read`, `fs_write`, `fs_list`, `fs_delete`
738
+ - **`edda.blobs`**: `store_payload`, `load_payload`, `stat_payload`
739
+ - **`edda.supervisor`**: `define_supervisor`, `ChildSpec`, `Strategy`, `RestartMode`
740
+
741
+ ```python
742
+ from edda import workflow, subscribe, receive, WorkflowContext
743
+ from edda.actors import whereis, monitor
744
+ from edda.supervisor import ChildSpec, RestartMode, Strategy, define_supervisor
745
+
746
+ @workflow
747
+ async def watcher(ctx: WorkflowContext) -> str:
748
+ target = await whereis(ctx, "ingest")
749
+ if target is None:
750
+ return "not running"
751
+ # The DOWN message arrives on this instance's direct channel
752
+ await subscribe(ctx, channel="down", mode="direct")
753
+ await monitor(ctx, target, "down")
754
+ msg = await receive(ctx, channel="down")
755
+ return msg.data["status"] # "completed", "failed" or "cancelled" (a recurring instance stays alive: no DOWN)
756
+
757
+ sup = define_supervisor(
758
+ "pipeline-sup",
759
+ strategy=Strategy.ONE_FOR_ONE,
760
+ max_restarts=5,
761
+ within_seconds=60,
762
+ children=[ChildSpec(name="ingest", workflow="ingest", restart=RestartMode.PERMANENT)],
763
+ )
764
+ # instance_id = await sup.start()
765
+ ```
766
+
767
+ Called from workflow code, every primitive is a recorded step: a replay returns the recorded outcome, exceptions included, instead of running it again. A primitive with a side effect first proves that the run still holds the instance lock, so a run that lost its lease changes nothing (`LockLostError`). Only kernel errors that carry a code are recorded (`task_conflict`, `task_not_found`, `actor_name_taken`, `fs_conflict`, `sandboxed`, `channel_forbidden`, `not_owner`, `cursor_not_found`, `invalid_argument`).
768
+
769
+ Any other failure aborts the run: a database error inside a primitive or around an activity attempt (raised as `RunAbortedError`), a lost lock (`LockLostError`), or a shutdown. An aborted run is not failed and nothing is compensated; the instance stays `running` and a later run replays it. `RunAbortedError` derives from `BaseException`, so `except Exception:` does not swallow it. Do not catch either error. Task handlers and supervised children are at-least-once and must be idempotent.
770
+
771
+ ### Sandboxed Actors
772
+
773
+ Workflows can be started as sandboxed actors when they should receive only explicitly delegated capabilities:
774
+
775
+ ```python
776
+ child_id = await untrusted_workflow.start(sandboxed=True, input=value)
777
+ ```
778
+
779
+ Sandboxing enforces three rules:
780
+
781
+ - A sandboxed workflow cannot mint new capabilities with `issue_capability`.
782
+ - Children started by a sandboxed workflow inherit the sandbox flag. A `recur()` continues the same instance and keeps its flag.
783
+ - Only an unsandboxed parent (or an external caller) may use `sandboxed=True` for a child.
784
+
785
+ Delegation itself uses the existing capability tokens: pass tokens the child needs in its input. Edda itself enforces these rules. Code in the worker process that uses the storage directly can bypass them, and database-level isolation (for example PostgreSQL row-level security) is not provided.
715
786
 
716
787
  ### Workflow Recurrence
717
788
 
718
- Long-running workflows can use `ctx.recur()` to restart with fresh history while maintaining the same instance ID. This is essential for workflows that run indefinitely (job workers, notification handlers, etc.):
789
+ Long-running workflows can use `ctx.recur()` to continue with fresh history. This is essential for workflows that run indefinitely (job workers, notification handlers, etc.):
719
790
 
720
791
  ```python
721
792
  from edda import workflow, subscribe, receive, WorkflowContext
@@ -728,16 +799,17 @@ async def job_worker(ctx: WorkflowContext, worker_id: str):
728
799
  job = await receive(ctx, channel="jobs")
729
800
  await process_job(ctx, job.data)
730
801
 
731
- # Archive history and restart with same instance_id
732
- # Prevents unbounded history growth
733
- await ctx.recur(worker_id)
802
+ # Archive history and continue on the same instance id
803
+ # (keyword arguments become the next iteration's input)
804
+ await ctx.recur(worker_id=worker_id)
734
805
  ```
735
806
 
736
- **Key benefits**:
737
- - **Prevents history growth**: Archives old history, starts fresh
738
- - **Maintains instance ID**: Same workflow continues logically
739
- - **Preserves subscriptions**: Channel subscriptions survive recurrence
740
- - **Enables infinite loops**: Essential for long-running workers
807
+ **How it works**:
808
+ - **Prevents history growth**: The current history is archived to `workflow_history_archive`, and the next iteration starts fresh
809
+ - **Same instance id**: `recur()` archives the history, clears the instance's subscriptions, timers, group memberships and registered compensations, stores the new input and continues on the same instance id. Between iterations the status is `recurred`, which counts as alive: no DOWN message is sent and registered names stay bound. There is no `continued_from` chain
810
+ - **Subscribe again**: Subscriptions are cleared, so subscribe again at the start of the workflow (as above). A broadcast channel you subscribe to again continues after the last message delivered to the instance; competing messages wait in the channel
811
+ - **Identity survives**: Names, monitors, issued capabilities, tasks, the actor FS (`/actor/{id}/`) and the sandbox flag all stay with the instance. A supervisor keeps its id across recurs, so its children's ids stay stable too
812
+ - **Compensations**: Each iteration is a finished unit; a failure in a later iteration does not undo an earlier one
741
813
 
742
814
  ### ASGI Integration
743
815
 
@@ -855,7 +927,7 @@ Each `@durable_tool` automatically generates **four MCP tools**:
855
927
  1. **Main tool** (`process_order`): Starts the workflow, returns instance ID
856
928
  2. **Status tool** (`process_order_status`): Checks workflow progress with completed activity count and suggested poll interval
857
929
  3. **Result tool** (`process_order_result`): Gets final result when completed
858
- 4. **Cancel tool** (`process_order_cancel`): Cancels workflow if running or waiting, executes compensation handlers
930
+ 4. **Cancel tool** (`process_order_cancel`): Cancels workflow if running or waiting, executes compensation handlers (refused while the workflow is already running its compensations)
859
931
 
860
932
  This enables AI assistants to work with workflows that take minutes, hours, or even days to complete, with full control over the workflow lifecycle.
861
933
 
@@ -192,7 +192,7 @@ Edda persists all activity results to the `workflow_history` table:
192
192
  **Event Types:**
193
193
 
194
194
  - **ActivityCompleted**: Successful activity execution
195
- - **ActivityFailed**: Activity raised an exception (includes error type and message)
195
+ - **ActivityFailed**: Activity gave up (a `TerminalError` or exhausted retries), also when it is transactional (includes error type and message). A replay raises the recorded error and does not run the activity again
196
196
  - **EventReceived**: Event received via `wait_event()`
197
197
  - **TimerExpired**: Timer expired via `sleep()`
198
198
 
@@ -600,6 +600,18 @@ All history recording is transactional:
600
600
  - No orphaned history records
601
601
  - Deterministic replay guaranteed
602
602
 
603
+ ### Kernel Primitives Are Recorded Steps
604
+
605
+ Called from workflow code, the actor primitives (names, monitors, capabilities, tasks, channel reads, `publish()` and `send_to()`) run once and record their outcome in history. A replay returns the record. A primitive with a side effect first proves that the run still holds the lock, applies the effect and records the outcome in one transaction, so a run that lost its lease applies nothing. Inside an activity a primitive runs directly: the activity is the recorded unit.
606
+
607
+ Only kernel errors that carry a code are recorded as step results: `task_conflict`, `task_not_found`, `actor_name_taken`, `fs_conflict`, `sandboxed`, `channel_forbidden`, `not_owner`, `cursor_not_found` and `invalid_argument`. A replay raises the matching exception again.
608
+
609
+ ### Aborted Runs
610
+
611
+ Any other error, such as a database error inside a primitive, is not a workflow outcome: the run is aborted with `RunAbortedError`, and every later primitive and activity in that run raises the same error. A lost lock (`LockLostError`) and a worker shutdown end the run the same way. An aborted run is not failed and nothing is compensated: the engine releases the lock, the instance stays `running`, and a later run replays it.
612
+
613
+ `RunAbortedError` derives from `BaseException`, so a broad `except Exception:` does not swallow it. Do not catch it, or `LockLostError`, in workflow code.
614
+
603
615
  ### Compensating Workflow Recovery
604
616
 
605
617
  Special handling for workflows that crash during compensation:
@@ -608,6 +620,7 @@ Special handling for workflows that crash during compensation:
608
620
  - Only incomplete compensations are re-executed
609
621
  - Workflow function is NOT re-executed
610
622
  - Ensures compensation transactions complete even after multiple crashes
623
+ - An instance in this state cannot be cancelled; the compensations run to the end
611
624
 
612
625
  ## Summary
613
626
 
@@ -99,6 +99,38 @@ Content-Type: application/json
99
99
 
100
100
  - 🚫 **DO NOT retry** - Fix the event structure and resend
101
101
 
102
+ ### Client Error (403 Forbidden)
103
+
104
+ An event posted to a channel that is sealed for `channel_pub` must carry a valid capability token in the `capabilitytoken` extension attribute. In binary mode the token goes in the `ce-capabilitytoken` header. The target channel is the event `type`, or `type:{instance_id}` for an event addressed to one instance (`eddainstanceid`).
105
+
106
+ ```bash
107
+ curl -X POST http://localhost:8001/ \
108
+ -H "Content-Type: application/cloudevents+json" \
109
+ -d '{
110
+ "specversion": "1.0",
111
+ "type": "orders",
112
+ "source": "order-service",
113
+ "id": "event-124",
114
+ "capabilitytoken": "cap:channel_pub:orders:<secret>",
115
+ "data": {"order_id": "A-1"}
116
+ }'
117
+ ```
118
+
119
+ Without a valid token Edda publishes nothing and answers:
120
+
121
+ ```http
122
+ HTTP/1.1 403 Forbidden
123
+ Content-Type: application/json
124
+
125
+ {
126
+ "error": "...",
127
+ "error_type": "Forbidden",
128
+ "retryable": false
129
+ }
130
+ ```
131
+
132
+ The `capabilitytoken` attribute is not stored with the message. An expired token is rejected, and an expired grant still keeps the channel sealed. See [Replay Safety and Sealed Channels](../messages.md#replay-safety-and-sealed-channels).
133
+
102
134
  ### Server Error (500 Internal Server Error)
103
135
 
104
136
  When an internal error occurs (**retryable**):
@@ -142,7 +174,7 @@ All error responses include structured information to help clients decide whethe
142
174
  - **`error`** (string): Human-readable error message
143
175
  - **`error_type`** (string): Python exception class name for debugging
144
176
  - **`retryable`** (boolean): Whether the client should retry
145
- - `false`: Client error (400) - Fix the request before retrying
177
+ - `false`: Client error (400, 403) - Fix the request before retrying
146
178
  - `true`: Server error (500) - Retry with exponential backoff
147
179
 
148
180
  ## Client Retry Logic
@@ -76,6 +76,8 @@ async def wait_event(
76
76
  - `timeout_seconds`: Optional timeout in seconds
77
77
  - `model`: Optional Pydantic model for automatic data validation
78
78
 
79
+ Timers and timeouts never fire before their deadline. SQLite and MySQL store whole seconds, so a deadline with a fraction is rounded up to the next second.
80
+
79
81
  #### Returns
80
82
 
81
83
  `ReceivedEvent` object containing:
@@ -445,7 +447,7 @@ async def filtered_event_workflow(ctx: WorkflowContext, user_id: str):
445
447
 
446
448
  ### Cancellation
447
449
 
448
- Workflows waiting for events can be cancelled:
450
+ Workflows waiting for events (`waiting_*`) can be cancelled. A workflow that is running its compensations cannot be cancelled; the compensations run to the end:
449
451
 
450
452
  ```python
451
453
  # Via API