Skip to content

refactor(async): enforce async-separation + arun_worker kwarg parity#56

Merged
pratyush618 merged 1 commit intomasterfrom
fix/workflow-correctness
Apr 24, 2026
Merged

refactor(async): enforce async-separation + arun_worker kwarg parity#56
pratyush618 merged 1 commit intomasterfrom
fix/workflow-correctness

Conversation

@pratyush618
Copy link
Copy Markdown
Collaborator

Summary

Closes two P1 items from the 2026-04-23 audit that were still open after PR #53 landed the P0 fixes.

  • Async-separationpy_src/taskito/canvas.py and py_src/taskito/result.py no longer import asyncio. JobResult.astream is moved into AsyncJobResultMixin alongside aresult. group.apply_async / chord.apply_async are extracted into a new async_support/canvas.py as AsyncGroupMixin / AsyncChordMixin, and the sync classes inherit from them. This keeps the project's rule that asyncio lives only under async_support/ (plus the two documented exceptions).
  • arun_worker kwarg parityAsyncQueueMixin.arun_worker now accepts pool and app, matching the sync run_worker signature introduced with the prefork pool. The Protocol run_worker stub inside AsyncQueueMixin is updated to match.
  • Tightening while here — the new async canvas mixins delegate to Signature.apply() and use dataclasses.replace() for the chord callback rebuild, collapsing the inline enqueue-loop duplication that existed before.

Verification

  • cargo check --workspace + --features postgres + --features redis + --features native-async — all clean
  • cargo test --workspace — all pass
  • uv run pytest tests/python/ — 432 passed, 9 skipped
  • uv run ruff check py_src/ tests/ — clean
  • uv run mypy py_src/taskito/ + tests — clean
  • Pre-commit hooks (ruff, ruff format, mypy) — all pass

Test plan

  • Full Python test suite (432 passed, 9 skipped)
  • Rust workspace tests across all feature combinations
  • Ruff + mypy on py_src/ and tests/
  • Verified no asyncio references remain in canvas.py or result.py
  • Verified arun_worker forwards pool and app to run_worker

- Move JobResult.astream into AsyncJobResultMixin alongside aresult.
- Extract group/chord.apply_async into async_support/canvas.py as
  AsyncGroupMixin and AsyncChordMixin; canvas.py and result.py no
  longer import asyncio.
- Add missing pool and app kwargs to AsyncQueueMixin.arun_worker;
  update the Protocol run_worker stub to match.
- Async canvas path delegates to Signature.apply() and
  dataclasses.replace() to deduplicate the wave/chord enqueue loops.

Addresses P1 items from the 2026-04-23 audit (async-separation
violations in canvas.py / result.py, arun_worker signature drift).
@pratyush618 pratyush618 force-pushed the fix/workflow-correctness branch from eb3da54 to 5eb1943 Compare April 24, 2026 18:25
@pratyush618 pratyush618 merged commit f4fa2f4 into master Apr 24, 2026
11 checks passed
@pratyush618 pratyush618 deleted the fix/workflow-correctness branch April 24, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant