aws / aws/aws-durable-execution-sdk-rust
Use Result for join_all item outcomes instead of Settled
- Dominant language
- Rust
- Stars
- 13
- Forks
- 0
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
## Problem
`DurableContext::join_all` currently represents each input future's outcome with the custom enum:
```rust
pub enum Settled {
Fulfilled(O),
Rejected(OperationError),
}
```
`Fulfilled` / `Rejected` is JavaScript `Promise.allSettled()` terminology. In Rust, the standard representation of the same success-or-failure state is `Result`. The custom enum adds another type and matching vocabulary for callers to learn without adding a distinct state or invariant.
The current return shape is effectively:
```rust
Result>, OperationError>
```
The outer `Result` represents failure of the durable combinator itself, while each inner value represents an individual operation outcome. That distinction can be retained with the standard type:
```rust
Result>, OperationError>
```
## Proposed change
Replace `Settled` in the public `join_all` result with `Result`, and update the implementation, documentation, examples, and conformance handlers accordingly.
If the nested `Result` needs additional clarity in signatures or documentation, introduce a descriptive type alias rather than a new two-variant enum:
```rust
pub type Settled = Result;
```
The alias could also provide a temporary migration path before removing the bespoke enum.
## Why this is more idiomatic Rust
- Callers use the standard `Ok` / `Err` patterns and existing `Result` combinators.
- The API avoids JavaScript Promise terminology in a Rust SDK.
- Generic code that already works with `Result` can consume item outcomes directly.
- The type communicates that there are exactly two states and that rejection carries an error.
## Compatibility
This is a breaking public-API change, so it is best considered before the preview API stabilizes. Serialized checkpoint behavior need not change; this should be a Rust-facing representation change only.
## Acceptance criteria
- [ ] `join_all` returns per-item `Result` outcomes.
- [ ] The outer combinator-level `Result` remains distinct and documented.
- [ ] Examples and conformance handlers use `Ok` / `Err`.
- [ ] `Settled::Fulfilled` and `Settled::Rejected` are removed or covered by a documented migration path.
- [ ] Checkpoint and replay wire formats remain unchanged.
Contributor guide
Research direction
Start at the public `DurableContext::join_all` API and trace its implementation, documentation, examples, and conformance handlers that use `Settled`. Check the checkpoint and replay serialization paths before changing the Rust-facing representation; done means per-item outcomes use `Result`, examples and handlers use `Ok`/`Err`, and wire formats remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100