Skip to content

test(workflow_ops): unit tests for module helpers#147

Merged
pratyush618 merged 1 commit into
masterfrom
test/workflow-ops-rust-tests
May 8, 2026
Merged

test(workflow_ops): unit tests for module helpers#147
pratyush618 merged 1 commit into
masterfrom
test/workflow-ops-rust-tests

Conversation

@pratyush618
Copy link
Copy Markdown
Collaborator

Summary

Adds 8 inline unit tests to crates/taskito-python/src/py_queue/workflow_ops/mod.rs covering the three pure helpers and the cascade_skip_pending_nodes orchestrator that the rest of the workflow_ops submodules build on:

  • build_metadata_json — JSON output is correctly escaped for special characters and Unicode (regression coverage for the bug whose fix is documented inline).
  • parse_step_metadata — happy-path round-trip + invalid-JSON error path.
  • status_to_py — canonical state string mapping.
  • cascade_skip_pending_nodes — pending/ready nodes get skipped, terminal/running nodes left alone, attached jobs get cancelled, and an empty node slice is a no-op.

The PyO3 entry-point methods (mark_workflow_node_result, check_fan_out_completion, expand_fan_out, gate ops, etc.) are not covered here. They take Python<'_> and call py.allow_threads and self.storage — testing them as Rust unit tests would require constructing a full PyQueue plus a Python interpreter. The underlying state transitions they wrap (finalize_fan_out_parent, update_workflow_run_state, update_workflow_node_status) are already tested in the taskito-workflows crate's contract suite. The remaining gap is the PyO3 glue, which is exercised by the Python workflow test suite end-to-end.

Addresses recommendation 7 from the 2026-05-08 audit (.claude/reports/audit-2026-05-08.md).

Test plan

  • cargo test --workspace --features workflows — 8 new tests pass alongside the existing suite.
  • cargo clippy --workspace --features workflows — clean.
  • cargo fmt --all --check — clean.

@github-actions github-actions Bot added the rust label May 8, 2026
@pratyush618 pratyush618 merged commit da3a8ba into master May 8, 2026
19 checks passed
@pratyush618 pratyush618 deleted the test/workflow-ops-rust-tests branch May 8, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant