Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[[profile.default.overrides]]
# File-backed end-to-end latency assertions must not compete with other tests.
filter = 'binary(=runtime_options_test) & (test(=test_fast_polling) | test(=test_default_polling_frequency))'
threads-required = "num-test-threads"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.2.1] - 2026-11-25

**Release:** <https://crates.io/crates/duroxide/0.2.1>

Includes [#64](https://github.com/microsoft/duroxide/pull/64).

### Added

- **Foreign-runtime lifecycle integration** - Add fallible preparation and startup,
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "duroxide"
version = "0.2.0"
version = "0.2.1"
edition = "2024"
description = "Durable code execution framework for Rust"
license = "MIT"
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
[![Crates.io](https://img.shields.io/crates/v/duroxide.svg)](https://crates.io/crates/duroxide)
[![Documentation](https://docs.rs/duroxide/badge.svg)](https://docs.rs/duroxide)

> **[Latest Release: v0.2.0](https://crates.io/crates/duroxide/0.2.0)** — Activities can defer work until resources are available without holding a worker slot. SQLite prevents deferred work from starving ready items, and workers retry transient errors when acknowledging activity results.
> See [CHANGELOG.md](CHANGELOG.md#020---2026-11-19) for release notes and provider upgrade requirements.
> **[Latest Release: v0.2.1](https://crates.io/crates/duroxide/0.2.1)** — Fallible worker startup, passive stop/fault observation, and explicit cleanup outcomes. Runtime-owned tasks and registered foreign cleanup remain owned until they end.
> See [CHANGELOG.md](CHANGELOG.md#021---2026-11-25) for release notes. Upgrades from 0.1.x must also follow the [0.2.0 provider notes](CHANGELOG.md#provider-notes-for-020).
>
> **Release policy:** Official packages are published through Microsoft-managed
> internal pipelines. Repository GitHub Actions are validation-only. See
Expand Down Expand Up @@ -47,17 +47,17 @@ and [Temporal](https://temporal.io/).

```toml
[dependencies]
duroxide = { version = "0.2", features = ["sqlite"] } # With the bundled SQLite provider
duroxide = { version = "0.2.1", features = ["sqlite"] } # With the bundled SQLite provider
# OR
duroxide = "0.2" # Core only — bring your own Provider
duroxide = "0.2.1" # Core only — bring your own Provider
```

## Examples

### Hello world

The fallible lifecycle calls below are **unreleased**. Use the source build
containing these changes; the published 0.1.32 crate does not have them.
The fallible lifecycle calls below require Duroxide **0.2.1 or later**.
Matching .NET, Node, and Python SDK updates remain unreleased.

```rust
use std::sync::Arc;
Expand Down Expand Up @@ -102,7 +102,9 @@ rt.shutdown_with_grace(std::time::Duration::from_secs(1)).await?;
# }
```

### Worker lifetime (unreleased)
<a name="worker-lifetime-unreleased"></a>

### Worker lifetime

Use `Runtime::prepare` followed by `Arc::clone(&runtime).start_execution().await`
to handle startup errors without a panic. Preparation does not start work or
Expand Down Expand Up @@ -140,7 +142,7 @@ before replacing a failed worker.
Legacy `shutdown(None)` still uses one second of grace and returns `()` after cleanup.
It has no total deadline and logs operational failures. SDK nanosecond transport
limits do not restrict native grace. See the
[lifecycle guide](docs/ORCHESTRATION-GUIDE.md#worker-lifecycle-unreleased) for
[lifecycle guide](docs/ORCHESTRATION-GUIDE.md#worker-lifecycle) for
validation, provider I/O, and language-adapter boundaries.

### Surviving crashes
Expand Down
17 changes: 10 additions & 7 deletions docs/ORCHESTRATION-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

### Minimum Viable Orchestration

The fallible lifecycle in this example is **unreleased**, requiring a matching
source build rather than published 0.1.32.
The fallible lifecycle in this example requires Duroxide **0.2.1 or later**.

```rust
use duroxide::{ActivityContext, OrchestrationContext, OrchestrationRegistry, Client};
Expand Down Expand Up @@ -81,7 +80,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```

### Worker lifecycle (unreleased)
<a name="worker-lifecycle-unreleased"></a>

### Worker lifecycle

`Runtime::prepare` validates configuration and returns an `Arc` without starting work.
It does not call the provider. `start_execution` requires a Tokio executor.
Expand Down Expand Up @@ -165,7 +166,9 @@ Legacy `shutdown(None)` retains the unit return and one-second grace;
`Some(0)` requests immediate force. Both wait for actual cleanup without a total limit.
They log operational failures instead of raising shutdown-timeout panics.

### Native stop observation (unreleased)
<a name="native-stop-observation-unreleased"></a>

### Native stop observation

Use `Runtime::stop_status()` to read the current stop state.
Use `Runtime::stop_observer()` to obtain an owned, read-only `RuntimeStopObserver`.
Expand Down Expand Up @@ -237,7 +240,7 @@ Contained user-cleanup incidents use native tracing, not stop-state notification

### Fault shutdown and recovery

The unreleased core contains cleanup panics at named user-code boundaries:
Since 0.2.1, the core contains cleanup panics at named user-code boundaries:
destruction of an activity future or application admission guard, and destruction
of an orchestration driver after a valid, finalized turn decision in
Runtime-owned replay. Core obligations keep their independent completion and
Expand Down Expand Up @@ -265,7 +268,7 @@ This can interrupt unrelated work already admitted by the same worker.
There is no general recovery or configurable catch-and-continue mode.

Each contained incident emits a protected
[native cleanup diagnostic](observability-guide.md#contained-user-cleanup-incidents-unreleased).
[native cleanup diagnostic](observability-guide.md#contained-user-cleanup-incidents).
It does not set `Faulted`. A failure in diagnostic reporting remains a Runtime
fault. Passive stop observation is not an incident stream or a health check.

Expand Down Expand Up @@ -376,7 +379,7 @@ This contract does not cover unregistered continuations.
The .NET adapter registers its handler root and SDK continuations.
The Node and Python adapters do not provide that additional guarantee.

Production [retirement diagnostics](observability-guide.md#pending-foreign-retirements-unreleased)
Production [retirement diagnostics](observability-guide.md#pending-foreign-retirements)
report pending foreign completions separately from durable workload metrics.
A zero count is never permission to release resources.

Expand Down
18 changes: 13 additions & 5 deletions docs/observability-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ All metrics follow Prometheus naming conventions with `_total` for counters and
| `duroxide_orchestration_poison_total` | Counter | Orchestration | _(none)_ | Confirmed poison acknowledgements |
| `duroxide_orchestration_poison_failed_total` | Counter | Orchestration | _(none)_ | Poison acknowledgements that returned an error after retries |
| `duroxide_active_orchestrations` | Gauge | Orchestration | _(none)_ | **Current** active count |
| `duroxide_pending_foreign_retirements` | Gauge | Runtime lifecycle | _(none)_ | Aggregate independently retained foreign completions (unreleased) |
| `duroxide_pending_foreign_retirements` | Gauge | Runtime lifecycle | _(none)_ | Aggregate independently retained foreign completions (since 0.2.1) |
| **Activity Execution** |
| `duroxide_activity_executions_total` | Counter | Activity | activity_name, outcome, retry_attempt | Track success/failure rates |
| `duroxide_activity_admission_deferrals_total` | Counter | Activity | activity_name, tag | Track admission deferrals whose abandon returned success |
Expand All @@ -221,7 +221,11 @@ All metrics follow Prometheus naming conventions with `_total` for counters and

**Note**: Internal dispatcher metrics use dot notation and milliseconds (not exported to Prometheus by default).

### Native stop observation (unreleased)
The native lifecycle APIs and diagnostics below require Duroxide 0.2.1 or later.

<a name="native-stop-observation-unreleased"></a>

### Native stop observation

`Runtime::stop_status()` reports `NotRequested`, `Requested`, or `Faulted`.
This is retained stop/fault state, not readiness or a health check.
Expand All @@ -239,10 +243,12 @@ can be released. Matching unreleased SDKs expose passive observers; default .NET
hosting monitors its actual lifecycle owner for diagnostics only.
Contained user-cleanup incidents do not set `Faulted` and are not delivered by
that monitor. Native tracing reports them separately.
See [native stop observation](ORCHESTRATION-GUIDE.md#native-stop-observation-unreleased)
See [native stop observation](ORCHESTRATION-GUIDE.md#native-stop-observation)
for the state contract, cancellation rules, example, and ownership diagram.

### Contained user-cleanup incidents (unreleased)
<a name="contained-user-cleanup-incidents-unreleased"></a>

### Contained user-cleanup incidents

Enable the native `duroxide::runtime::cleanup` tracing target at `error`.
Each contained incident uses `category="contained_user_cleanup"` and
Expand Down Expand Up @@ -271,7 +277,9 @@ stops the Runtime. No new incident observer, host-stop policy or automatic resta
is provided. See [fault shutdown and recovery](ORCHESTRATION-GUIDE.md#fault-shutdown-and-recovery)
for eligibility, preserved outcomes and the failures that remain Runtime-fatal.

### Pending foreign retirements (unreleased)
<a name="pending-foreign-retirements-unreleased"></a>

### Pending foreign retirements

`duroxide_pending_foreign_retirements` counts registered foreign completions that
the runtime retains independently after a turn. The existing metrics facade
Expand Down
4 changes: 4 additions & 0 deletions tests/common/runtime_lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ pub struct Fixture {
impl Fixture {
pub async fn new() -> Self {
let inner: Arc<dyn Provider> = Arc::new(SqliteProvider::new_in_memory().await.unwrap());
Self::with_store(inner)
}

pub fn with_store(inner: Arc<dyn Provider>) -> Self {
let hooks = LifecycleHooks::default();
let provider = Arc::new(ControlledProvider::new(
Arc::clone(&inner),
Expand Down
Loading
Loading