-
Notifications
You must be signed in to change notification settings - Fork 2
Description
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:
- Creates an instance via
enqueue_for_orchestrator+fetch_orchestration_item+ack_orchestration_item - Simulates
ContinueAsNewby creating execution_id=2 (stillRunning) - Calls
prune_executions_bulkwithkeep_last: Some(1) - Verifies execution_id=1 was deleted while execution_id=2 remains
- 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
enhancementprovider-validationduroxide-pg