refactor: migrate all tests/benches from TaskExecutor to TypedExecutor#66
Merged
Conversation
Eliminate all usage of the untyped `TaskExecutor` + `raw_executor` API
from tests, benchmarks, and examples in preparation for removing the
untyped public API.
- Convert 47 `impl TaskExecutor for` to `impl TypedExecutor<T> for`
- Convert 87 `.raw_executor("name", exec)` to `.task::<T>(exec)`
- Add `define_task!` macro in common.rs for zero-boilerplate task types
- Define ~35 TypedTask unit structs across test/bench files
- Make shared test executors generic: `impl<T: TypedTask> TypedExecutor<T>`
- Handle missing payloads in `TaskContext::payload()` by deserializing
from JSON null (supports unit-struct tasks submitted without payload)
No public API changes. All 276 tests pass.
Contributor
Benchmark ComparisonClick to expand |
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>
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
TaskExecutortrait withTypedExecutor<T>across every test, benchmark, and example, enforcing compile-time type safety for task payloadsdefine_task!macro in integration test helpers to reduce boilerplate when declaring zero-payloadTypedTasktypesTaskContext::payload()to fall back to deserializing from JSONnull, allowing unit-struct typed tasks (e.g.struct Noop;) submitted via rawTaskSubmission::new(...)to still resolve correctlyScheduler::new()+TaskTypeRegistryconstruction to theScheduler::builder()+Domain::task::<T>()API, matching the recommended public API surfaceChanged files
src/registry/context.rs—payload<T>()now falls back toserde_json::from_value(Null)when no payload blob is storedsrc/registry/mod.rs— unit tests useDomain::task()→into_module()to produce erased executors instead of directly constructingArc<dyn ErasedExecutor>fromTaskExecutorsrc/module.rs— module-level test updated to useDomain+TypedExecutorsrc/scheduler/tests.rs— all ~40 scheduler tests rewritten: typed domain/task structs,Scheduler::builder(), fully-qualified task type strings ("test::test","parent::parent", etc.)tests/integration/common.rs—define_task!macro + ~20 shared typed task definitions;NoopExecutor,DelayExecutor,CountingExecutornow implementTypedExecutor<T>genericallytests/integration/*.rs— all integration tests migrated to typed APIbenches/*.rs— all benchmarks migrated to typed APIexamples/profile_dep_chain.rs— migrated to typed API