feat!: replace &TaskContext with DomainTaskContext<D> for type-safe child spawning#68
Merged
Conversation
…hild spawning Introduce a domain-parameterized execution context wrapper that enables compile-time–safe child spawning and eliminates the untyped executor API from the public surface. - Add DomainTaskContext<'a, D> (zero-cost wrapper: &TaskContext + PhantomData) - Add ChildSpawnBuilder with .key()/.priority()/.ttl()/.group() overrides - Add DomainSubmitBuilder::child_of() for cross-domain children - Change TypedExecutor<T> signature: ctx parameter is now DomainTaskContext - Make TaskExecutor, TaskContext, raw_executor, submit_raw pub(crate) - Migrate all executor impls, spawn_child, and submit_raw call sites Closes #65
Merged
deepjoy
pushed a commit
that referenced
this pull request
Mar 21, 2026
## 🤖 New release
* `taskmill`: 0.5.3 -> 0.6.0 (⚠ API breaking changes)
### ⚠ `taskmill` breaking changes
```text
--- failure inherent_method_missing: pub method removed or renamed ---
Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/inherent_method_missing.ron
Failed in:
DomainHandle::submit_raw, previously in file /tmp/.tmpZpSjOB/taskmill/src/domain.rs:502
DomainHandle::submit_raw, previously in file /tmp/.tmpZpSjOB/taskmill/src/domain.rs:502
Domain::raw_executor, previously in file /tmp/.tmpZpSjOB/taskmill/src/domain.rs:349
Domain::raw_executor, previously in file /tmp/.tmpZpSjOB/taskmill/src/domain.rs:349
TaskTypeRegistry::register, previously in file /tmp/.tmpZpSjOB/taskmill/src/registry/mod.rs:170
TaskTypeRegistry::register_with_ttl, previously in file /tmp/.tmpZpSjOB/taskmill/src/registry/mod.rs:179
TaskTypeRegistry::register_with_retry_policy, previously in file /tmp/.tmpZpSjOB/taskmill/src/registry/mod.rs:190
--- failure struct_missing: pub struct removed or renamed ---
Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/struct_missing.ron
Failed in:
struct taskmill::registry::TaskContext, previously in file /tmp/.tmpZpSjOB/taskmill/src/registry/context.rs:29
struct taskmill::TaskContext, previously in file /tmp/.tmpZpSjOB/taskmill/src/registry/context.rs:29
--- failure trait_missing: pub trait removed or renamed ---
Description:
A publicly-visible trait cannot be imported by its prior path. A `pub use` may have been removed, or the trait itself may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/trait_missing.ron
Failed in:
trait taskmill::registry::TaskExecutor, previously in file /tmp/.tmpZpSjOB/taskmill/src/registry/mod.rs:56
trait taskmill::TaskExecutor, previously in file /tmp/.tmpZpSjOB/taskmill/src/registry/mod.rs:56
```
<details><summary><i><b>Changelog</b></i></summary><p>
<blockquote>
## [0.6.0](v0.5.3...v0.6.0)
- 2026-03-21
### Added
- [**breaking**] replace `&TaskContext` with `DomainTaskContext<D>` for
type-safe child spawning
([#68](#68))
### Other
- migrate all tests/benches from TaskExecutor to TypedExecutor
([#66](#66))
</blockquote>
</p></details>
---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Contributor
Benchmark ComparisonClick to expand |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DomainTaskContext<'a, D>, a zero-cost wrapper (&TaskContext+PhantomData<D>) that carries domain identity as a type parameter, enabling compile-time–safe child spawningChildSpawnBuilderwith.key()/.priority()/.ttl()/.group()overrides andIntoFuturesupportDomainSubmitBuilder::child_of(&ctx)for ergonomic cross-domain child creationTypedExecutor<T>trait:ctxparameter is nowDomainTaskContext<'a, T::Domain>instead of&'a TaskContextTaskExecutor,TaskContext,Domain::raw_executor(), andDomainHandle::submit_raw()from the public APIDomainSubmitBuilder::on_dependency_failurewhich was previously a no-opspawn_childcall sites, andsubmit_rawcall sites across tests, benches, and examplesBreaking changes
ctx: &'a TaskContextctx: DomainTaskContext<'a, T::Domain>ctx.spawn_child(TaskSubmission::new("name").payload_json(&t)?)ctx.spawn_child_with(t).key("name").await?ctx.domain::<D>().submit_with(t).parent(ctx.record().id)ctx.domain::<D>().submit_with(t).child_of(&ctx)domain.raw_executor("name", exec)Domain::task::<T>(exec)handle.submit_raw(TaskSubmission::new(...))handle.submit_with(typed_task)pub use registry::{TaskContext, TaskExecutor}