Azure / Azure/azure-functions-durable-python
[Bug] Bug: purge_instance_history_by has incorrect parameter handling and time filter behavior
- Dominant language
- Python
- Stars
- 157
- Forks
- 70
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 2
Description
### Expected Behavior
The created_time_from parameter should be optional, and the time filters should be combined with an intersection (AND) to allow precise time intervals.
### Actual Behavior
Observe that the API returns a 400 Bad Request error.
### Steps to Reproduce
Use the following code to call purge_instance_history_by
```shell
await client.purge_instance_history_by(
created_time_to=datetime.now(timezone.utc) - timedelta(days=1),
runtime_status=[
df.OrchestrationRuntimeStatus.Completed,
df.OrchestrationRuntimeStatus.Failed,
df.OrchestrationRuntimeStatus.Terminated,
],
)
```
Observe that the API returns a 400 Bad Request error.
### requirements.txt file
```shell
azure-functions-durable==1.2.10
```
### **Description:**
When using the _purge_instance_history_by_ method in the _DurableOrchestrationClient_ I encountered the following issues:
1. **Missing Mandatory Parameter:**
The created_time_from parameter is treated as optional in the SDK, but it is actually mandatory in the underlying API. If created_time_from is not
provided, the API returns a 400 Bad Request error.
2. **Time Filter Behavior:**
The time filters (created_time_from and created_time_to) are combined with a union (OR) instead of an intersection (AND). This makes it impossible
to define precise time intervals for purging.
Contributor guide
Research direction
Start at purge_instance_history_by on DurableOrchestrationClient and review the behavior described in the issue alongside the azure-functions-durable==1.2.10 requirement. Use the provided call to verify that omitting created_time_from no longer produces a 400 response and that created_time_from and created_time_to define an intersecting interval.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100