Skip to content

Fix: Add sort parameter to checkpoint query for deterministic retrieval#68

Merged
mraible merged 1 commit intomainfrom
fix/add-sort-to-checkpoint-query
Oct 17, 2025
Merged

Fix: Add sort parameter to checkpoint query for deterministic retrieval#68
mraible merged 1 commit intomainfrom
fix/add-sort-to-checkpoint-query

Conversation

@mraible
Copy link
Contributor

@mraible mraible commented Oct 17, 2025

Add sort parameter to SearchObjects call in process-events function to ensure the most recent checkpoint is always retrieved when multiple checkpoints exist for the same workflow_id.

Without sorting by last_processed_timestamp in descending order, the API could return any matching record, leading to:

  • Processing stale checkpoint data
  • Reprocessing already-handled events
  • Unpredictable behavior in production workflows

Changes:

  • Add sort="last_processed_timestamp.desc" parameter to SearchObjects
  • Update comment to clarify intent
  • Maintain pylint compliance with proper formatting

The last_processed_timestamp field is indexed in the processing_checkpoints collection schema, making this sort operation efficient.

Add sort parameter to SearchObjects call in process-events function to ensure
the most recent checkpoint is always retrieved when multiple checkpoints exist
for the same workflow_id.

Without sorting by last_processed_timestamp in descending order, the API could
return any matching record, leading to:
- Processing stale checkpoint data
- Reprocessing already-handled events
- Unpredictable behavior in production workflows

Changes:
- Add sort="last_processed_timestamp.desc" parameter to SearchObjects
- Update comment to clarify intent
- Maintain pylint compliance with proper formatting

The last_processed_timestamp field is indexed in the processing_checkpoints
collection schema, making this sort operation efficient.
@mraible mraible requested a review from a team October 17, 2025 14:22
@mraible mraible merged commit 6798b0f into main Oct 17, 2025
@mraible mraible deleted the fix/add-sort-to-checkpoint-query branch October 17, 2025 14:38
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.

2 participants