tasker-engine 1.0.0

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 (605) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +443 -0
  4. data/Rakefile +10 -0
  5. data/app/controllers/tasker/analytics_controller.rb +179 -0
  6. data/app/controllers/tasker/application_controller.rb +45 -0
  7. data/app/controllers/tasker/graphql_controller.rb +193 -0
  8. data/app/controllers/tasker/handlers_controller.rb +217 -0
  9. data/app/controllers/tasker/health_controller.rb +229 -0
  10. data/app/controllers/tasker/metrics_controller.rb +111 -0
  11. data/app/controllers/tasker/page_sort.rb +97 -0
  12. data/app/controllers/tasker/task_diagrams_controller.rb +30 -0
  13. data/app/controllers/tasker/tasks_controller.rb +123 -0
  14. data/app/controllers/tasker/workflow_steps_controller.rb +69 -0
  15. data/app/graphql/examples/all_tasks.graphql +22 -0
  16. data/app/graphql/examples/pending_tasks.graphql +23 -0
  17. data/app/graphql/tasker/graph_ql_types/annotation_type.rb +14 -0
  18. data/app/graphql/tasker/graph_ql_types/base_argument.rb +9 -0
  19. data/app/graphql/tasker/graph_ql_types/base_connection.rb +11 -0
  20. data/app/graphql/tasker/graph_ql_types/base_edge.rb +10 -0
  21. data/app/graphql/tasker/graph_ql_types/base_enum.rb +9 -0
  22. data/app/graphql/tasker/graph_ql_types/base_field.rb +10 -0
  23. data/app/graphql/tasker/graph_ql_types/base_input_object.rb +10 -0
  24. data/app/graphql/tasker/graph_ql_types/base_interface.rb +14 -0
  25. data/app/graphql/tasker/graph_ql_types/base_object.rb +10 -0
  26. data/app/graphql/tasker/graph_ql_types/base_scalar.rb +9 -0
  27. data/app/graphql/tasker/graph_ql_types/base_union.rb +11 -0
  28. data/app/graphql/tasker/graph_ql_types/dependent_system_object_map_type.rb +18 -0
  29. data/app/graphql/tasker/graph_ql_types/dependent_system_type.rb +13 -0
  30. data/app/graphql/tasker/graph_ql_types/mutation_type.rb +16 -0
  31. data/app/graphql/tasker/graph_ql_types/named_step_type.rb +16 -0
  32. data/app/graphql/tasker/graph_ql_types/named_task_type.rb +14 -0
  33. data/app/graphql/tasker/graph_ql_types/named_tasks_named_step_type.rb +19 -0
  34. data/app/graphql/tasker/graph_ql_types/node_type.rb +12 -0
  35. data/app/graphql/tasker/graph_ql_types/query_type.rb +20 -0
  36. data/app/graphql/tasker/graph_ql_types/task_annotation_type.rb +17 -0
  37. data/app/graphql/tasker/graph_ql_types/task_interface.rb +17 -0
  38. data/app/graphql/tasker/graph_ql_types/task_type.rb +26 -0
  39. data/app/graphql/tasker/graph_ql_types/workflow_step_type.rb +154 -0
  40. data/app/graphql/tasker/graph_ql_types.rb +42 -0
  41. data/app/graphql/tasker/mutations/base_mutation.rb +13 -0
  42. data/app/graphql/tasker/mutations/cancel_step.rb +29 -0
  43. data/app/graphql/tasker/mutations/cancel_task.rb +29 -0
  44. data/app/graphql/tasker/mutations/create_task.rb +52 -0
  45. data/app/graphql/tasker/mutations/update_step.rb +36 -0
  46. data/app/graphql/tasker/mutations/update_task.rb +41 -0
  47. data/app/graphql/tasker/queries/all_annotation_types.rb +17 -0
  48. data/app/graphql/tasker/queries/all_tasks.rb +23 -0
  49. data/app/graphql/tasker/queries/base_query.rb +9 -0
  50. data/app/graphql/tasker/queries/helpers.rb +16 -0
  51. data/app/graphql/tasker/queries/one_step.rb +24 -0
  52. data/app/graphql/tasker/queries/one_task.rb +18 -0
  53. data/app/graphql/tasker/queries/tasks_by_annotation.rb +31 -0
  54. data/app/graphql/tasker/queries/tasks_by_status.rb +30 -0
  55. data/app/graphql/tasker/tasker_rails_schema.rb +52 -0
  56. data/app/jobs/tasker/application_job.rb +8 -0
  57. data/app/jobs/tasker/metrics_export_job.rb +252 -0
  58. data/app/jobs/tasker/task_runner_job.rb +224 -0
  59. data/app/models/tasker/annotation_type.rb +26 -0
  60. data/app/models/tasker/application_record.rb +70 -0
  61. data/app/models/tasker/dependent_system.rb +26 -0
  62. data/app/models/tasker/dependent_system_object_map.rb +64 -0
  63. data/app/models/tasker/diagram/edge.rb +106 -0
  64. data/app/models/tasker/diagram/flowchart.rb +137 -0
  65. data/app/models/tasker/diagram/node.rb +99 -0
  66. data/app/models/tasker/named_step.rb +41 -0
  67. data/app/models/tasker/named_task.rb +121 -0
  68. data/app/models/tasker/named_tasks_named_step.rb +82 -0
  69. data/app/models/tasker/step_dag_relationship.rb +65 -0
  70. data/app/models/tasker/step_readiness_status.rb +59 -0
  71. data/app/models/tasker/task.rb +424 -0
  72. data/app/models/tasker/task_annotation.rb +36 -0
  73. data/app/models/tasker/task_diagram.rb +332 -0
  74. data/app/models/tasker/task_execution_context.rb +29 -0
  75. data/app/models/tasker/task_namespace.rb +41 -0
  76. data/app/models/tasker/task_transition.rb +235 -0
  77. data/app/models/tasker/workflow_step.rb +461 -0
  78. data/app/models/tasker/workflow_step_edge.rb +94 -0
  79. data/app/models/tasker/workflow_step_transition.rb +434 -0
  80. data/app/serializers/tasker/annotation_type_serializer.rb +8 -0
  81. data/app/serializers/tasker/handler_serializer.rb +109 -0
  82. data/app/serializers/tasker/task_annotation_serializer.rb +32 -0
  83. data/app/serializers/tasker/task_serializer.rb +168 -0
  84. data/app/serializers/tasker/workflow_step_serializer.rb +27 -0
  85. data/app/services/tasker/analytics_service.rb +409 -0
  86. data/app/views/tasker/task/_diagram.html.erb +32 -0
  87. data/config/initializers/dry_struct.rb +11 -0
  88. data/config/initializers/statesman.rb +6 -0
  89. data/config/initializers/tasker_orchestration.rb +17 -0
  90. data/config/initializers/time_formats.rb +4 -0
  91. data/config/routes.rb +34 -0
  92. data/config/tasker/subscriptions/example_integrations.yml +67 -0
  93. data/config/tasker/system_events.yml +305 -0
  94. data/db/functions/calculate_dependency_levels_v01.sql +45 -0
  95. data/db/functions/get_analytics_metrics_v01.sql +137 -0
  96. data/db/functions/get_slowest_steps_v01.sql +82 -0
  97. data/db/functions/get_slowest_tasks_v01.sql +96 -0
  98. data/db/functions/get_step_readiness_status_batch_v01.sql +140 -0
  99. data/db/functions/get_step_readiness_status_v01.sql +139 -0
  100. data/db/functions/get_system_health_counts_v01.sql +108 -0
  101. data/db/functions/get_task_execution_context_v01.sql +108 -0
  102. data/db/functions/get_task_execution_contexts_batch_v01.sql +104 -0
  103. data/db/init/schema.sql +2277 -0
  104. data/db/migrate/20250701165431_initial_tasker_schema.rb +116 -0
  105. data/db/views/tasker_step_dag_relationships_v01.sql +69 -0
  106. data/docs/APPLICATION_GENERATOR.md +384 -0
  107. data/docs/AUTH.md +1780 -0
  108. data/docs/CIRCUIT_BREAKER.md +224 -0
  109. data/docs/DEVELOPER_GUIDE.md +2665 -0
  110. data/docs/EVENT_SYSTEM.md +637 -0
  111. data/docs/EXECUTION_CONFIGURATION.md +341 -0
  112. data/docs/FLOW_CHART.md +149 -0
  113. data/docs/HEALTH.md +542 -0
  114. data/docs/METRICS.md +731 -0
  115. data/docs/OPTIMIZATION_PLAN.md +1479 -0
  116. data/docs/OVERVIEW.md +552 -0
  117. data/docs/QUICK_START.md +270 -0
  118. data/docs/REGISTRY_SYSTEMS.md +373 -0
  119. data/docs/REST_API.md +632 -0
  120. data/docs/ROADMAP.md +221 -0
  121. data/docs/SQL_FUNCTIONS.md +1408 -0
  122. data/docs/TASK_DIAGRAM.md +252 -0
  123. data/docs/TASK_EXECUTION_CONTROL_FLOW.md +237 -0
  124. data/docs/TELEMETRY.md +795 -0
  125. data/docs/TROUBLESHOOTING.md +756 -0
  126. data/docs/TaskHandlerGenerator.html +255 -0
  127. data/docs/Tasker/Analysis/RuntimeGraphAnalyzer.html +907 -0
  128. data/docs/Tasker/Analysis/TemplateGraphAnalyzer.html +1236 -0
  129. data/docs/Tasker/Analysis.html +117 -0
  130. data/docs/Tasker/AnalyticsController.html +450 -0
  131. data/docs/Tasker/AnalyticsService/BottleneckAnalytics.html +816 -0
  132. data/docs/Tasker/AnalyticsService/PerformanceAnalytics.html +586 -0
  133. data/docs/Tasker/AnalyticsService.html +2221 -0
  134. data/docs/Tasker/AnnotationType.html +137 -0
  135. data/docs/Tasker/AnnotationTypeSerializer.html +124 -0
  136. data/docs/Tasker/ApplicationController.html +147 -0
  137. data/docs/Tasker/ApplicationJob.html +128 -0
  138. data/docs/Tasker/ApplicationRecord.html +378 -0
  139. data/docs/Tasker/Authentication/AuthenticationError.html +124 -0
  140. data/docs/Tasker/Authentication/ConfigurationError.html +124 -0
  141. data/docs/Tasker/Authentication/Coordinator.html +242 -0
  142. data/docs/Tasker/Authentication/Interface.html +560 -0
  143. data/docs/Tasker/Authentication/InterfaceError.html +124 -0
  144. data/docs/Tasker/Authentication/NoneAuthenticator.html +338 -0
  145. data/docs/Tasker/Authentication.html +119 -0
  146. data/docs/Tasker/Authorization/AuthorizationError.html +139 -0
  147. data/docs/Tasker/Authorization/BaseCoordinator.html +927 -0
  148. data/docs/Tasker/Authorization/ConfigurationError.html +153 -0
  149. data/docs/Tasker/Authorization/ResourceConstants/ACTIONS.html +428 -0
  150. data/docs/Tasker/Authorization/ResourceConstants/RESOURCES.html +365 -0
  151. data/docs/Tasker/Authorization/ResourceConstants.html +146 -0
  152. data/docs/Tasker/Authorization/ResourceRegistry.html +882 -0
  153. data/docs/Tasker/Authorization/UnauthorizedError.html +153 -0
  154. data/docs/Tasker/Authorization.html +582 -0
  155. data/docs/Tasker/CacheCapabilities.html +167 -0
  156. data/docs/Tasker/CacheStrategy.html +1297 -0
  157. data/docs/Tasker/Concerns/Authenticatable.html +116 -0
  158. data/docs/Tasker/Concerns/Authorizable/AdminStatusChecker.html +256 -0
  159. data/docs/Tasker/Concerns/Authorizable.html +816 -0
  160. data/docs/Tasker/Concerns/ControllerAuthorizable.html +157 -0
  161. data/docs/Tasker/Concerns/EventPublisher.html +4023 -0
  162. data/docs/Tasker/Concerns/IdempotentStateTransitions.html +806 -0
  163. data/docs/Tasker/Concerns/LifecycleEventHelpers.html +129 -0
  164. data/docs/Tasker/Concerns/OrchestrationPublisher.html +129 -0
  165. data/docs/Tasker/Concerns/StateMachineBase/ClassMethods.html +1075 -0
  166. data/docs/Tasker/Concerns/StateMachineBase/StateMachineBase/ClassMethods.html +191 -0
  167. data/docs/Tasker/Concerns/StateMachineBase/StateMachineBase.html +126 -0
  168. data/docs/Tasker/Concerns/StateMachineBase.html +153 -0
  169. data/docs/Tasker/Concerns/StructuredLogging.html +1413 -0
  170. data/docs/Tasker/Concerns.html +117 -0
  171. data/docs/Tasker/Configuration/AuthConfiguration.html +1023 -0
  172. data/docs/Tasker/Configuration/ConfigurationProxy.html +581 -0
  173. data/docs/Tasker/Configuration/DatabaseConfiguration.html +475 -0
  174. data/docs/Tasker/Configuration/EngineConfiguration.html +1265 -0
  175. data/docs/Tasker/Configuration/HealthConfiguration.html +791 -0
  176. data/docs/Tasker/Configuration/TelemetryConfiguration.html +1308 -0
  177. data/docs/Tasker/Configuration/TelemetryConfigurationProxy.html +388 -0
  178. data/docs/Tasker/Configuration.html +1669 -0
  179. data/docs/Tasker/ConfigurationError.html +143 -0
  180. data/docs/Tasker/ConfiguredTask.html +514 -0
  181. data/docs/Tasker/Constants/EventDefinitions.html +590 -0
  182. data/docs/Tasker/Constants/LifecycleEvents.html +137 -0
  183. data/docs/Tasker/Constants/ObservabilityEvents/Step.html +152 -0
  184. data/docs/Tasker/Constants/ObservabilityEvents/Task.html +142 -0
  185. data/docs/Tasker/Constants/ObservabilityEvents.html +126 -0
  186. data/docs/Tasker/Constants/RegistryEvents.html +285 -0
  187. data/docs/Tasker/Constants/StepEvents.html +177 -0
  188. data/docs/Tasker/Constants/TaskEvents.html +167 -0
  189. data/docs/Tasker/Constants/TaskExecution/ExecutionStatus.html +207 -0
  190. data/docs/Tasker/Constants/TaskExecution/HealthStatus.html +191 -0
  191. data/docs/Tasker/Constants/TaskExecution/RecommendedAction.html +207 -0
  192. data/docs/Tasker/Constants/TaskExecution.html +126 -0
  193. data/docs/Tasker/Constants/TaskFinalization/ErrorMessages.html +132 -0
  194. data/docs/Tasker/Constants/TaskFinalization/PendingReasons.html +207 -0
  195. data/docs/Tasker/Constants/TaskFinalization/ReenqueueReasons.html +239 -0
  196. data/docs/Tasker/Constants/TaskFinalization.html +126 -0
  197. data/docs/Tasker/Constants/TaskStatuses.html +223 -0
  198. data/docs/Tasker/Constants/TestEvents.html +163 -0
  199. data/docs/Tasker/Constants/WorkflowEvents.html +222 -0
  200. data/docs/Tasker/Constants/WorkflowStepStatuses.html +223 -0
  201. data/docs/Tasker/Constants.html +561 -0
  202. data/docs/Tasker/DependentSystem.html +137 -0
  203. data/docs/Tasker/DependentSystemObjectMap.html +250 -0
  204. data/docs/Tasker/DetectorRegistry.html +598 -0
  205. data/docs/Tasker/Diagram/Edge.html +1191 -0
  206. data/docs/Tasker/Diagram/Flowchart.html +1539 -0
  207. data/docs/Tasker/Diagram/Node.html +1165 -0
  208. data/docs/Tasker/Diagram.html +117 -0
  209. data/docs/Tasker/Engine.html +215 -0
  210. data/docs/Tasker/Error.html +139 -0
  211. data/docs/Tasker/Events/Bus.html +1226 -0
  212. data/docs/Tasker/Events/Catalog/CatalogPrinter.html +258 -0
  213. data/docs/Tasker/Events/Catalog/CustomEventRegistrar.html +276 -0
  214. data/docs/Tasker/Events/Catalog/ExamplePayloadGenerator.html +294 -0
  215. data/docs/Tasker/Events/Catalog.html +1291 -0
  216. data/docs/Tasker/Events/CustomRegistry.html +943 -0
  217. data/docs/Tasker/Events/DefinitionLoader.html +575 -0
  218. data/docs/Tasker/Events/EventPayloadBuilder/ErrorInfoExtractor.html +286 -0
  219. data/docs/Tasker/Events/EventPayloadBuilder/StepPayloadBuilder.html +312 -0
  220. data/docs/Tasker/Events/EventPayloadBuilder.html +664 -0
  221. data/docs/Tasker/Events/Publisher.html +365 -0
  222. data/docs/Tasker/Events/Subscribers/BaseSubscriber/ErrorCategorizer/ErrorTypeClassifier.html +1128 -0
  223. data/docs/Tasker/Events/Subscribers/BaseSubscriber/ErrorCategorizer.html +270 -0
  224. data/docs/Tasker/Events/Subscribers/BaseSubscriber/MetricTagsExtractor.html +266 -0
  225. data/docs/Tasker/Events/Subscribers/BaseSubscriber.html +2556 -0
  226. data/docs/Tasker/Events/Subscribers/MetricsSubscriber.html +723 -0
  227. data/docs/Tasker/Events/Subscribers/TelemetrySubscriber.html +2251 -0
  228. data/docs/Tasker/Events/Subscribers.html +117 -0
  229. data/docs/Tasker/Events/SubscriptionLoader.html +493 -0
  230. data/docs/Tasker/Events.html +294 -0
  231. data/docs/Tasker/EventsGenerator.html +459 -0
  232. data/docs/Tasker/Functions/FunctionBasedAnalyticsMetrics/AnalyticsMetrics.html +135 -0
  233. data/docs/Tasker/Functions/FunctionBasedAnalyticsMetrics.html +412 -0
  234. data/docs/Tasker/Functions/FunctionBasedDependencyLevels.html +598 -0
  235. data/docs/Tasker/Functions/FunctionBasedSlowestSteps/SlowestStep.html +135 -0
  236. data/docs/Tasker/Functions/FunctionBasedSlowestSteps.html +453 -0
  237. data/docs/Tasker/Functions/FunctionBasedSlowestTasks/SlowestTask.html +135 -0
  238. data/docs/Tasker/Functions/FunctionBasedSlowestTasks.html +453 -0
  239. data/docs/Tasker/Functions/FunctionBasedStepReadinessStatus.html +1457 -0
  240. data/docs/Tasker/Functions/FunctionBasedSystemHealthCounts/HealthMetrics.html +135 -0
  241. data/docs/Tasker/Functions/FunctionBasedSystemHealthCounts.html +370 -0
  242. data/docs/Tasker/Functions/FunctionBasedTaskExecutionContext.html +1250 -0
  243. data/docs/Tasker/Functions/FunctionWrapper.html +479 -0
  244. data/docs/Tasker/Functions.html +117 -0
  245. data/docs/Tasker/Generators/AuthenticatorGenerator/UsageInstructionsFormatter.html +244 -0
  246. data/docs/Tasker/Generators/AuthenticatorGenerator.html +373 -0
  247. data/docs/Tasker/Generators/AuthorizationCoordinatorGenerator.html +430 -0
  248. data/docs/Tasker/Generators/SubscriberGenerator.html +377 -0
  249. data/docs/Tasker/Generators/TaskHandlerGenerator.html +263 -0
  250. data/docs/Tasker/Generators.html +117 -0
  251. data/docs/Tasker/GraphQLTypes/AnnotationType.html +132 -0
  252. data/docs/Tasker/GraphQLTypes/BaseArgument.html +124 -0
  253. data/docs/Tasker/GraphQLTypes/BaseConnection.html +124 -0
  254. data/docs/Tasker/GraphQLTypes/BaseEdge.html +130 -0
  255. data/docs/Tasker/GraphQLTypes/BaseEnum.html +124 -0
  256. data/docs/Tasker/GraphQLTypes/BaseField.html +124 -0
  257. data/docs/Tasker/GraphQLTypes/BaseInputObject.html +124 -0
  258. data/docs/Tasker/GraphQLTypes/BaseInterface.html +116 -0
  259. data/docs/Tasker/GraphQLTypes/BaseObject.html +128 -0
  260. data/docs/Tasker/GraphQLTypes/BaseScalar.html +124 -0
  261. data/docs/Tasker/GraphQLTypes/BaseUnion.html +124 -0
  262. data/docs/Tasker/GraphQLTypes/DependentSystemObjectMapType.html +132 -0
  263. data/docs/Tasker/GraphQLTypes/DependentSystemType.html +132 -0
  264. data/docs/Tasker/GraphQLTypes/MutationType.html +132 -0
  265. data/docs/Tasker/GraphQLTypes/NamedStepType.html +132 -0
  266. data/docs/Tasker/GraphQLTypes/NamedTaskType.html +132 -0
  267. data/docs/Tasker/GraphQLTypes/NamedTasksNamedStepType.html +132 -0
  268. data/docs/Tasker/GraphQLTypes/NodeType.html +118 -0
  269. data/docs/Tasker/GraphQLTypes/QueryType.html +139 -0
  270. data/docs/Tasker/GraphQLTypes/TaskAnnotationType.html +132 -0
  271. data/docs/Tasker/GraphQLTypes/TaskInterface.html +111 -0
  272. data/docs/Tasker/GraphQLTypes/TaskType.html +201 -0
  273. data/docs/Tasker/GraphQLTypes/WorkflowStepType.html +694 -0
  274. data/docs/Tasker/GraphQLTypes.html +130 -0
  275. data/docs/Tasker/GraphqlController.html +251 -0
  276. data/docs/Tasker/HandlerFactory.html +1518 -0
  277. data/docs/Tasker/HandlerSerializer.html +682 -0
  278. data/docs/Tasker/HandlersController.html +574 -0
  279. data/docs/Tasker/HashIdentityStrategy.html +278 -0
  280. data/docs/Tasker/Health/ReadinessChecker.html +712 -0
  281. data/docs/Tasker/Health/StatusChecker.html +653 -0
  282. data/docs/Tasker/Health.html +117 -0
  283. data/docs/Tasker/HealthController.html +523 -0
  284. data/docs/Tasker/IdentityStrategy.html +276 -0
  285. data/docs/Tasker/InvalidTaskHandlerConfig.html +135 -0
  286. data/docs/Tasker/LifecycleEvents/Events/Step.html +162 -0
  287. data/docs/Tasker/LifecycleEvents/Events/Task.html +162 -0
  288. data/docs/Tasker/LifecycleEvents/Events.html +204 -0
  289. data/docs/Tasker/LifecycleEvents/Publisher.html +132 -0
  290. data/docs/Tasker/LifecycleEvents.html +799 -0
  291. data/docs/Tasker/Logging/CorrelationIdGenerator.html +688 -0
  292. data/docs/Tasker/Logging.html +115 -0
  293. data/docs/Tasker/MetricsController.html +293 -0
  294. data/docs/Tasker/MetricsExportJob.html +414 -0
  295. data/docs/Tasker/Mutations/BaseMutation.html +128 -0
  296. data/docs/Tasker/Mutations/CancelStep.html +219 -0
  297. data/docs/Tasker/Mutations/CancelTask.html +221 -0
  298. data/docs/Tasker/Mutations/CreateTask.html +243 -0
  299. data/docs/Tasker/Mutations/UpdateStep.html +243 -0
  300. data/docs/Tasker/Mutations/UpdateTask.html +243 -0
  301. data/docs/Tasker/Mutations.html +117 -0
  302. data/docs/Tasker/NamedStep.html +216 -0
  303. data/docs/Tasker/NamedTask.html +910 -0
  304. data/docs/Tasker/NamedTasksNamedStep.html +435 -0
  305. data/docs/Tasker/Orchestration/BackoffCalculator.html +404 -0
  306. data/docs/Tasker/Orchestration/ConnectionBuilder/ConfigValidator.html +258 -0
  307. data/docs/Tasker/Orchestration/ConnectionBuilder.html +435 -0
  308. data/docs/Tasker/Orchestration/ConnectionPoolIntelligence.html +513 -0
  309. data/docs/Tasker/Orchestration/Coordinator.html +641 -0
  310. data/docs/Tasker/Orchestration/FutureStateAnalyzer.html +1045 -0
  311. data/docs/Tasker/Orchestration/Orchestrator.html +679 -0
  312. data/docs/Tasker/Orchestration/PluginIntegration.html +1127 -0
  313. data/docs/Tasker/Orchestration/ResponseProcessor.html +504 -0
  314. data/docs/Tasker/Orchestration/RetryHeaderParser.html +304 -0
  315. data/docs/Tasker/Orchestration/StepExecutor.html +995 -0
  316. data/docs/Tasker/Orchestration/StepSequenceFactory.html +644 -0
  317. data/docs/Tasker/Orchestration/TaskFinalizer/BlockageChecker.html +264 -0
  318. data/docs/Tasker/Orchestration/TaskFinalizer/ContextManager.html +254 -0
  319. data/docs/Tasker/Orchestration/TaskFinalizer/DelayCalculator.html +556 -0
  320. data/docs/Tasker/Orchestration/TaskFinalizer/FinalizationDecisionMaker.html +348 -0
  321. data/docs/Tasker/Orchestration/TaskFinalizer/FinalizationProcessor.html +286 -0
  322. data/docs/Tasker/Orchestration/TaskFinalizer/ReasonDeterminer.html +432 -0
  323. data/docs/Tasker/Orchestration/TaskFinalizer/ReenqueueManager.html +296 -0
  324. data/docs/Tasker/Orchestration/TaskFinalizer/UnclearStateHandler.html +314 -0
  325. data/docs/Tasker/Orchestration/TaskFinalizer.html +1212 -0
  326. data/docs/Tasker/Orchestration/TaskInitializer.html +766 -0
  327. data/docs/Tasker/Orchestration/TaskReenqueuer.html +506 -0
  328. data/docs/Tasker/Orchestration/ViableStepDiscovery.html +442 -0
  329. data/docs/Tasker/Orchestration/WorkflowCoordinator.html +510 -0
  330. data/docs/Tasker/Orchestration.html +130 -0
  331. data/docs/Tasker/PageSort/PageSortParamsBuilder.html +296 -0
  332. data/docs/Tasker/PageSort.html +247 -0
  333. data/docs/Tasker/PermanentError.html +518 -0
  334. data/docs/Tasker/ProceduralError.html +147 -0
  335. data/docs/Tasker/Queries/AllAnnotationTypes.html +217 -0
  336. data/docs/Tasker/Queries/AllTasks.html +221 -0
  337. data/docs/Tasker/Queries/BaseQuery.html +128 -0
  338. data/docs/Tasker/Queries/Helpers.html +187 -0
  339. data/docs/Tasker/Queries/OneStep.html +225 -0
  340. data/docs/Tasker/Queries/OneTask.html +217 -0
  341. data/docs/Tasker/Queries/TasksByAnnotation.html +231 -0
  342. data/docs/Tasker/Queries/TasksByStatus.html +233 -0
  343. data/docs/Tasker/Queries.html +119 -0
  344. data/docs/Tasker/Railtie.html +124 -0
  345. data/docs/Tasker/Registry/BaseRegistry.html +1690 -0
  346. data/docs/Tasker/Registry/EventPublisher.html +667 -0
  347. data/docs/Tasker/Registry/InterfaceValidator.html +569 -0
  348. data/docs/Tasker/Registry/RegistrationError.html +132 -0
  349. data/docs/Tasker/Registry/RegistryError.html +139 -0
  350. data/docs/Tasker/Registry/StatisticsCollector.html +841 -0
  351. data/docs/Tasker/Registry/SubscriberRegistry.html +1504 -0
  352. data/docs/Tasker/Registry/ValidationError.html +132 -0
  353. data/docs/Tasker/Registry.html +119 -0
  354. data/docs/Tasker/RetryableError.html +515 -0
  355. data/docs/Tasker/StateMachine/Compatibility.html +282 -0
  356. data/docs/Tasker/StateMachine/InvalidStateTransition.html +135 -0
  357. data/docs/Tasker/StateMachine/StepStateMachine/StandardizedPayloadBuilder.html +260 -0
  358. data/docs/Tasker/StateMachine/StepStateMachine.html +2215 -0
  359. data/docs/Tasker/StateMachine/TaskStateMachine.html +734 -0
  360. data/docs/Tasker/StateMachine.html +602 -0
  361. data/docs/Tasker/StepDagRelationship.html +657 -0
  362. data/docs/Tasker/StepHandler/Api/Config.html +1091 -0
  363. data/docs/Tasker/StepHandler/Api.html +884 -0
  364. data/docs/Tasker/StepHandler/AutomaticEventPublishing.html +321 -0
  365. data/docs/Tasker/StepHandler/Base.html +970 -0
  366. data/docs/Tasker/StepHandler.html +119 -0
  367. data/docs/Tasker/StepReadinessStatus.html +836 -0
  368. data/docs/Tasker/Task.html +2575 -0
  369. data/docs/Tasker/TaskAnnotation.html +137 -0
  370. data/docs/Tasker/TaskAnnotationSerializer.html +124 -0
  371. data/docs/Tasker/TaskBuilder/StepNameValidator.html +264 -0
  372. data/docs/Tasker/TaskBuilder/StepTemplateDefiner.html +264 -0
  373. data/docs/Tasker/TaskBuilder.html +764 -0
  374. data/docs/Tasker/TaskDiagram/StepToStepEdgeBuilder.html +260 -0
  375. data/docs/Tasker/TaskDiagram/TaskToRootStepEdgeBuilder.html +290 -0
  376. data/docs/Tasker/TaskDiagram.html +548 -0
  377. data/docs/Tasker/TaskDiagramsController.html +240 -0
  378. data/docs/Tasker/TaskExecutionContext.html +469 -0
  379. data/docs/Tasker/TaskHandler/ClassMethods/StepTemplateDefiner/ClassBasedEventRegistrar.html +238 -0
  380. data/docs/Tasker/TaskHandler/ClassMethods/StepTemplateDefiner/YamlEventRegistrar.html +254 -0
  381. data/docs/Tasker/TaskHandler/ClassMethods/StepTemplateDefiner.html +988 -0
  382. data/docs/Tasker/TaskHandler/ClassMethods.html +357 -0
  383. data/docs/Tasker/TaskHandler/InstanceMethods.html +1396 -0
  384. data/docs/Tasker/TaskHandler/StepGroup.html +1748 -0
  385. data/docs/Tasker/TaskHandler.html +271 -0
  386. data/docs/Tasker/TaskNamespace.html +312 -0
  387. data/docs/Tasker/TaskRunnerJob.html +406 -0
  388. data/docs/Tasker/TaskSerializer.html +474 -0
  389. data/docs/Tasker/TaskTransition.html +1517 -0
  390. data/docs/Tasker/TaskWorkflowSummary.html +988 -0
  391. data/docs/Tasker/TaskerRailsSchema/InvalidObjectTypeError.html +132 -0
  392. data/docs/Tasker/TaskerRailsSchema/TypeResolutionError.html +139 -0
  393. data/docs/Tasker/TaskerRailsSchema/UnknownInterfaceError.html +132 -0
  394. data/docs/Tasker/TaskerRailsSchema.html +384 -0
  395. data/docs/Tasker/TasksController.html +595 -0
  396. data/docs/Tasker/Telemetry/EventMapping.html +1307 -0
  397. data/docs/Tasker/Telemetry/EventRouter.html +2178 -0
  398. data/docs/Tasker/Telemetry/Events/ExportEvents.html +246 -0
  399. data/docs/Tasker/Telemetry/Events.html +115 -0
  400. data/docs/Tasker/Telemetry/ExportCoordinator/DistributedLockTimeoutError.html +135 -0
  401. data/docs/Tasker/Telemetry/ExportCoordinator.html +2137 -0
  402. data/docs/Tasker/Telemetry/IntelligentCacheManager.html +1083 -0
  403. data/docs/Tasker/Telemetry/LogBackend.html +1088 -0
  404. data/docs/Tasker/Telemetry/MetricTypes/Counter.html +1054 -0
  405. data/docs/Tasker/Telemetry/MetricTypes/Gauge.html +1270 -0
  406. data/docs/Tasker/Telemetry/MetricTypes/Histogram.html +1492 -0
  407. data/docs/Tasker/Telemetry/MetricTypes.html +153 -0
  408. data/docs/Tasker/Telemetry/MetricsBackend.html +2510 -0
  409. data/docs/Tasker/Telemetry/MetricsExportService.html +578 -0
  410. data/docs/Tasker/Telemetry/PluginRegistry.html +1774 -0
  411. data/docs/Tasker/Telemetry/Plugins/BaseExporter.html +1835 -0
  412. data/docs/Tasker/Telemetry/Plugins/CsvExporter.html +768 -0
  413. data/docs/Tasker/Telemetry/Plugins/JsonExporter.html +747 -0
  414. data/docs/Tasker/Telemetry/Plugins.html +117 -0
  415. data/docs/Tasker/Telemetry/PrometheusExporter.html +481 -0
  416. data/docs/Tasker/Telemetry/TraceBackend.html +891 -0
  417. data/docs/Tasker/Telemetry.html +130 -0
  418. data/docs/Tasker/Types/AuthConfig.html +886 -0
  419. data/docs/Tasker/Types/BackoffConfig.html +1063 -0
  420. data/docs/Tasker/Types/BaseConfig.html +227 -0
  421. data/docs/Tasker/Types/CacheConfig.html +1731 -0
  422. data/docs/Tasker/Types/DatabaseConfig.html +388 -0
  423. data/docs/Tasker/Types/DependencyGraph.html +526 -0
  424. data/docs/Tasker/Types/DependencyGraphConfig.html +753 -0
  425. data/docs/Tasker/Types/EngineConfig.html +1181 -0
  426. data/docs/Tasker/Types/ExecutionConfig.html +1963 -0
  427. data/docs/Tasker/Types/GraphEdge.html +517 -0
  428. data/docs/Tasker/Types/GraphMetadata.html +781 -0
  429. data/docs/Tasker/Types/GraphNode.html +694 -0
  430. data/docs/Tasker/Types/HealthConfig.html +784 -0
  431. data/docs/Tasker/Types/StepSequence.html +353 -0
  432. data/docs/Tasker/Types/StepTemplate.html +1193 -0
  433. data/docs/Tasker/Types/TaskRequest.html +1179 -0
  434. data/docs/Tasker/Types/TelemetryConfig.html +2746 -0
  435. data/docs/Tasker/Types.html +154 -0
  436. data/docs/Tasker/WorkflowStep/StepFinder.html +282 -0
  437. data/docs/Tasker/WorkflowStep.html +2724 -0
  438. data/docs/Tasker/WorkflowStepEdge.html +304 -0
  439. data/docs/Tasker/WorkflowStepSerializer.html +305 -0
  440. data/docs/Tasker/WorkflowStepTransition/TransitionDescriptionFormatter.html +282 -0
  441. data/docs/Tasker/WorkflowStepTransition.html +2201 -0
  442. data/docs/Tasker/WorkflowStepsController.html +462 -0
  443. data/docs/Tasker.html +452 -0
  444. data/docs/VISION.md +584 -0
  445. data/docs/WHY.md +21 -0
  446. data/docs/_index.html +2375 -0
  447. data/docs/class_list.html +54 -0
  448. data/docs/css/common.css +1 -0
  449. data/docs/css/full_list.css +58 -0
  450. data/docs/css/style.css +503 -0
  451. data/docs/events/migration_plan_outcomes.md +80 -0
  452. data/docs/file.README.html +541 -0
  453. data/docs/file_list.html +59 -0
  454. data/docs/frames.html +22 -0
  455. data/docs/index.html +541 -0
  456. data/docs/js/app.js +344 -0
  457. data/docs/js/full_list.js +242 -0
  458. data/docs/js/jquery.js +4 -0
  459. data/docs/method_list.html +9182 -0
  460. data/docs/top-level-namespace.html +110 -0
  461. data/lib/generators/tasker/authenticator_generator.rb +301 -0
  462. data/lib/generators/tasker/authorization_coordinator_generator.rb +139 -0
  463. data/lib/generators/tasker/events_generator.rb +91 -0
  464. data/lib/generators/tasker/subscriber_generator.rb +107 -0
  465. data/lib/generators/tasker/task_handler_generator.rb +138 -0
  466. data/lib/generators/tasker/templates/api_token_authenticator.rb.erb +113 -0
  467. data/lib/generators/tasker/templates/api_token_authenticator_spec.rb.erb +144 -0
  468. data/lib/generators/tasker/templates/authorization_coordinator.rb.erb +95 -0
  469. data/lib/generators/tasker/templates/authorization_coordinator_spec.rb.erb +142 -0
  470. data/lib/generators/tasker/templates/custom_authenticator.rb.erb +108 -0
  471. data/lib/generators/tasker/templates/custom_authenticator_spec.rb.erb +162 -0
  472. data/lib/generators/tasker/templates/custom_events.yml.erb +62 -0
  473. data/lib/generators/tasker/templates/custom_subscriber.rb.erb +72 -0
  474. data/lib/generators/tasker/templates/devise_authenticator.rb.erb +101 -0
  475. data/lib/generators/tasker/templates/devise_authenticator_spec.rb.erb +126 -0
  476. data/lib/generators/tasker/templates/initialize.rb.erb +202 -0
  477. data/lib/generators/tasker/templates/jwt_authenticator.rb.erb +144 -0
  478. data/lib/generators/tasker/templates/jwt_authenticator_spec.rb.erb +298 -0
  479. data/lib/generators/tasker/templates/metrics_subscriber.rb.erb +258 -0
  480. data/lib/generators/tasker/templates/metrics_subscriber_spec.rb.erb +308 -0
  481. data/lib/generators/tasker/templates/omniauth_authenticator.rb.erb +135 -0
  482. data/lib/generators/tasker/templates/omniauth_authenticator_spec.rb.erb +196 -0
  483. data/lib/generators/tasker/templates/opentelemetry_initializer.rb +52 -0
  484. data/lib/generators/tasker/templates/subscriber.rb.erb +64 -0
  485. data/lib/generators/tasker/templates/subscriber_spec.rb.erb +80 -0
  486. data/lib/generators/tasker/templates/task_config.yaml.erb +117 -0
  487. data/lib/generators/tasker/templates/task_handler.rb.erb +59 -0
  488. data/lib/generators/tasker/templates/task_handler_spec.rb.erb +159 -0
  489. data/lib/tasker/analysis/runtime_graph_analyzer.rb +1168 -0
  490. data/lib/tasker/analysis/template_graph_analyzer.rb +328 -0
  491. data/lib/tasker/authentication/coordinator.rb +78 -0
  492. data/lib/tasker/authentication/errors.rb +9 -0
  493. data/lib/tasker/authentication/interface.rb +36 -0
  494. data/lib/tasker/authentication/none_authenticator.rb +26 -0
  495. data/lib/tasker/authorization/base_coordinator.rb +112 -0
  496. data/lib/tasker/authorization/errors.rb +26 -0
  497. data/lib/tasker/authorization/resource_constants.rb +74 -0
  498. data/lib/tasker/authorization/resource_registry.rb +143 -0
  499. data/lib/tasker/authorization.rb +75 -0
  500. data/lib/tasker/cache_capabilities.rb +131 -0
  501. data/lib/tasker/cache_strategy.rb +469 -0
  502. data/lib/tasker/concerns/authenticatable.rb +41 -0
  503. data/lib/tasker/concerns/authorizable.rb +204 -0
  504. data/lib/tasker/concerns/controller_authorizable.rb +124 -0
  505. data/lib/tasker/concerns/event_publisher.rb +716 -0
  506. data/lib/tasker/concerns/idempotent_state_transitions.rb +128 -0
  507. data/lib/tasker/concerns/state_machine_base.rb +218 -0
  508. data/lib/tasker/concerns/structured_logging.rb +387 -0
  509. data/lib/tasker/configuration.rb +325 -0
  510. data/lib/tasker/constants/event_definitions.rb +147 -0
  511. data/lib/tasker/constants/registry_events.rb +54 -0
  512. data/lib/tasker/constants.rb +417 -0
  513. data/lib/tasker/engine.rb +90 -0
  514. data/lib/tasker/errors.rb +90 -0
  515. data/lib/tasker/events/catalog.rb +432 -0
  516. data/lib/tasker/events/custom_registry.rb +175 -0
  517. data/lib/tasker/events/definition_loader.rb +199 -0
  518. data/lib/tasker/events/event_payload_builder.rb +461 -0
  519. data/lib/tasker/events/publisher.rb +149 -0
  520. data/lib/tasker/events/subscribers/base_subscriber.rb +601 -0
  521. data/lib/tasker/events/subscribers/metrics_subscriber.rb +120 -0
  522. data/lib/tasker/events/subscribers/telemetry_subscriber.rb +462 -0
  523. data/lib/tasker/events/subscription_loader.rb +161 -0
  524. data/lib/tasker/events.rb +37 -0
  525. data/lib/tasker/functions/function_based_analytics_metrics.rb +103 -0
  526. data/lib/tasker/functions/function_based_dependency_levels.rb +54 -0
  527. data/lib/tasker/functions/function_based_slowest_steps.rb +84 -0
  528. data/lib/tasker/functions/function_based_slowest_tasks.rb +84 -0
  529. data/lib/tasker/functions/function_based_step_readiness_status.rb +183 -0
  530. data/lib/tasker/functions/function_based_system_health_counts.rb +94 -0
  531. data/lib/tasker/functions/function_based_task_execution_context.rb +148 -0
  532. data/lib/tasker/functions/function_wrapper.rb +42 -0
  533. data/lib/tasker/functions.rb +12 -0
  534. data/lib/tasker/handler_factory.rb +322 -0
  535. data/lib/tasker/health/readiness_checker.rb +186 -0
  536. data/lib/tasker/health/status_checker.rb +203 -0
  537. data/lib/tasker/identity_strategy.rb +38 -0
  538. data/lib/tasker/logging/correlation_id_generator.rb +120 -0
  539. data/lib/tasker/orchestration/backoff_calculator.rb +184 -0
  540. data/lib/tasker/orchestration/connection_builder.rb +122 -0
  541. data/lib/tasker/orchestration/connection_pool_intelligence.rb +177 -0
  542. data/lib/tasker/orchestration/coordinator.rb +119 -0
  543. data/lib/tasker/orchestration/future_state_analyzer.rb +137 -0
  544. data/lib/tasker/orchestration/plugin_integration.rb +124 -0
  545. data/lib/tasker/orchestration/response_processor.rb +168 -0
  546. data/lib/tasker/orchestration/retry_header_parser.rb +78 -0
  547. data/lib/tasker/orchestration/step_executor.rb +941 -0
  548. data/lib/tasker/orchestration/step_sequence_factory.rb +67 -0
  549. data/lib/tasker/orchestration/task_finalizer.rb +564 -0
  550. data/lib/tasker/orchestration/task_initializer.rb +140 -0
  551. data/lib/tasker/orchestration/task_reenqueuer.rb +71 -0
  552. data/lib/tasker/orchestration/viable_step_discovery.rb +65 -0
  553. data/lib/tasker/orchestration/workflow_coordinator.rb +294 -0
  554. data/lib/tasker/orchestration.rb +45 -0
  555. data/lib/tasker/railtie.rb +9 -0
  556. data/lib/tasker/registry/base_registry.rb +177 -0
  557. data/lib/tasker/registry/event_publisher.rb +91 -0
  558. data/lib/tasker/registry/interface_validator.rb +140 -0
  559. data/lib/tasker/registry/statistics_collector.rb +381 -0
  560. data/lib/tasker/registry/subscriber_registry.rb +285 -0
  561. data/lib/tasker/registry.rb +22 -0
  562. data/lib/tasker/state_machine/step_state_machine.rb +508 -0
  563. data/lib/tasker/state_machine/task_state_machine.rb +192 -0
  564. data/lib/tasker/state_machine.rb +83 -0
  565. data/lib/tasker/step_handler/api.rb +410 -0
  566. data/lib/tasker/step_handler/base.rb +206 -0
  567. data/lib/tasker/task_builder.rb +432 -0
  568. data/lib/tasker/task_handler/class_methods.rb +324 -0
  569. data/lib/tasker/task_handler/instance_methods.rb +293 -0
  570. data/lib/tasker/task_handler/step_group.rb +182 -0
  571. data/lib/tasker/task_handler.rb +43 -0
  572. data/lib/tasker/telemetry/event_mapping.rb +126 -0
  573. data/lib/tasker/telemetry/event_router.rb +318 -0
  574. data/lib/tasker/telemetry/events/export_events.rb +38 -0
  575. data/lib/tasker/telemetry/export_coordinator.rb +497 -0
  576. data/lib/tasker/telemetry/intelligent_cache_manager.rb +508 -0
  577. data/lib/tasker/telemetry/log_backend.rb +224 -0
  578. data/lib/tasker/telemetry/metric_types.rb +368 -0
  579. data/lib/tasker/telemetry/metrics_backend.rb +1227 -0
  580. data/lib/tasker/telemetry/metrics_export_service.rb +392 -0
  581. data/lib/tasker/telemetry/plugin_registry.rb +333 -0
  582. data/lib/tasker/telemetry/plugins/base_exporter.rb +246 -0
  583. data/lib/tasker/telemetry/plugins/csv_exporter.rb +198 -0
  584. data/lib/tasker/telemetry/plugins/json_exporter.rb +141 -0
  585. data/lib/tasker/telemetry/prometheus_exporter.rb +249 -0
  586. data/lib/tasker/telemetry/trace_backend.rb +186 -0
  587. data/lib/tasker/telemetry.rb +59 -0
  588. data/lib/tasker/types/auth_config.rb +81 -0
  589. data/lib/tasker/types/backoff_config.rb +142 -0
  590. data/lib/tasker/types/cache_config.rb +257 -0
  591. data/lib/tasker/types/database_config.rb +39 -0
  592. data/lib/tasker/types/dependency_graph.rb +225 -0
  593. data/lib/tasker/types/dependency_graph_config.rb +149 -0
  594. data/lib/tasker/types/engine_config.rb +131 -0
  595. data/lib/tasker/types/execution_config.rb +289 -0
  596. data/lib/tasker/types/health_config.rb +84 -0
  597. data/lib/tasker/types/step_sequence.rb +24 -0
  598. data/lib/tasker/types/step_template.rb +63 -0
  599. data/lib/tasker/types/task_request.rb +60 -0
  600. data/lib/tasker/types/telemetry_config.rb +273 -0
  601. data/lib/tasker/types.rb +64 -0
  602. data/lib/tasker/version.rb +7 -0
  603. data/lib/tasker.rb +82 -0
  604. data/lib/tasks/tasker_tasks.rake +302 -0
  605. metadata +958 -0
@@ -0,0 +1,2215 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Tasker::StateMachine::StepStateMachine
8
+
9
+ &mdash; Documentation by YARD 0.9.37
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Tasker::StateMachine::StepStateMachine";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../StateMachine.html" title="Tasker::StateMachine (module)">StateMachine</a></span></span>
41
+ &raquo;
42
+ <span class="title">StepStateMachine</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Tasker::StateMachine::StepStateMachine
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Tasker::StateMachine::StepStateMachine</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+ <dl>
89
+ <dt>Extended by:</dt>
90
+ <dd><span class='object_link'><a href="../Concerns/EventPublisher.html" title="Tasker::Concerns::EventPublisher (module)">Concerns::EventPublisher</a></span></dd>
91
+ </dl>
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Includes:</dt>
97
+ <dd>Statesman::Machine</dd>
98
+ </dl>
99
+
100
+
101
+
102
+
103
+
104
+
105
+ <dl>
106
+ <dt>Defined in:</dt>
107
+ <dd>lib/tasker/state_machine/step_state_machine.rb</dd>
108
+ </dl>
109
+
110
+ </div>
111
+
112
+ <h2>Overview</h2><div class="docstring">
113
+ <div class="discussion">
114
+
115
+ <p>StepStateMachine defines state transitions for workflow steps using Statesman</p>
116
+
117
+ <p>This state machine manages workflow step lifecycle states and integrates with the existing event system to provide declarative state management.</p>
118
+
119
+
120
+ </div>
121
+ </div>
122
+ <div class="tags">
123
+
124
+
125
+ </div>
126
+
127
+ <h2>
128
+ Constant Summary
129
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
130
+ </h2>
131
+
132
+ <dl class="constants">
133
+
134
+ <dt id="TRANSITION_EVENT_MAP-constant" class="">TRANSITION_EVENT_MAP =
135
+ <div class="docstring">
136
+ <div class="discussion">
137
+
138
+ <p>Frozen constant mapping state transitions to event names This provides O(1) lookup performance and ensures consistency</p>
139
+
140
+
141
+ </div>
142
+ </div>
143
+ <div class="tags">
144
+
145
+
146
+ </div>
147
+ </dt>
148
+ <dd><pre class="code"><span class='lbrace'>{</span>
149
+ <span class='comment'># Initial state transitions (from nil/initial)
150
+ </span> <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#INITIALIZE_REQUESTED-constant" title="Tasker::Constants::StepEvents::INITIALIZE_REQUESTED (constant)">INITIALIZE_REQUESTED</a></span></span><span class='comma'>,</span>
151
+ <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#IN_PROGRESS-constant" title="Tasker::Constants::WorkflowStepStatuses::IN_PROGRESS (constant)">IN_PROGRESS</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#EXECUTION_REQUESTED-constant" title="Tasker::Constants::StepEvents::EXECUTION_REQUESTED (constant)">EXECUTION_REQUESTED</a></span></span><span class='comma'>,</span>
152
+ <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#COMPLETE-constant" title="Tasker::Constants::WorkflowStepStatuses::COMPLETE (constant)">COMPLETE</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#COMPLETED-constant" title="Tasker::Constants::StepEvents::COMPLETED (constant)">COMPLETED</a></span></span><span class='comma'>,</span>
153
+ <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#ERROR-constant" title="Tasker::Constants::WorkflowStepStatuses::ERROR (constant)">ERROR</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#FAILED-constant" title="Tasker::Constants::StepEvents::FAILED (constant)">FAILED</a></span></span><span class='comma'>,</span>
154
+ <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#CANCELLED-constant" title="Tasker::Constants::WorkflowStepStatuses::CANCELLED (constant)">CANCELLED</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#CANCELLED-constant" title="Tasker::Constants::StepEvents::CANCELLED (constant)">CANCELLED</a></span></span><span class='comma'>,</span>
155
+ <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#RESOLVED_MANUALLY-constant" title="Tasker::Constants::WorkflowStepStatuses::RESOLVED_MANUALLY (constant)">RESOLVED_MANUALLY</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#RESOLVED_MANUALLY-constant" title="Tasker::Constants::StepEvents::RESOLVED_MANUALLY (constant)">RESOLVED_MANUALLY</a></span></span><span class='comma'>,</span>
156
+
157
+ <span class='comment'># Normal state transitions
158
+ </span> <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span><span class='comma'>,</span>
159
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#IN_PROGRESS-constant" title="Tasker::Constants::WorkflowStepStatuses::IN_PROGRESS (constant)">IN_PROGRESS</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#EXECUTION_REQUESTED-constant" title="Tasker::Constants::StepEvents::EXECUTION_REQUESTED (constant)">EXECUTION_REQUESTED</a></span></span><span class='comma'>,</span>
160
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span><span class='comma'>,</span>
161
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#ERROR-constant" title="Tasker::Constants::WorkflowStepStatuses::ERROR (constant)">ERROR</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#FAILED-constant" title="Tasker::Constants::StepEvents::FAILED (constant)">FAILED</a></span></span><span class='comma'>,</span>
162
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span><span class='comma'>,</span>
163
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#CANCELLED-constant" title="Tasker::Constants::WorkflowStepStatuses::CANCELLED (constant)">CANCELLED</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#CANCELLED-constant" title="Tasker::Constants::StepEvents::CANCELLED (constant)">CANCELLED</a></span></span><span class='comma'>,</span>
164
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span><span class='comma'>,</span>
165
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#RESOLVED_MANUALLY-constant" title="Tasker::Constants::WorkflowStepStatuses::RESOLVED_MANUALLY (constant)">RESOLVED_MANUALLY</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#RESOLVED_MANUALLY-constant" title="Tasker::Constants::StepEvents::RESOLVED_MANUALLY (constant)">RESOLVED_MANUALLY</a></span></span><span class='comma'>,</span>
166
+
167
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#IN_PROGRESS-constant" title="Tasker::Constants::WorkflowStepStatuses::IN_PROGRESS (constant)">IN_PROGRESS</a></span></span><span class='comma'>,</span>
168
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#COMPLETE-constant" title="Tasker::Constants::WorkflowStepStatuses::COMPLETE (constant)">COMPLETE</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#COMPLETED-constant" title="Tasker::Constants::StepEvents::COMPLETED (constant)">COMPLETED</a></span></span><span class='comma'>,</span>
169
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#IN_PROGRESS-constant" title="Tasker::Constants::WorkflowStepStatuses::IN_PROGRESS (constant)">IN_PROGRESS</a></span></span><span class='comma'>,</span>
170
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#ERROR-constant" title="Tasker::Constants::WorkflowStepStatuses::ERROR (constant)">ERROR</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#FAILED-constant" title="Tasker::Constants::StepEvents::FAILED (constant)">FAILED</a></span></span><span class='comma'>,</span>
171
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#IN_PROGRESS-constant" title="Tasker::Constants::WorkflowStepStatuses::IN_PROGRESS (constant)">IN_PROGRESS</a></span></span><span class='comma'>,</span>
172
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#CANCELLED-constant" title="Tasker::Constants::WorkflowStepStatuses::CANCELLED (constant)">CANCELLED</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#CANCELLED-constant" title="Tasker::Constants::StepEvents::CANCELLED (constant)">CANCELLED</a></span></span><span class='comma'>,</span>
173
+
174
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#ERROR-constant" title="Tasker::Constants::WorkflowStepStatuses::ERROR (constant)">ERROR</a></span></span><span class='comma'>,</span>
175
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#RETRY_REQUESTED-constant" title="Tasker::Constants::StepEvents::RETRY_REQUESTED (constant)">RETRY_REQUESTED</a></span></span><span class='comma'>,</span>
176
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#ERROR-constant" title="Tasker::Constants::WorkflowStepStatuses::ERROR (constant)">ERROR</a></span></span><span class='comma'>,</span>
177
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#RESOLVED_MANUALLY-constant" title="Tasker::Constants::WorkflowStepStatuses::RESOLVED_MANUALLY (constant)">RESOLVED_MANUALLY</a></span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html" title="Tasker::Constants::StepEvents (module)">StepEvents</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/StepEvents.html#RESOLVED_MANUALLY-constant" title="Tasker::Constants::StepEvents::RESOLVED_MANUALLY (constant)">RESOLVED_MANUALLY</a></span></span>
178
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
179
+
180
+ </dl>
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+ <h2>
191
+ Class Method Summary
192
+ <small><a href="#" class="summary_toggle">collapse</a></small>
193
+ </h2>
194
+
195
+ <ul class="summary">
196
+
197
+ <li class="public ">
198
+ <span class="summary_signature">
199
+
200
+ <a href="#build_standardized_payload-class_method" title="build_standardized_payload (class method)">.<strong>build_standardized_payload</strong>(_event_name, context) &#x21d2; Hash </a>
201
+
202
+
203
+
204
+ </span>
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+ <span class="summary_desc"><div class='inline'>
215
+ <p>Build standardized event payload with all expected keys (legacy fallback).</p>
216
+ </div></span>
217
+
218
+ </li>
219
+
220
+
221
+ <li class="public ">
222
+ <span class="summary_signature">
223
+
224
+ <a href="#determine_event_type_from_name-class_method" title="determine_event_type_from_name (class method)">.<strong>determine_event_type_from_name</strong>(event_name) &#x21d2; Symbol </a>
225
+
226
+
227
+
228
+ </span>
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+ <span class="summary_desc"><div class='inline'>
239
+ <p>Determine event type from event name for EventPayloadBuilder.</p>
240
+ </div></span>
241
+
242
+ </li>
243
+
244
+
245
+ <li class="public ">
246
+ <span class="summary_signature">
247
+
248
+ <a href="#determine_transition_event_name-class_method" title="determine_transition_event_name (class method)">.<strong>determine_transition_event_name</strong>(from_state, to_state) &#x21d2; String<sup>?</sup> </a>
249
+
250
+
251
+
252
+ </span>
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+ <span class="summary_desc"><div class='inline'>
263
+ <p>Determine the appropriate event name for a state transition using constant lookup.</p>
264
+ </div></span>
265
+
266
+ </li>
267
+
268
+
269
+ <li class="public ">
270
+ <span class="summary_signature">
271
+
272
+ <a href="#effective_current_state-class_method" title="effective_current_state (class method)">.<strong>effective_current_state</strong>(step) &#x21d2; String </a>
273
+
274
+
275
+
276
+ </span>
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+ <span class="summary_desc"><div class='inline'>
287
+ <p>Get the effective current state, handling blank/empty states.</p>
288
+ </div></span>
289
+
290
+ </li>
291
+
292
+
293
+ <li class="public ">
294
+ <span class="summary_signature">
295
+
296
+ <a href="#extract_step_from_context-class_method" title="extract_step_from_context (class method)">.<strong>extract_step_from_context</strong>(context) &#x21d2; WorkflowStep<sup>?</sup> </a>
297
+
298
+
299
+
300
+ </span>
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+ <span class="summary_desc"><div class='inline'>
311
+ <p>Extract step object from context for EventPayloadBuilder.</p>
312
+ </div></span>
313
+
314
+ </li>
315
+
316
+
317
+ <li class="public ">
318
+ <span class="summary_signature">
319
+
320
+ <a href="#idempotent_transition%3F-class_method" title="idempotent_transition? (class method)">.<strong>idempotent_transition?</strong>(step, target_state) &#x21d2; Boolean </a>
321
+
322
+
323
+
324
+ </span>
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+ <span class="summary_desc"><div class='inline'>
335
+ <p>Check if a transition is idempotent (current state == target state).</p>
336
+ </div></span>
337
+
338
+ </li>
339
+
340
+
341
+ <li class="public ">
342
+ <span class="summary_signature">
343
+
344
+ <a href="#log_dependencies_not_met-class_method" title="log_dependencies_not_met (class method)">.<strong>log_dependencies_not_met</strong>(step, target_state) &#x21d2; Object </a>
345
+
346
+
347
+
348
+ </span>
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+ <span class="summary_desc"><div class='inline'>
359
+ <p>Log when dependencies are not met.</p>
360
+ </div></span>
361
+
362
+ </li>
363
+
364
+
365
+ <li class="public ">
366
+ <span class="summary_signature">
367
+
368
+ <a href="#log_invalid_from_state-class_method" title="log_invalid_from_state (class method)">.<strong>log_invalid_from_state</strong>(step, current_state, target_state, reason) &#x21d2; Object </a>
369
+
370
+
371
+
372
+ </span>
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+ <span class="summary_desc"><div class='inline'>
383
+ <p>Log an invalid from-state transition.</p>
384
+ </div></span>
385
+
386
+ </li>
387
+
388
+
389
+ <li class="public ">
390
+ <span class="summary_signature">
391
+
392
+ <a href="#log_transition_result-class_method" title="log_transition_result (class method)">.<strong>log_transition_result</strong>(step, target_state, result, reason) &#x21d2; Object </a>
393
+
394
+
395
+
396
+ </span>
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+ <span class="summary_desc"><div class='inline'>
407
+ <p>Log the result of a transition check.</p>
408
+ </div></span>
409
+
410
+ </li>
411
+
412
+
413
+ <li class="public ">
414
+ <span class="summary_signature">
415
+
416
+ <a href="#safe_fire_event-class_method" title="safe_fire_event (class method)">.<strong>safe_fire_event</strong>(event_name, context = {}) &#x21d2; void </a>
417
+
418
+
419
+
420
+ </span>
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+ <span class="summary_desc"><div class='inline'>
431
+ <p>Safely fire a lifecycle event using dry-events bus.</p>
432
+ </div></span>
433
+
434
+ </li>
435
+
436
+
437
+ <li class="public ">
438
+ <span class="summary_signature">
439
+
440
+ <a href="#step_dependencies_met%3F-class_method" title="step_dependencies_met? (class method)">.<strong>step_dependencies_met?</strong>(step) &#x21d2; Boolean </a>
441
+
442
+
443
+
444
+ </span>
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+ <span class="summary_desc"><div class='inline'>
455
+ <p>Check if step dependencies are met.</p>
456
+ </div></span>
457
+
458
+ </li>
459
+
460
+
461
+ </ul>
462
+
463
+ <h2>
464
+ Instance Method Summary
465
+ <small><a href="#" class="summary_toggle">collapse</a></small>
466
+ </h2>
467
+
468
+ <ul class="summary">
469
+
470
+ <li class="public ">
471
+ <span class="summary_signature">
472
+
473
+ <a href="#create_transition-instance_method" title="#create_transition (instance method)">#<strong>create_transition</strong>(from_state, to_state, metadata = {}) &#x21d2; Object </a>
474
+
475
+
476
+
477
+ </span>
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+ <span class="summary_desc"><div class='inline'>
488
+ <p>Override Statesman’s transition building to ensure proper from_state handling This is called by Statesman when creating new transitions.</p>
489
+ </div></span>
490
+
491
+ </li>
492
+
493
+
494
+ <li class="public ">
495
+ <span class="summary_signature">
496
+
497
+ <a href="#current_state-instance_method" title="#current_state (instance method)">#<strong>current_state</strong> &#x21d2; Object </a>
498
+
499
+
500
+
501
+ </span>
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+ <span class="summary_desc"><div class='inline'>
512
+ <p>Override current_state to work with custom transition model Since WorkflowStepTransition doesn’t include Statesman::Adapters::ActiveRecordTransition, we need to implement our own current_state logic using the most_recent column.</p>
513
+ </div></span>
514
+
515
+ </li>
516
+
517
+
518
+ <li class="public ">
519
+ <span class="summary_signature">
520
+
521
+ <a href="#initialize_state_machine!-instance_method" title="#initialize_state_machine! (instance method)">#<strong>initialize_state_machine!</strong> &#x21d2; Object </a>
522
+
523
+
524
+
525
+ </span>
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+
535
+ <span class="summary_desc"><div class='inline'>
536
+ <p>Initialize the state machine with the initial state This ensures the state machine is properly initialized when called explicitly DEFENSIVE: Only creates transitions when explicitly needed.</p>
537
+ </div></span>
538
+
539
+ </li>
540
+
541
+
542
+ <li class="public ">
543
+ <span class="summary_signature">
544
+
545
+ <a href="#next_sort_key_value-instance_method" title="#next_sort_key_value (instance method)">#<strong>next_sort_key_value</strong> &#x21d2; Object </a>
546
+
547
+
548
+
549
+ </span>
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+ <span class="summary_desc"><div class='inline'>
560
+ <p>Get the next sort key for transitions.</p>
561
+ </div></span>
562
+
563
+ </li>
564
+
565
+
566
+ </ul>
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="../Concerns/EventPublisher.html" title="Tasker::Concerns::EventPublisher (module)">Concerns::EventPublisher</a></span></h3>
579
+ <p class="inherited"><span class='object_link'><a href="../Concerns/EventPublisher.html#infer_step_event_type_from_state-instance_method" title="Tasker::Concerns::EventPublisher#infer_step_event_type_from_state (method)">infer_step_event_type_from_state</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_custom_event-instance_method" title="Tasker::Concerns::EventPublisher#publish_custom_event (method)">publish_custom_event</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_no_viable_steps-instance_method" title="Tasker::Concerns::EventPublisher#publish_no_viable_steps (method)">publish_no_viable_steps</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_backoff-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_backoff (method)">publish_step_backoff</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_before_handle-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_before_handle (method)">publish_step_before_handle</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_cancelled-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_cancelled (method)">publish_step_cancelled</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_completed-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_completed (method)">publish_step_completed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_event_for_context-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_event_for_context (method)">publish_step_event_for_context</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_failed-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_failed (method)">publish_step_failed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_retry_requested-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_retry_requested (method)">publish_step_retry_requested</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_step_started-instance_method" title="Tasker::Concerns::EventPublisher#publish_step_started (method)">publish_step_started</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_steps_execution_completed-instance_method" title="Tasker::Concerns::EventPublisher#publish_steps_execution_completed (method)">publish_steps_execution_completed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_steps_execution_started-instance_method" title="Tasker::Concerns::EventPublisher#publish_steps_execution_started (method)">publish_steps_execution_started</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_completed-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_completed (method)">publish_task_completed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_enqueue-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_enqueue (method)">publish_task_enqueue</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_failed-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_failed (method)">publish_task_failed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_finalization_completed-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_finalization_completed (method)">publish_task_finalization_completed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_finalization_started-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_finalization_started (method)">publish_task_finalization_started</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_pending_transition-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_pending_transition (method)">publish_task_pending_transition</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_reenqueue_delayed-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_reenqueue_delayed (method)">publish_task_reenqueue_delayed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_reenqueue_failed-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_reenqueue_failed (method)">publish_task_reenqueue_failed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_reenqueue_requested-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_reenqueue_requested (method)">publish_task_reenqueue_requested</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_reenqueue_started-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_reenqueue_started (method)">publish_task_reenqueue_started</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_retry_requested-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_retry_requested (method)">publish_task_retry_requested</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_task_started-instance_method" title="Tasker::Concerns::EventPublisher#publish_task_started (method)">publish_task_started</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_viable_steps_discovered-instance_method" title="Tasker::Concerns::EventPublisher#publish_viable_steps_discovered (method)">publish_viable_steps_discovered</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_workflow_state_unclear-instance_method" title="Tasker::Concerns::EventPublisher#publish_workflow_state_unclear (method)">publish_workflow_state_unclear</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_workflow_step_completed-instance_method" title="Tasker::Concerns::EventPublisher#publish_workflow_step_completed (method)">publish_workflow_step_completed</a></span>, <span class='object_link'><a href="../Concerns/EventPublisher.html#publish_workflow_task_started-instance_method" title="Tasker::Concerns::EventPublisher#publish_workflow_task_started (method)">publish_workflow_task_started</a></span></p>
580
+
581
+
582
+
583
+
584
+ <div id="class_method_details" class="method_details_list">
585
+ <h2>Class Method Details</h2>
586
+
587
+
588
+ <div class="method_details first">
589
+ <h3 class="signature first" id="build_standardized_payload-class_method">
590
+
591
+ .<strong>build_standardized_payload</strong>(_event_name, context) &#x21d2; <tt>Hash</tt>
592
+
593
+
594
+
595
+
596
+
597
+ </h3><div class="docstring">
598
+ <div class="discussion">
599
+
600
+ <p>Build standardized event payload with all expected keys (legacy fallback)</p>
601
+
602
+
603
+ </div>
604
+ </div>
605
+ <div class="tags">
606
+ <p class="tag_title">Parameters:</p>
607
+ <ul class="param">
608
+
609
+ <li>
610
+
611
+ <span class='name'>event_name</span>
612
+
613
+
614
+ <span class='type'>(<tt>String</tt>)</span>
615
+
616
+
617
+
618
+ &mdash;
619
+ <div class='inline'>
620
+ <p>The event name</p>
621
+ </div>
622
+
623
+ </li>
624
+
625
+ <li>
626
+
627
+ <span class='name'>context</span>
628
+
629
+
630
+ <span class='type'>(<tt>Hash</tt>)</span>
631
+
632
+
633
+
634
+ &mdash;
635
+ <div class='inline'>
636
+ <p>The base context</p>
637
+ </div>
638
+
639
+ </li>
640
+
641
+ </ul>
642
+
643
+ <p class="tag_title">Returns:</p>
644
+ <ul class="return">
645
+
646
+ <li>
647
+
648
+
649
+ <span class='type'>(<tt>Hash</tt>)</span>
650
+
651
+
652
+
653
+ &mdash;
654
+ <div class='inline'>
655
+ <p>Enhanced context with standardized payload structure</p>
656
+ </div>
657
+
658
+ </li>
659
+
660
+ </ul>
661
+
662
+ </div><table class="source_code">
663
+ <tr>
664
+ <td>
665
+ <pre class="lines">
666
+
667
+
668
+ 430
669
+ 431
670
+ 432
671
+ 433
672
+ 434
673
+ 435
674
+ 436
675
+ 437
676
+ 438
677
+ 439
678
+ 440
679
+ 441
680
+ 442
681
+ 443
682
+ 444
683
+ 445
684
+ 446
685
+ 447
686
+ 448
687
+ 449
688
+ 450
689
+ 451
690
+ 452
691
+ 453
692
+ 454
693
+ 455
694
+ 456
695
+ 457
696
+ 458
697
+ 459
698
+ 460
699
+ 461
700
+ 462
701
+ 463
702
+ 464</pre>
703
+ </td>
704
+ <td>
705
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 430</span>
706
+
707
+ <span class='kw'>def</span> <span class='id identifier rubyid_build_standardized_payload'>build_standardized_payload</span><span class='lparen'>(</span><span class='id identifier rubyid__event_name'>_event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
708
+ <span class='comment'># Base payload with core identifiers
709
+ </span> <span class='id identifier rubyid_enhanced_context'>enhanced_context</span> <span class='op'>=</span> <span class='lbrace'>{</span>
710
+ <span class='comment'># Core identifiers (always present)
711
+ </span> <span class='label'>task_id:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:task_id</span><span class='rbracket'>]</span><span class='comma'>,</span>
712
+ <span class='label'>step_id:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:step_id</span><span class='rbracket'>]</span><span class='comma'>,</span>
713
+ <span class='label'>step_name:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:step_name</span><span class='rbracket'>]</span><span class='comma'>,</span>
714
+
715
+ <span class='comment'># State transition information
716
+ </span> <span class='label'>from_state:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:from_state</span><span class='rbracket'>]</span><span class='comma'>,</span>
717
+ <span class='label'>to_state:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:to_state</span><span class='rbracket'>]</span><span class='comma'>,</span>
718
+
719
+ <span class='comment'># Timing information (provide defaults for missing keys)
720
+ </span> <span class='label'>started_at:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:started_at</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:transitioned_at</span><span class='rbracket'>]</span><span class='comma'>,</span>
721
+ <span class='label'>completed_at:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:completed_at</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:transitioned_at</span><span class='rbracket'>]</span><span class='comma'>,</span>
722
+ <span class='label'>execution_duration:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:execution_duration</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='float'>0.0</span><span class='comma'>,</span>
723
+
724
+ <span class='comment'># Error information (for error events)
725
+ </span> <span class='label'>error_message:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:error_message</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:error</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Unknown error</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
726
+ <span class='label'>exception_class:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:exception_class</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>StandardError</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
727
+ <span class='label'>attempt_number:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:attempt_number</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>1</span><span class='comma'>,</span>
728
+
729
+ <span class='comment'># Additional context
730
+ </span> <span class='label'>transitioned_at:</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:transitioned_at</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_zone'>zone</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
731
+ <span class='rbrace'>}</span>
732
+
733
+ <span class='comment'># Merge in any additional context provided
734
+ </span> <span class='id identifier rubyid_enhanced_context'>enhanced_context</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_context'>context</span><span class='period'>.</span><span class='id identifier rubyid_except'>except</span><span class='lparen'>(</span>
735
+ <span class='symbol'>:task_id</span><span class='comma'>,</span> <span class='symbol'>:step_id</span><span class='comma'>,</span> <span class='symbol'>:step_name</span><span class='comma'>,</span> <span class='symbol'>:from_state</span><span class='comma'>,</span> <span class='symbol'>:to_state</span><span class='comma'>,</span>
736
+ <span class='symbol'>:started_at</span><span class='comma'>,</span> <span class='symbol'>:completed_at</span><span class='comma'>,</span> <span class='symbol'>:execution_duration</span><span class='comma'>,</span>
737
+ <span class='symbol'>:error_message</span><span class='comma'>,</span> <span class='symbol'>:exception_class</span><span class='comma'>,</span> <span class='symbol'>:attempt_number</span><span class='comma'>,</span> <span class='symbol'>:transitioned_at</span>
738
+ <span class='rparen'>)</span><span class='rparen'>)</span>
739
+
740
+ <span class='id identifier rubyid_enhanced_context'>enhanced_context</span>
741
+ <span class='kw'>end</span></pre>
742
+ </td>
743
+ </tr>
744
+ </table>
745
+ </div>
746
+
747
+ <div class="method_details ">
748
+ <h3 class="signature " id="determine_event_type_from_name-class_method">
749
+
750
+ .<strong>determine_event_type_from_name</strong>(event_name) &#x21d2; <tt>Symbol</tt>
751
+
752
+
753
+
754
+
755
+
756
+ </h3><div class="docstring">
757
+ <div class="discussion">
758
+
759
+ <p>Determine event type from event name for EventPayloadBuilder</p>
760
+
761
+
762
+ </div>
763
+ </div>
764
+ <div class="tags">
765
+ <p class="tag_title">Parameters:</p>
766
+ <ul class="param">
767
+
768
+ <li>
769
+
770
+ <span class='name'>event_name</span>
771
+
772
+
773
+ <span class='type'>(<tt>String</tt>)</span>
774
+
775
+
776
+
777
+ &mdash;
778
+ <div class='inline'>
779
+ <p>The event name</p>
780
+ </div>
781
+
782
+ </li>
783
+
784
+ </ul>
785
+
786
+ <p class="tag_title">Returns:</p>
787
+ <ul class="return">
788
+
789
+ <li>
790
+
791
+
792
+ <span class='type'>(<tt>Symbol</tt>)</span>
793
+
794
+
795
+
796
+ &mdash;
797
+ <div class='inline'>
798
+ <p>The event type</p>
799
+ </div>
800
+
801
+ </li>
802
+
803
+ </ul>
804
+
805
+ </div><table class="source_code">
806
+ <tr>
807
+ <td>
808
+ <pre class="lines">
809
+
810
+
811
+ 408
812
+ 409
813
+ 410
814
+ 411
815
+ 412
816
+ 413
817
+ 414
818
+ 415
819
+ 416
820
+ 417
821
+ 418
822
+ 419
823
+ 420
824
+ 421
825
+ 422
826
+ 423</pre>
827
+ </td>
828
+ <td>
829
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 408</span>
830
+
831
+ <span class='kw'>def</span> <span class='id identifier rubyid_determine_event_type_from_name'>determine_event_type_from_name</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rparen'>)</span>
832
+ <span class='kw'>case</span> <span class='id identifier rubyid_event_name'>event_name</span>
833
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>completed</span><span class='regexp_end'>/i</span></span>
834
+ <span class='symbol'>:completed</span>
835
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>failed</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>error</span><span class='regexp_end'>/i</span></span>
836
+ <span class='symbol'>:failed</span>
837
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>execution_requested</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>started</span><span class='regexp_end'>/i</span></span>
838
+ <span class='symbol'>:started</span>
839
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>retry</span><span class='regexp_end'>/i</span></span>
840
+ <span class='symbol'>:retry</span>
841
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>backoff</span><span class='regexp_end'>/i</span></span>
842
+ <span class='symbol'>:backoff</span>
843
+ <span class='kw'>else</span>
844
+ <span class='symbol'>:unknown</span>
845
+ <span class='kw'>end</span>
846
+ <span class='kw'>end</span></pre>
847
+ </td>
848
+ </tr>
849
+ </table>
850
+ </div>
851
+
852
+ <div class="method_details ">
853
+ <h3 class="signature " id="determine_transition_event_name-class_method">
854
+
855
+ .<strong>determine_transition_event_name</strong>(from_state, to_state) &#x21d2; <tt>String</tt><sup>?</sup>
856
+
857
+
858
+
859
+
860
+
861
+ </h3><div class="docstring">
862
+ <div class="discussion">
863
+
864
+ <p>Determine the appropriate event name for a state transition using constant lookup</p>
865
+
866
+
867
+ </div>
868
+ </div>
869
+ <div class="tags">
870
+ <p class="tag_title">Parameters:</p>
871
+ <ul class="param">
872
+
873
+ <li>
874
+
875
+ <span class='name'>from_state</span>
876
+
877
+
878
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
879
+
880
+
881
+
882
+ &mdash;
883
+ <div class='inline'>
884
+ <p>The source state</p>
885
+ </div>
886
+
887
+ </li>
888
+
889
+ <li>
890
+
891
+ <span class='name'>to_state</span>
892
+
893
+
894
+ <span class='type'>(<tt>String</tt>)</span>
895
+
896
+
897
+
898
+ &mdash;
899
+ <div class='inline'>
900
+ <p>The target state</p>
901
+ </div>
902
+
903
+ </li>
904
+
905
+ </ul>
906
+
907
+ <p class="tag_title">Returns:</p>
908
+ <ul class="return">
909
+
910
+ <li>
911
+
912
+
913
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
914
+
915
+
916
+
917
+ &mdash;
918
+ <div class='inline'>
919
+ <p>The event name or nil if no mapping exists</p>
920
+ </div>
921
+
922
+ </li>
923
+
924
+ </ul>
925
+
926
+ </div><table class="source_code">
927
+ <tr>
928
+ <td>
929
+ <pre class="lines">
930
+
931
+
932
+ 471
933
+ 472
934
+ 473
935
+ 474
936
+ 475
937
+ 476
938
+ 477
939
+ 478
940
+ 479
941
+ 480
942
+ 481
943
+ 482
944
+ 483
945
+ 484</pre>
946
+ </td>
947
+ <td>
948
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 471</span>
949
+
950
+ <span class='kw'>def</span> <span class='id identifier rubyid_determine_transition_event_name'>determine_transition_event_name</span><span class='lparen'>(</span><span class='id identifier rubyid_from_state'>from_state</span><span class='comma'>,</span> <span class='id identifier rubyid_to_state'>to_state</span><span class='rparen'>)</span>
951
+ <span class='id identifier rubyid_transition_key'>transition_key</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_from_state'>from_state</span><span class='comma'>,</span> <span class='id identifier rubyid_to_state'>to_state</span><span class='rbracket'>]</span>
952
+ <span class='id identifier rubyid_event_name'>event_name</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#TRANSITION_EVENT_MAP-constant" title="Tasker::StateMachine::StepStateMachine::TRANSITION_EVENT_MAP (constant)">TRANSITION_EVENT_MAP</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_transition_key'>transition_key</span><span class='rbracket'>]</span>
953
+
954
+ <span class='kw'>if</span> <span class='id identifier rubyid_event_name'>event_name</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
955
+ <span class='comment'># For unexpected transitions, log a warning and return nil to skip event firing
956
+ </span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='kw'>do</span>
957
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unexpected step state transition: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_from_state'>from_state</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>initial</span><span class='tstring_end'>&#39;</span></span><span class='embexpr_end'>}</span><span class='tstring_content'> → </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_to_state'>to_state</span><span class='embexpr_end'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span> \
958
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>No event will be fired for this transition.</span><span class='tstring_end'>&#39;</span></span>
959
+ <span class='kw'>end</span>
960
+ <span class='kw'>end</span>
961
+
962
+ <span class='id identifier rubyid_event_name'>event_name</span>
963
+ <span class='kw'>end</span></pre>
964
+ </td>
965
+ </tr>
966
+ </table>
967
+ </div>
968
+
969
+ <div class="method_details ">
970
+ <h3 class="signature " id="effective_current_state-class_method">
971
+
972
+ .<strong>effective_current_state</strong>(step) &#x21d2; <tt>String</tt>
973
+
974
+
975
+
976
+
977
+
978
+ </h3><div class="docstring">
979
+ <div class="discussion">
980
+
981
+ <p>Get the effective current state, handling blank/empty states</p>
982
+
983
+
984
+ </div>
985
+ </div>
986
+ <div class="tags">
987
+ <p class="tag_title">Parameters:</p>
988
+ <ul class="param">
989
+
990
+ <li>
991
+
992
+ <span class='name'>step</span>
993
+
994
+
995
+ <span class='type'>(<tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt>)</span>
996
+
997
+
998
+
999
+ &mdash;
1000
+ <div class='inline'>
1001
+ <p>The step to check</p>
1002
+ </div>
1003
+
1004
+ </li>
1005
+
1006
+ </ul>
1007
+
1008
+ <p class="tag_title">Returns:</p>
1009
+ <ul class="return">
1010
+
1011
+ <li>
1012
+
1013
+
1014
+ <span class='type'>(<tt>String</tt>)</span>
1015
+
1016
+
1017
+
1018
+ &mdash;
1019
+ <div class='inline'>
1020
+ <p>The effective current state (blank states become PENDING)</p>
1021
+ </div>
1022
+
1023
+ </li>
1024
+
1025
+ </ul>
1026
+
1027
+ </div><table class="source_code">
1028
+ <tr>
1029
+ <td>
1030
+ <pre class="lines">
1031
+
1032
+
1033
+ 268
1034
+ 269
1035
+ 270
1036
+ 271</pre>
1037
+ </td>
1038
+ <td>
1039
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 268</span>
1040
+
1041
+ <span class='kw'>def</span> <span class='id identifier rubyid_effective_current_state'>effective_current_state</span><span class='lparen'>(</span><span class='id identifier rubyid_step'>step</span><span class='rparen'>)</span>
1042
+ <span class='id identifier rubyid_current_state'>current_state</span> <span class='op'>=</span> <span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_state_machine'>state_machine</span><span class='period'>.</span><span class='id identifier rubyid_current_state'>current_state</span>
1043
+ <span class='id identifier rubyid_current_state'>current_state</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span>
1044
+ <span class='kw'>end</span></pre>
1045
+ </td>
1046
+ </tr>
1047
+ </table>
1048
+ </div>
1049
+
1050
+ <div class="method_details ">
1051
+ <h3 class="signature " id="extract_step_from_context-class_method">
1052
+
1053
+ .<strong>extract_step_from_context</strong>(context) &#x21d2; <tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt><sup>?</sup>
1054
+
1055
+
1056
+
1057
+
1058
+
1059
+ </h3><div class="docstring">
1060
+ <div class="discussion">
1061
+
1062
+ <p>Extract step object from context for EventPayloadBuilder</p>
1063
+
1064
+
1065
+ </div>
1066
+ </div>
1067
+ <div class="tags">
1068
+ <p class="tag_title">Parameters:</p>
1069
+ <ul class="param">
1070
+
1071
+ <li>
1072
+
1073
+ <span class='name'>context</span>
1074
+
1075
+
1076
+ <span class='type'>(<tt>Hash</tt>)</span>
1077
+
1078
+
1079
+
1080
+ &mdash;
1081
+ <div class='inline'>
1082
+ <p>The event context</p>
1083
+ </div>
1084
+
1085
+ </li>
1086
+
1087
+ </ul>
1088
+
1089
+ <p class="tag_title">Returns:</p>
1090
+ <ul class="return">
1091
+
1092
+ <li>
1093
+
1094
+
1095
+ <span class='type'>(<tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt>, <tt>nil</tt>)</span>
1096
+
1097
+
1098
+
1099
+ &mdash;
1100
+ <div class='inline'>
1101
+ <p>The step object if available</p>
1102
+ </div>
1103
+
1104
+ </li>
1105
+
1106
+ </ul>
1107
+
1108
+ </div><table class="source_code">
1109
+ <tr>
1110
+ <td>
1111
+ <pre class="lines">
1112
+
1113
+
1114
+ 392
1115
+ 393
1116
+ 394
1117
+ 395
1118
+ 396
1119
+ 397
1120
+ 398
1121
+ 399
1122
+ 400
1123
+ 401
1124
+ 402</pre>
1125
+ </td>
1126
+ <td>
1127
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 392</span>
1128
+
1129
+ <span class='kw'>def</span> <span class='id identifier rubyid_extract_step_from_context'>extract_step_from_context</span><span class='lparen'>(</span><span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
1130
+ <span class='id identifier rubyid_step_id'>step_id</span> <span class='op'>=</span> <span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:step_id</span><span class='rbracket'>]</span>
1131
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_step_id'>step_id</span>
1132
+
1133
+ <span class='comment'># Try to find the step - handle both string and numeric IDs
1134
+ </span> <span class='const'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></span><span class='period'>.</span><span class='id identifier rubyid_find_by'>find_by</span><span class='lparen'>(</span><span class='label'>workflow_step_id:</span> <span class='id identifier rubyid_step_id'>step_id</span><span class='rparen'>)</span> <span class='op'>||</span>
1135
+ <span class='const'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></span><span class='period'>.</span><span class='id identifier rubyid_find_by'>find_by</span><span class='lparen'>(</span><span class='label'>id:</span> <span class='id identifier rubyid_step_id'>step_id</span><span class='rparen'>)</span>
1136
+ <span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1137
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Could not find step with ID </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step_id'>step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
1138
+ <span class='kw'>nil</span>
1139
+ <span class='kw'>end</span></pre>
1140
+ </td>
1141
+ </tr>
1142
+ </table>
1143
+ </div>
1144
+
1145
+ <div class="method_details ">
1146
+ <h3 class="signature " id="idempotent_transition?-class_method">
1147
+
1148
+ .<strong>idempotent_transition?</strong>(step, target_state) &#x21d2; <tt>Boolean</tt>
1149
+
1150
+
1151
+
1152
+
1153
+
1154
+ </h3><div class="docstring">
1155
+ <div class="discussion">
1156
+
1157
+ <p>Check if a transition is idempotent (current state == target state)</p>
1158
+
1159
+
1160
+ </div>
1161
+ </div>
1162
+ <div class="tags">
1163
+ <p class="tag_title">Parameters:</p>
1164
+ <ul class="param">
1165
+
1166
+ <li>
1167
+
1168
+ <span class='name'>step</span>
1169
+
1170
+
1171
+ <span class='type'>(<tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt>)</span>
1172
+
1173
+
1174
+
1175
+ &mdash;
1176
+ <div class='inline'>
1177
+ <p>The step to check</p>
1178
+ </div>
1179
+
1180
+ </li>
1181
+
1182
+ <li>
1183
+
1184
+ <span class='name'>target_state</span>
1185
+
1186
+
1187
+ <span class='type'>(<tt>String</tt>)</span>
1188
+
1189
+
1190
+
1191
+ &mdash;
1192
+ <div class='inline'>
1193
+ <p>The target state</p>
1194
+ </div>
1195
+
1196
+ </li>
1197
+
1198
+ </ul>
1199
+
1200
+ <p class="tag_title">Returns:</p>
1201
+ <ul class="return">
1202
+
1203
+ <li>
1204
+
1205
+
1206
+ <span class='type'>(<tt>Boolean</tt>)</span>
1207
+
1208
+
1209
+
1210
+ &mdash;
1211
+ <div class='inline'>
1212
+ <p>True if this is an idempotent transition</p>
1213
+ </div>
1214
+
1215
+ </li>
1216
+
1217
+ </ul>
1218
+
1219
+ </div><table class="source_code">
1220
+ <tr>
1221
+ <td>
1222
+ <pre class="lines">
1223
+
1224
+
1225
+ 250
1226
+ 251
1227
+ 252
1228
+ 253
1229
+ 254
1230
+ 255
1231
+ 256
1232
+ 257
1233
+ 258
1234
+ 259
1235
+ 260
1236
+ 261
1237
+ 262</pre>
1238
+ </td>
1239
+ <td>
1240
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 250</span>
1241
+
1242
+ <span class='kw'>def</span> <span class='id identifier rubyid_idempotent_transition?'>idempotent_transition?</span><span class='lparen'>(</span><span class='id identifier rubyid_step'>step</span><span class='comma'>,</span> <span class='id identifier rubyid_target_state'>target_state</span><span class='rparen'>)</span>
1243
+ <span class='id identifier rubyid_current_state'>current_state</span> <span class='op'>=</span> <span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_state_machine'>state_machine</span><span class='period'>.</span><span class='id identifier rubyid_current_state'>current_state</span>
1244
+ <span class='id identifier rubyid_effective_current_state'>effective_current_state</span> <span class='op'>=</span> <span class='id identifier rubyid_current_state'>current_state</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span>
1245
+ <span class='id identifier rubyid_is_idempotent'>is_idempotent</span> <span class='op'>=</span> <span class='id identifier rubyid_effective_current_state'>effective_current_state</span> <span class='op'>==</span> <span class='id identifier rubyid_target_state'>target_state</span>
1246
+
1247
+ <span class='kw'>if</span> <span class='id identifier rubyid_is_idempotent'>is_idempotent</span>
1248
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
1249
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Allowing idempotent transition to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_target_state'>target_state</span><span class='embexpr_end'>}</span><span class='tstring_content'> for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
1250
+ <span class='kw'>end</span>
1251
+ <span class='kw'>end</span>
1252
+
1253
+ <span class='id identifier rubyid_is_idempotent'>is_idempotent</span>
1254
+ <span class='kw'>end</span></pre>
1255
+ </td>
1256
+ </tr>
1257
+ </table>
1258
+ </div>
1259
+
1260
+ <div class="method_details ">
1261
+ <h3 class="signature " id="log_dependencies_not_met-class_method">
1262
+
1263
+ .<strong>log_dependencies_not_met</strong>(step, target_state) &#x21d2; <tt>Object</tt>
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+ </h3><div class="docstring">
1270
+ <div class="discussion">
1271
+
1272
+ <p>Log when dependencies are not met</p>
1273
+
1274
+
1275
+ </div>
1276
+ </div>
1277
+ <div class="tags">
1278
+ <p class="tag_title">Parameters:</p>
1279
+ <ul class="param">
1280
+
1281
+ <li>
1282
+
1283
+ <span class='name'>step</span>
1284
+
1285
+
1286
+ <span class='type'>(<tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt>)</span>
1287
+
1288
+
1289
+
1290
+ &mdash;
1291
+ <div class='inline'>
1292
+ <p>The step</p>
1293
+ </div>
1294
+
1295
+ </li>
1296
+
1297
+ <li>
1298
+
1299
+ <span class='name'>target_state</span>
1300
+
1301
+
1302
+ <span class='type'>(<tt>String</tt>)</span>
1303
+
1304
+
1305
+
1306
+ &mdash;
1307
+ <div class='inline'>
1308
+ <p>The target state</p>
1309
+ </div>
1310
+
1311
+ </li>
1312
+
1313
+ </ul>
1314
+
1315
+
1316
+ </div><table class="source_code">
1317
+ <tr>
1318
+ <td>
1319
+ <pre class="lines">
1320
+
1321
+
1322
+ 290
1323
+ 291
1324
+ 292
1325
+ 293
1326
+ 294
1327
+ 295</pre>
1328
+ </td>
1329
+ <td>
1330
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 290</span>
1331
+
1332
+ <span class='kw'>def</span> <span class='id identifier rubyid_log_dependencies_not_met'>log_dependencies_not_met</span><span class='lparen'>(</span><span class='id identifier rubyid_step'>step</span><span class='comma'>,</span> <span class='id identifier rubyid_target_state'>target_state</span><span class='rparen'>)</span>
1333
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
1334
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Cannot transition step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_target_state'>target_state</span><span class='embexpr_end'>}</span><span class='tstring_content'> - </span><span class='tstring_end'>&quot;</span></span> \
1335
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>dependencies not satisfied. Check parent step completion status.</span><span class='tstring_end'>&#39;</span></span>
1336
+ <span class='kw'>end</span>
1337
+ <span class='kw'>end</span></pre>
1338
+ </td>
1339
+ </tr>
1340
+ </table>
1341
+ </div>
1342
+
1343
+ <div class="method_details ">
1344
+ <h3 class="signature " id="log_invalid_from_state-class_method">
1345
+
1346
+ .<strong>log_invalid_from_state</strong>(step, current_state, target_state, reason) &#x21d2; <tt>Object</tt>
1347
+
1348
+
1349
+
1350
+
1351
+
1352
+ </h3><div class="docstring">
1353
+ <div class="discussion">
1354
+
1355
+ <p>Log an invalid from-state transition</p>
1356
+
1357
+
1358
+ </div>
1359
+ </div>
1360
+ <div class="tags">
1361
+ <p class="tag_title">Parameters:</p>
1362
+ <ul class="param">
1363
+
1364
+ <li>
1365
+
1366
+ <span class='name'>step</span>
1367
+
1368
+
1369
+ <span class='type'>(<tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt>)</span>
1370
+
1371
+
1372
+
1373
+ &mdash;
1374
+ <div class='inline'>
1375
+ <p>The step</p>
1376
+ </div>
1377
+
1378
+ </li>
1379
+
1380
+ <li>
1381
+
1382
+ <span class='name'>current_state</span>
1383
+
1384
+
1385
+ <span class='type'>(<tt>String</tt>)</span>
1386
+
1387
+
1388
+
1389
+ &mdash;
1390
+ <div class='inline'>
1391
+ <p>The current state</p>
1392
+ </div>
1393
+
1394
+ </li>
1395
+
1396
+ <li>
1397
+
1398
+ <span class='name'>target_state</span>
1399
+
1400
+
1401
+ <span class='type'>(<tt>String</tt>)</span>
1402
+
1403
+
1404
+
1405
+ &mdash;
1406
+ <div class='inline'>
1407
+ <p>The target state</p>
1408
+ </div>
1409
+
1410
+ </li>
1411
+
1412
+ <li>
1413
+
1414
+ <span class='name'>reason</span>
1415
+
1416
+
1417
+ <span class='type'>(<tt>String</tt>)</span>
1418
+
1419
+
1420
+
1421
+ &mdash;
1422
+ <div class='inline'>
1423
+ <p>The reason for the restriction</p>
1424
+ </div>
1425
+
1426
+ </li>
1427
+
1428
+ </ul>
1429
+
1430
+
1431
+ </div><table class="source_code">
1432
+ <tr>
1433
+ <td>
1434
+ <pre class="lines">
1435
+
1436
+
1437
+ 279
1438
+ 280
1439
+ 281
1440
+ 282
1441
+ 283
1442
+ 284</pre>
1443
+ </td>
1444
+ <td>
1445
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 279</span>
1446
+
1447
+ <span class='kw'>def</span> <span class='id identifier rubyid_log_invalid_from_state'>log_invalid_from_state</span><span class='lparen'>(</span><span class='id identifier rubyid_step'>step</span><span class='comma'>,</span> <span class='id identifier rubyid_current_state'>current_state</span><span class='comma'>,</span> <span class='id identifier rubyid_target_state'>target_state</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='rparen'>)</span>
1448
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
1449
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Cannot transition to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_target_state'>target_state</span><span class='embexpr_end'>}</span><span class='tstring_content'> from &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_current_state'>current_state</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39; </span><span class='tstring_end'>&quot;</span></span> \
1450
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>(step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>). </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_reason'>reason</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span>
1451
+ <span class='kw'>end</span>
1452
+ <span class='kw'>end</span></pre>
1453
+ </td>
1454
+ </tr>
1455
+ </table>
1456
+ </div>
1457
+
1458
+ <div class="method_details ">
1459
+ <h3 class="signature " id="log_transition_result-class_method">
1460
+
1461
+ .<strong>log_transition_result</strong>(step, target_state, result, reason) &#x21d2; <tt>Object</tt>
1462
+
1463
+
1464
+
1465
+
1466
+
1467
+ </h3><div class="docstring">
1468
+ <div class="discussion">
1469
+
1470
+ <p>Log the result of a transition check</p>
1471
+
1472
+
1473
+ </div>
1474
+ </div>
1475
+ <div class="tags">
1476
+ <p class="tag_title">Parameters:</p>
1477
+ <ul class="param">
1478
+
1479
+ <li>
1480
+
1481
+ <span class='name'>step</span>
1482
+
1483
+
1484
+ <span class='type'>(<tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt>)</span>
1485
+
1486
+
1487
+
1488
+ &mdash;
1489
+ <div class='inline'>
1490
+ <p>The step</p>
1491
+ </div>
1492
+
1493
+ </li>
1494
+
1495
+ <li>
1496
+
1497
+ <span class='name'>target_state</span>
1498
+
1499
+
1500
+ <span class='type'>(<tt>String</tt>)</span>
1501
+
1502
+
1503
+
1504
+ &mdash;
1505
+ <div class='inline'>
1506
+ <p>The target state</p>
1507
+ </div>
1508
+
1509
+ </li>
1510
+
1511
+ <li>
1512
+
1513
+ <span class='name'>result</span>
1514
+
1515
+
1516
+ <span class='type'>(<tt>Boolean</tt>)</span>
1517
+
1518
+
1519
+
1520
+ &mdash;
1521
+ <div class='inline'>
1522
+ <p>Whether the transition is allowed</p>
1523
+ </div>
1524
+
1525
+ </li>
1526
+
1527
+ <li>
1528
+
1529
+ <span class='name'>reason</span>
1530
+
1531
+
1532
+ <span class='type'>(<tt>String</tt>)</span>
1533
+
1534
+
1535
+
1536
+ &mdash;
1537
+ <div class='inline'>
1538
+ <p>The reason for the result</p>
1539
+ </div>
1540
+
1541
+ </li>
1542
+
1543
+ </ul>
1544
+
1545
+
1546
+ </div><table class="source_code">
1547
+ <tr>
1548
+ <td>
1549
+ <pre class="lines">
1550
+
1551
+
1552
+ 303
1553
+ 304
1554
+ 305
1555
+ 306
1556
+ 307
1557
+ 308
1558
+ 309
1559
+ 310
1560
+ 311
1561
+ 312
1562
+ 313</pre>
1563
+ </td>
1564
+ <td>
1565
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 303</span>
1566
+
1567
+ <span class='kw'>def</span> <span class='id identifier rubyid_log_transition_result'>log_transition_result</span><span class='lparen'>(</span><span class='id identifier rubyid_step'>step</span><span class='comma'>,</span> <span class='id identifier rubyid_target_state'>target_state</span><span class='comma'>,</span> <span class='id identifier rubyid_result'>result</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='rparen'>)</span>
1568
+ <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span>
1569
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
1570
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Allowing transition to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_target_state'>target_state</span><span class='embexpr_end'>}</span><span class='tstring_content'> for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_reason'>reason</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>
1571
+ <span class='kw'>end</span>
1572
+ <span class='kw'>else</span>
1573
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
1574
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Blocking transition to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_target_state'>target_state</span><span class='embexpr_end'>}</span><span class='tstring_content'> for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_reason'>reason</span><span class='embexpr_end'>}</span><span class='tstring_content'> failed)</span><span class='tstring_end'>&quot;</span></span>
1575
+ <span class='kw'>end</span>
1576
+ <span class='kw'>end</span>
1577
+ <span class='kw'>end</span></pre>
1578
+ </td>
1579
+ </tr>
1580
+ </table>
1581
+ </div>
1582
+
1583
+ <div class="method_details ">
1584
+ <h3 class="signature " id="safe_fire_event-class_method">
1585
+
1586
+ .<strong>safe_fire_event</strong>(event_name, context = {}) &#x21d2; <tt>void</tt>
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+ </h3><div class="docstring">
1593
+ <div class="discussion">
1594
+ <p class="note returns_void">This method returns an undefined value.</p>
1595
+ <p>Safely fire a lifecycle event using dry-events bus</p>
1596
+
1597
+
1598
+ </div>
1599
+ </div>
1600
+ <div class="tags">
1601
+ <p class="tag_title">Parameters:</p>
1602
+ <ul class="param">
1603
+
1604
+ <li>
1605
+
1606
+ <span class='name'>event_name</span>
1607
+
1608
+
1609
+ <span class='type'>(<tt>String</tt>)</span>
1610
+
1611
+
1612
+
1613
+ &mdash;
1614
+ <div class='inline'>
1615
+ <p>The event name</p>
1616
+ </div>
1617
+
1618
+ </li>
1619
+
1620
+ <li>
1621
+
1622
+ <span class='name'>context</span>
1623
+
1624
+
1625
+ <span class='type'>(<tt>Hash</tt>)</span>
1626
+
1627
+
1628
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
1629
+
1630
+
1631
+ &mdash;
1632
+ <div class='inline'>
1633
+ <p>The event context</p>
1634
+ </div>
1635
+
1636
+ </li>
1637
+
1638
+ </ul>
1639
+
1640
+
1641
+ </div><table class="source_code">
1642
+ <tr>
1643
+ <td>
1644
+ <pre class="lines">
1645
+
1646
+
1647
+ 364
1648
+ 365
1649
+ 366
1650
+ 367
1651
+ 368
1652
+ 369
1653
+ 370
1654
+ 371
1655
+ 372
1656
+ 373
1657
+ 374
1658
+ 375
1659
+ 376
1660
+ 377
1661
+ 378
1662
+ 379
1663
+ 380
1664
+ 381
1665
+ 382
1666
+ 383
1667
+ 384
1668
+ 385
1669
+ 386</pre>
1670
+ </td>
1671
+ <td>
1672
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 364</span>
1673
+
1674
+ <span class='kw'>def</span> <span class='id identifier rubyid_safe_fire_event'>safe_fire_event</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1675
+ <span class='comment'># Use EventPayloadBuilder for consistent payload structure
1676
+ </span> <span class='id identifier rubyid_step'>step</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_step_from_context'>extract_step_from_context</span><span class='lparen'>(</span><span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
1677
+ <span class='id identifier rubyid_task'>task</span> <span class='op'>=</span> <span class='id identifier rubyid_step'>step</span><span class='op'>&amp;.</span><span class='id identifier rubyid_task'>task</span>
1678
+
1679
+ <span class='kw'>if</span> <span class='id identifier rubyid_step'>step</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_task'>task</span>
1680
+ <span class='comment'># Determine event type from event name
1681
+ </span> <span class='id identifier rubyid_event_type'>event_type</span> <span class='op'>=</span> <span class='id identifier rubyid_determine_event_type_from_name'>determine_event_type_from_name</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rparen'>)</span>
1682
+
1683
+ <span class='comment'># Use EventPayloadBuilder for standardized payload
1684
+ </span> <span class='id identifier rubyid_enhanced_context'>enhanced_context</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Events.html" title="Tasker::Events (module)">Events</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Events/EventPayloadBuilder.html" title="Tasker::Events::EventPayloadBuilder (class)">EventPayloadBuilder</a></span></span><span class='period'>.</span><span class='id identifier rubyid_build_step_payload'><span class='object_link'><a href="../Events/EventPayloadBuilder.html#build_step_payload-class_method" title="Tasker::Events::EventPayloadBuilder.build_step_payload (method)">build_step_payload</a></span></span><span class='lparen'>(</span>
1685
+ <span class='id identifier rubyid_step'>step</span><span class='comma'>,</span>
1686
+ <span class='id identifier rubyid_task'>task</span><span class='comma'>,</span>
1687
+ <span class='label'>event_type:</span> <span class='id identifier rubyid_event_type'>event_type</span><span class='comma'>,</span>
1688
+ <span class='label'>additional_context:</span> <span class='id identifier rubyid_context'>context</span>
1689
+ <span class='rparen'>)</span>
1690
+ <span class='kw'>else</span>
1691
+ <span class='comment'># Fallback to enhanced context if step/task not available
1692
+ </span> <span class='id identifier rubyid_enhanced_context'>enhanced_context</span> <span class='op'>=</span> <span class='id identifier rubyid_build_standardized_payload'>build_standardized_payload</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
1693
+ <span class='kw'>end</span>
1694
+
1695
+ <span class='id identifier rubyid_publish_event'>publish_event</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_enhanced_context'>enhanced_context</span><span class='rparen'>)</span>
1696
+ <span class='kw'>end</span></pre>
1697
+ </td>
1698
+ </tr>
1699
+ </table>
1700
+ </div>
1701
+
1702
+ <div class="method_details ">
1703
+ <h3 class="signature " id="step_dependencies_met?-class_method">
1704
+
1705
+ .<strong>step_dependencies_met?</strong>(step) &#x21d2; <tt>Boolean</tt>
1706
+
1707
+
1708
+
1709
+
1710
+
1711
+ </h3><div class="docstring">
1712
+ <div class="discussion">
1713
+
1714
+ <p>Check if step dependencies are met</p>
1715
+
1716
+
1717
+ </div>
1718
+ </div>
1719
+ <div class="tags">
1720
+ <p class="tag_title">Parameters:</p>
1721
+ <ul class="param">
1722
+
1723
+ <li>
1724
+
1725
+ <span class='name'>step</span>
1726
+
1727
+
1728
+ <span class='type'>(<tt><span class='object_link'><a href="../WorkflowStep.html" title="Tasker::WorkflowStep (class)">WorkflowStep</a></span></tt>)</span>
1729
+
1730
+
1731
+
1732
+ &mdash;
1733
+ <div class='inline'>
1734
+ <p>The step to check</p>
1735
+ </div>
1736
+
1737
+ </li>
1738
+
1739
+ </ul>
1740
+
1741
+ <p class="tag_title">Returns:</p>
1742
+ <ul class="return">
1743
+
1744
+ <li>
1745
+
1746
+
1747
+ <span class='type'>(<tt>Boolean</tt>)</span>
1748
+
1749
+
1750
+
1751
+ &mdash;
1752
+ <div class='inline'>
1753
+ <p>True if all dependencies are satisfied</p>
1754
+ </div>
1755
+
1756
+ </li>
1757
+
1758
+ </ul>
1759
+
1760
+ </div><table class="source_code">
1761
+ <tr>
1762
+ <td>
1763
+ <pre class="lines">
1764
+
1765
+
1766
+ 319
1767
+ 320
1768
+ 321
1769
+ 322
1770
+ 323
1771
+ 324
1772
+ 325
1773
+ 326
1774
+ 327
1775
+ 328
1776
+ 329
1777
+ 330
1778
+ 331
1779
+ 332
1780
+ 333
1781
+ 334
1782
+ 335
1783
+ 336
1784
+ 337
1785
+ 338
1786
+ 339
1787
+ 340
1788
+ 341
1789
+ 342
1790
+ 343
1791
+ 344
1792
+ 345
1793
+ 346
1794
+ 347
1795
+ 348
1796
+ 349
1797
+ 350
1798
+ 351
1799
+ 352
1800
+ 353
1801
+ 354
1802
+ 355
1803
+ 356
1804
+ 357</pre>
1805
+ </td>
1806
+ <td>
1807
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 319</span>
1808
+
1809
+ <span class='kw'>def</span> <span class='id identifier rubyid_step_dependencies_met?'>step_dependencies_met?</span><span class='lparen'>(</span><span class='id identifier rubyid_step'>step</span><span class='rparen'>)</span>
1810
+ <span class='comment'># Handle cases where step doesn&#39;t have parents association or it&#39;s not loaded
1811
+ </span>
1812
+ <span class='comment'># If step doesn&#39;t respond to parents, assume no dependencies
1813
+ </span> <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:parents</span><span class='rparen'>)</span>
1814
+
1815
+ <span class='comment'># If parents association exists but is empty, no dependencies to check
1816
+ </span> <span class='id identifier rubyid_parents'>parents</span> <span class='op'>=</span> <span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_parents'>parents</span>
1817
+ <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_parents'>parents</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1818
+
1819
+ <span class='comment'># Check if all parent steps are complete
1820
+ </span> <span class='id identifier rubyid_parents'>parents</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_parent'>parent</span><span class='op'>|</span>
1821
+ <span class='id identifier rubyid_completion_states'>completion_states</span> <span class='op'>=</span> <span class='lbracket'>[</span>
1822
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#COMPLETE-constant" title="Tasker::Constants::WorkflowStepStatuses::COMPLETE (constant)">COMPLETE</a></span></span><span class='comma'>,</span>
1823
+ <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#RESOLVED_MANUALLY-constant" title="Tasker::Constants::WorkflowStepStatuses::RESOLVED_MANUALLY (constant)">RESOLVED_MANUALLY</a></span></span>
1824
+ <span class='rbracket'>]</span>
1825
+ <span class='comment'># Use state_machine.current_state to avoid circular reference with parent.status
1826
+ </span> <span class='id identifier rubyid_current_state'>current_state</span> <span class='op'>=</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_state_machine'>state_machine</span><span class='period'>.</span><span class='id identifier rubyid_current_state'>current_state</span>
1827
+ <span class='id identifier rubyid_parent_status'>parent_status</span> <span class='op'>=</span> <span class='id identifier rubyid_current_state'>current_state</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span>
1828
+ <span class='id identifier rubyid_is_complete'>is_complete</span> <span class='op'>=</span> <span class='id identifier rubyid_completion_states'>completion_states</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_status'>parent_status</span><span class='rparen'>)</span>
1829
+
1830
+ <span class='kw'>unless</span> <span class='id identifier rubyid_is_complete'>is_complete</span>
1831
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
1832
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> dependency not met - </span><span class='tstring_end'>&quot;</span></span> \
1833
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>parent step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> is &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_parent_status'>parent_status</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;, needs to be complete</span><span class='tstring_end'>&quot;</span></span>
1834
+ <span class='kw'>end</span>
1835
+ <span class='kw'>end</span>
1836
+
1837
+ <span class='id identifier rubyid_is_complete'>is_complete</span>
1838
+ <span class='kw'>end</span>
1839
+ <span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1840
+ <span class='comment'># If there&#39;s an error checking dependencies, log it and assume dependencies are met
1841
+ </span> <span class='comment'># This prevents dependency checking from blocking execution in edge cases
1842
+ </span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='kw'>do</span>
1843
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Error checking dependencies for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span> \
1844
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Assuming dependencies are met.</span><span class='tstring_end'>&#39;</span></span>
1845
+ <span class='kw'>end</span>
1846
+ <span class='kw'>true</span>
1847
+ <span class='kw'>end</span></pre>
1848
+ </td>
1849
+ </tr>
1850
+ </table>
1851
+ </div>
1852
+
1853
+ </div>
1854
+
1855
+ <div id="instance_method_details" class="method_details_list">
1856
+ <h2>Instance Method Details</h2>
1857
+
1858
+
1859
+ <div class="method_details first">
1860
+ <h3 class="signature first" id="create_transition-instance_method">
1861
+
1862
+ #<strong>create_transition</strong>(from_state, to_state, metadata = {}) &#x21d2; <tt>Object</tt>
1863
+
1864
+
1865
+
1866
+
1867
+
1868
+ </h3><div class="docstring">
1869
+ <div class="discussion">
1870
+
1871
+ <p>Override Statesman’s transition building to ensure proper from_state handling This is called by Statesman when creating new transitions</p>
1872
+
1873
+
1874
+ </div>
1875
+ </div>
1876
+ <div class="tags">
1877
+
1878
+
1879
+ </div><table class="source_code">
1880
+ <tr>
1881
+ <td>
1882
+ <pre class="lines">
1883
+
1884
+
1885
+ 143
1886
+ 144
1887
+ 145
1888
+ 146
1889
+ 147
1890
+ 148
1891
+ 149
1892
+ 150
1893
+ 151
1894
+ 152
1895
+ 153
1896
+ 154
1897
+ 155
1898
+ 156
1899
+ 157
1900
+ 158
1901
+ 159
1902
+ 160
1903
+ 161
1904
+ 162
1905
+ 163
1906
+ 164
1907
+ 165
1908
+ 166
1909
+ 167
1910
+ 168
1911
+ 169
1912
+ 170
1913
+ 171
1914
+ 172
1915
+ 173
1916
+ 174
1917
+ 175
1918
+ 176
1919
+ 177
1920
+ 178
1921
+ 179
1922
+ 180
1923
+ 181
1924
+ 182</pre>
1925
+ </td>
1926
+ <td>
1927
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 143</span>
1928
+
1929
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_transition'>create_transition</span><span class='lparen'>(</span><span class='id identifier rubyid_from_state'>from_state</span><span class='comma'>,</span> <span class='id identifier rubyid_to_state'>to_state</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1930
+ <span class='comment'># Ensure from_state is properly set - never allow empty strings
1931
+ </span> <span class='id identifier rubyid_effective_from_state'>effective_from_state</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_from_state'>from_state</span>
1932
+ <span class='kw'>when</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
1933
+ <span class='comment'># For initial transitions or empty strings, use nil
1934
+ </span> <span class='kw'>nil</span>
1935
+ <span class='kw'>else</span>
1936
+ <span class='comment'># For existing states, ensure it&#39;s a valid state
1937
+ </span> <span class='id identifier rubyid_from_state'>from_state</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span>
1938
+ <span class='kw'>end</span>
1939
+
1940
+ <span class='comment'># Log transition creation for debugging
1941
+ </span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
1942
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Creating transition for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='tstring_end'>&quot;</span></span> \
1943
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_effective_from_state'>effective_from_state</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39; → &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_to_state'>to_state</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;</span><span class='tstring_end'>&quot;</span></span>
1944
+ <span class='kw'>end</span>
1945
+
1946
+ <span class='comment'># Get the next sort key
1947
+ </span> <span class='id identifier rubyid_next_sort_key'>next_sort_key</span> <span class='op'>=</span> <span class='id identifier rubyid_next_sort_key_value'>next_sort_key_value</span>
1948
+
1949
+ <span class='comment'># Create the transition with proper from_state handling
1950
+ </span> <span class='id identifier rubyid_transition'>transition</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkflowStepTransition.html" title="Tasker::WorkflowStepTransition (class)">WorkflowStepTransition</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create!'>create!</span><span class='lparen'>(</span>
1951
+ <span class='label'>workflow_step_id:</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='comma'>,</span>
1952
+ <span class='label'>to_state:</span> <span class='id identifier rubyid_to_state'>to_state</span><span class='comma'>,</span>
1953
+ <span class='label'>from_state:</span> <span class='id identifier rubyid_effective_from_state'>effective_from_state</span><span class='comma'>,</span> <span class='comment'># Use nil instead of empty string
1954
+ </span> <span class='label'>most_recent:</span> <span class='kw'>true</span><span class='comma'>,</span>
1955
+ <span class='label'>sort_key:</span> <span class='id identifier rubyid_next_sort_key'>next_sort_key</span><span class='comma'>,</span>
1956
+ <span class='label'>metadata:</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span>
1957
+ <span class='label'>created_at:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='comma'>,</span>
1958
+ <span class='label'>updated_at:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span>
1959
+ <span class='rparen'>)</span>
1960
+
1961
+ <span class='comment'># Update previous transitions to not be most recent
1962
+ </span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_transitions'>workflow_step_transitions</span>
1963
+ <span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>most_recent:</span> <span class='kw'>true</span><span class='rparen'>)</span>
1964
+ <span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='period'>.</span><span class='id identifier rubyid_not'>not</span><span class='lparen'>(</span><span class='label'>id:</span> <span class='id identifier rubyid_transition'>transition</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
1965
+ <span class='period'>.</span><span class='id identifier rubyid_update_all'>update_all</span><span class='lparen'>(</span><span class='label'>most_recent:</span> <span class='kw'>false</span><span class='rparen'>)</span>
1966
+
1967
+ <span class='id identifier rubyid_transition'>transition</span>
1968
+ <span class='kw'>end</span></pre>
1969
+ </td>
1970
+ </tr>
1971
+ </table>
1972
+ </div>
1973
+
1974
+ <div class="method_details ">
1975
+ <h3 class="signature " id="current_state-instance_method">
1976
+
1977
+ #<strong>current_state</strong> &#x21d2; <tt>Object</tt>
1978
+
1979
+
1980
+
1981
+
1982
+
1983
+ </h3><div class="docstring">
1984
+ <div class="discussion">
1985
+
1986
+ <p>Override current_state to work with custom transition model Since WorkflowStepTransition doesn’t include Statesman::Adapters::ActiveRecordTransition, we need to implement our own current_state logic using the most_recent column</p>
1987
+
1988
+
1989
+ </div>
1990
+ </div>
1991
+ <div class="tags">
1992
+
1993
+
1994
+ </div><table class="source_code">
1995
+ <tr>
1996
+ <td>
1997
+ <pre class="lines">
1998
+
1999
+
2000
+ 128
2001
+ 129
2002
+ 130
2003
+ 131
2004
+ 132
2005
+ 133
2006
+ 134
2007
+ 135
2008
+ 136
2009
+ 137
2010
+ 138
2011
+ 139</pre>
2012
+ </td>
2013
+ <td>
2014
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 128</span>
2015
+
2016
+ <span class='kw'>def</span> <span class='id identifier rubyid_current_state'>current_state</span>
2017
+ <span class='id identifier rubyid_most_recent_transition'>most_recent_transition</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_transitions'>workflow_step_transitions</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>most_recent:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
2018
+
2019
+ <span class='kw'>if</span> <span class='id identifier rubyid_most_recent_transition'>most_recent_transition</span>
2020
+ <span class='comment'># Ensure we never return empty strings or nil - always return a valid state
2021
+ </span> <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='id identifier rubyid_most_recent_transition'>most_recent_transition</span><span class='period'>.</span><span class='id identifier rubyid_to_state'>to_state</span>
2022
+ <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span>
2023
+ <span class='kw'>else</span>
2024
+ <span class='comment'># Return initial state if no transitions exist
2025
+ </span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span>
2026
+ <span class='kw'>end</span>
2027
+ <span class='kw'>end</span></pre>
2028
+ </td>
2029
+ </tr>
2030
+ </table>
2031
+ </div>
2032
+
2033
+ <div class="method_details ">
2034
+ <h3 class="signature " id="initialize_state_machine!-instance_method">
2035
+
2036
+ #<strong>initialize_state_machine!</strong> &#x21d2; <tt>Object</tt>
2037
+
2038
+
2039
+
2040
+
2041
+
2042
+ </h3><div class="docstring">
2043
+ <div class="discussion">
2044
+
2045
+ <p>Initialize the state machine with the initial state This ensures the state machine is properly initialized when called explicitly DEFENSIVE: Only creates transitions when explicitly needed</p>
2046
+
2047
+
2048
+ </div>
2049
+ </div>
2050
+ <div class="tags">
2051
+
2052
+
2053
+ </div><table class="source_code">
2054
+ <tr>
2055
+ <td>
2056
+ <pre class="lines">
2057
+
2058
+
2059
+ 193
2060
+ 194
2061
+ 195
2062
+ 196
2063
+ 197
2064
+ 198
2065
+ 199
2066
+ 200
2067
+ 201
2068
+ 202
2069
+ 203
2070
+ 204
2071
+ 205
2072
+ 206
2073
+ 207
2074
+ 208
2075
+ 209
2076
+ 210
2077
+ 211
2078
+ 212
2079
+ 213
2080
+ 214
2081
+ 215
2082
+ 216
2083
+ 217
2084
+ 218
2085
+ 219
2086
+ 220
2087
+ 221
2088
+ 222
2089
+ 223
2090
+ 224
2091
+ 225
2092
+ 226
2093
+ 227
2094
+ 228
2095
+ 229
2096
+ 230
2097
+ 231
2098
+ 232
2099
+ 233
2100
+ 234
2101
+ 235
2102
+ 236
2103
+ 237
2104
+ 238</pre>
2105
+ </td>
2106
+ <td>
2107
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 193</span>
2108
+
2109
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize_state_machine!'>initialize_state_machine!</span>
2110
+ <span class='comment'># Check if state machine is already initialized
2111
+ </span> <span class='kw'>return</span> <span class='id identifier rubyid_current_state'>current_state</span> <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkflowStepTransition.html" title="Tasker::WorkflowStepTransition (class)">WorkflowStepTransition</a></span></span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='label'>workflow_step_id:</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='rparen'>)</span>
2112
+
2113
+ <span class='comment'># DEFENSIVE: Use a rescue block instead of transaction to handle race conditions gracefully
2114
+ </span> <span class='kw'>begin</span>
2115
+ <span class='comment'># Create the initial transition only if none exists
2116
+ </span> <span class='id identifier rubyid_initial_transition'>initial_transition</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkflowStepTransition.html" title="Tasker::WorkflowStepTransition (class)">WorkflowStepTransition</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create!'>create!</span><span class='lparen'>(</span>
2117
+ <span class='label'>workflow_step_id:</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='comma'>,</span>
2118
+ <span class='label'>to_state:</span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span><span class='comma'>,</span>
2119
+ <span class='label'>from_state:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='comment'># Explicitly set to nil for initial transition
2120
+ </span> <span class='label'>most_recent:</span> <span class='kw'>true</span><span class='comma'>,</span>
2121
+ <span class='label'>sort_key:</span> <span class='int'>0</span><span class='comma'>,</span>
2122
+ <span class='label'>metadata:</span> <span class='lbrace'>{</span> <span class='label'>initialized_by:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>state_machine</span><span class='tstring_end'>&#39;</span></span> <span class='rbrace'>}</span><span class='comma'>,</span>
2123
+ <span class='label'>created_at:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='comma'>,</span>
2124
+ <span class='label'>updated_at:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span>
2125
+ <span class='rparen'>)</span>
2126
+
2127
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
2128
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Initialized state machine for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> with initial transition to PENDING</span><span class='tstring_end'>&quot;</span></span>
2129
+ <span class='kw'>end</span>
2130
+
2131
+ <span class='id identifier rubyid_initial_transition'>initial_transition</span><span class='period'>.</span><span class='id identifier rubyid_to_state'>to_state</span>
2132
+ <span class='kw'>rescue</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>RecordNotUnique</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
2133
+ <span class='comment'># Handle duplicate key violations gracefully - another thread may have initialized the state machine
2134
+ </span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='kw'>do</span>
2135
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: State machine for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> already initialized by another process: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
2136
+ <span class='kw'>end</span>
2137
+
2138
+ <span class='comment'># Return the current state since we know it&#39;s initialized
2139
+ </span> <span class='id identifier rubyid_current_state'>current_state</span>
2140
+ <span class='kw'>rescue</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>StatementInvalid</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
2141
+ <span class='comment'># Handle transaction issues gracefully
2142
+ </span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='kw'>do</span>
2143
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>StepStateMachine: Transaction issue initializing state machine for step </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
2144
+ <span class='kw'>end</span>
2145
+
2146
+ <span class='comment'># Check if the step actually has transitions now (another process may have created them)
2147
+ </span> <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../../Tasker.html" title="Tasker (module)">Tasker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkflowStepTransition.html" title="Tasker::WorkflowStepTransition (class)">WorkflowStepTransition</a></span></span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='label'>workflow_step_id:</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_id'>workflow_step_id</span><span class='rparen'>)</span>
2148
+ <span class='id identifier rubyid_current_state'>current_state</span>
2149
+ <span class='kw'>else</span>
2150
+ <span class='comment'># If still no transitions, return the default state without creating a transition
2151
+ </span> <span class='const'><span class='object_link'><a href="../Constants.html" title="Tasker::Constants (module)">Constants</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html" title="Tasker::Constants::WorkflowStepStatuses (module)">WorkflowStepStatuses</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Constants/WorkflowStepStatuses.html#PENDING-constant" title="Tasker::Constants::WorkflowStepStatuses::PENDING (constant)">PENDING</a></span></span>
2152
+ <span class='kw'>end</span>
2153
+ <span class='kw'>end</span>
2154
+ <span class='kw'>end</span></pre>
2155
+ </td>
2156
+ </tr>
2157
+ </table>
2158
+ </div>
2159
+
2160
+ <div class="method_details ">
2161
+ <h3 class="signature " id="next_sort_key_value-instance_method">
2162
+
2163
+ #<strong>next_sort_key_value</strong> &#x21d2; <tt>Object</tt>
2164
+
2165
+
2166
+
2167
+
2168
+
2169
+ </h3><div class="docstring">
2170
+ <div class="discussion">
2171
+
2172
+ <p>Get the next sort key for transitions</p>
2173
+
2174
+
2175
+ </div>
2176
+ </div>
2177
+ <div class="tags">
2178
+
2179
+
2180
+ </div><table class="source_code">
2181
+ <tr>
2182
+ <td>
2183
+ <pre class="lines">
2184
+
2185
+
2186
+ 185
2187
+ 186
2188
+ 187
2189
+ 188</pre>
2190
+ </td>
2191
+ <td>
2192
+ <pre class="code"><span class="info file"># File 'lib/tasker/state_machine/step_state_machine.rb', line 185</span>
2193
+
2194
+ <span class='kw'>def</span> <span class='id identifier rubyid_next_sort_key_value'>next_sort_key_value</span>
2195
+ <span class='id identifier rubyid_max_sort_key'>max_sort_key</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_workflow_step_transitions'>workflow_step_transitions</span><span class='period'>.</span><span class='id identifier rubyid_maximum'>maximum</span><span class='lparen'>(</span><span class='symbol'>:sort_key</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='op'>-</span><span class='int'>1</span>
2196
+ <span class='id identifier rubyid_max_sort_key'>max_sort_key</span> <span class='op'>+</span> <span class='int'>10</span> <span class='comment'># Use increments of 10 for flexibility
2197
+ </span><span class='kw'>end</span></pre>
2198
+ </td>
2199
+ </tr>
2200
+ </table>
2201
+ </div>
2202
+
2203
+ </div>
2204
+
2205
+ </div>
2206
+
2207
+ <div id="footer">
2208
+ Generated on Tue Jul 1 16:47:40 2025 by
2209
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2210
+ 0.9.37 (ruby-3.2.4).
2211
+ </div>
2212
+
2213
+ </div>
2214
+ </body>
2215
+ </html>