Skip to content

Add provider validation test: prune_executions_bulk should include Running instances #50

@affandar

Description

@affandar

Summary

The prune_executions_bulk function should be able to prune old executions from instances that are still in Running status. This is important for long-running orchestrations that use ContinueAsNew - they accumulate old executions that need periodic cleanup, but the instance itself remains Running.

Current State

The current provider validation tests for pruning (test_prune_options_combinations, test_prune_safety, test_prune_bulk) only create instances in Completed state using the create_multi_execution_instance helper. They don't validate that providers correctly handle Running instances with old executions.

Bug Found in duroxide-pg-opt

This gap allowed a bug to slip through: duroxide-pg-opt's prune_executions_bulk was filtering with:

WHERE e.status IN ('Completed', 'Failed', 'ContinuedAsNew')

This excluded all Running instances from being pruned, meaning long-running orchestrations would never have their old executions cleaned up.

Proposed Test

Add a provider validation test like test_prune_bulk_includes_running_instances that:

  1. Creates an instance via enqueue_for_orchestrator + fetch_orchestration_item + ack_orchestration_item
  2. Simulates ContinueAsNew by creating execution_id=2 (still Running)
  3. Calls prune_executions_bulk with keep_last: Some(1)
  4. Verifies execution_id=1 was deleted while execution_id=2 remains
  5. Verifies the instance is still Running

Note: I see there's already an integration test test_prune_bulk_includes_running_instances in tests/prune_integration_tests.rs (issue #44), but this requires a full runtime. A provider validation test would catch implementation bugs without needing the runtime.

Labels

  • enhancement
  • provider-validation
  • duroxide-pg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions