Skip to content

v0.1.0-beta.1

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 14 Oct 21:43
· 103 commits to main since this release
cb334e0

The first beta: specification 0.1.0, tier 1, capabilities sync, async and testing, cases v0.1.0-rc.15. The minimum supported Rust version is 1.85.

Added

  • Steps that declare the data they need and report an outcome. Only an attempt that succeeds commits its contributions to the data bag of values. A retry budget alone decides whether a failed or abnormally terminated attempt is tried again; a step that says no_retry_on_abnormal_termination() is not retried after an abnormal termination.
  • Step and workflow policies, every hook kind with its requests and lifecycles, roles the workflow provides, and input adapters.
  • Rescue steps: a step may have a rescue step, which runs when the step fails or terminates abnormally and, once it succeeds, lets the step run again. Input adapters and service providers are attached to it by the name <step name>_rescue.
  • Services that steps request by key, made by service providers of the workflow for the journey or for each attempt, and attached to chosen steps, rescue steps included, or to no step, serving every step that requests their key and has no provider of its own for it. A provider returns its service made with service::provide!, which names the implementation it made, its concrete type, on the service_provided event, together with data the provider may add.
  • Workflow descriptors declared with the builder and refused when they break a rule of the specification, and listed, with their steps, policies, input adapters, services and rescue steps, by listing(); workflow instances with their initial data, journey IDs and reporters, and the results and refusals of a journey.
  • Events, reporters, dispatchers and their factories, with the default dispatcher, and two ready-made reporters: DebugReporter, which prints every event, and, with the testing feature, RecordingReporter, which keeps every event, and the latest value of each entry of global metadata, for a test to read.
  • Global metadata: entries of a key and a value, apart from the data bag, that every reporter receives as soon as each one is set, starting with the journey ID under the key journey_id. A workflow instance may start with more entries, and steps, hooks and service providers may set entries while the journey runs, each recorded by a global_metadata_set event that carries its key but not its value.
  • Test support, with the testing feature: RecordingReporter::path(), which lists the flow a recorded journey took, one plain line per attempt's outcome, decision and end; fake_provider, on the instance builder and on the builder #[workflow] generates, which puts a fake in place of a service provider for one instance; scripted runs, instance.scripted(), which play what named steps' attempts do, without their business rules, and record what each attempt was built with; and recorders that let a test call a step's run, a hook or an input adapter directly, outside any journey: journey::Contributions lends a contributor, step::StepEventReporter and policy::HookEventReporter lend the reporters and keep what is emitted and the global metadata that was set, and journey::DataBag::default().with(key, value) builds a data bag whose access() an input adapter reads.
  • Step and rescue step outcomes can be read back with is_success, is_failure and reason, and a step's outcome also with is_skipped; what a hook returned, with keeps_default, fails_workflow and finishes_workflow from policy::ReturnedLifecycle.
  • The local executor and, with the async feature, the asynchronous local executor, and executor::local_executor_for!, which makes the local executor of a workflow's mode.
  • With the async feature, mode::async_trait, the attribute for services and roles whose methods are asynchronous.
  • With the macros feature, on by default, attributes and derives that declare steps, rescue steps, policies, workflows with their service providers, roles and journey data as syntax over the builder. A workflow declared with #[workflow] takes its mode from its steps and refuses steps of both modes, and #[service] takes a service only as a trait object, such as &dyn PaymentGateway, refusing a concrete type.
  • Compile errors, instead of checks while a journey runs, for the rules the specification lets an implementation make impossible to express: a lifecycle a hook may not return, a role the workflow does not provide, an asynchronous part on the synchronous executor or an asynchronous service provider in a synchronous workflow, a rescue step that skips, a service provider of journey scope requesting the step being built or the attempt, a service provider returning nothing, a non-value entering the data bag, event data, a reason's details or global metadata, handles used after their attempt or call, and an input adapter writing to the data bag.