You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you read the contributing guidelines? Yes, I've ran clippy, the tests and the check for the wasm example. I did have to run it with specific features to disable the aws crypto as I can't build that on my machine and instead used jwt_rust_crypto, I hope that isn't an issue.
Have you made sure that the title is accurate and descriptive of the changes? Yes
Notes
Sorry if the commits are a little messy, I wanted to branch off 0.32 on my side so I could use that as a dependency in my own Cargo.toml, I merged it into main before creating this PR though.
Also I wasn't sure on making canceled_by a usize, I did it for consistency with other variants but task ids are usually u32 so I wasn't sure.
Also I kept the 'wrong' spelling of cancelled with 1 'l'
The PR adds support for canceled tasks in the Meilisearch Rust SDK by introducing a CanceledTask struct and extending the Task enum with a new Canceled variant. The client's task-waiting logic is updated to handle the canceled status as a terminal state alongside failed and succeeded.
Changes
Cohort / File(s)
Summary
Client task waiting src/client.rs
Modified wait_for_task to immediately return when encountering Task::Canceled status alongside existing Task::Failed and Task::Succeeded terminal states.
Task structure and types src/tasks.rs
Added CanceledTask struct with fields for duration, timestamps, cancellation metadata, and task identifiers. Extended Task enum with Canceled variant. Implemented AsRef<u32> for the new struct. Added deserialization test case for canceled task scenarios.
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
🐰 A task once running, now complete,
Canceled with grace, a status neat!
The SDK now knows this final state,
No more deserialization fate!
✨ Bugs squashed, the enum is whole!
The title directly and concisely summarizes the main change: adding a 'canceled' status to the Task enum, which is the primary objective of this PR.
Linked Issues check
✅ Passed
The PR successfully implements all requirements from issue #768: adds the 'canceled' variant to Task enum, introduces CanceledTask structure, updates deserialization to handle canceled tasks, and includes test coverage.
Out of Scope Changes check
✅ Passed
All changes are directly related to the linked issue #768. The modifications in wait_for_task function align with supporting the new canceled status behavior.
Docstring Coverage
✅ Passed
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
📝 Generate docstrings
🧪 Generate unit tests (beta)
Create PR with unit tests
Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Related issue
Fixes #768
What does this PR do?
Adds the
canceledvariant to the Task enum.PR checklist
Notes
Sorry if the commits are a little messy, I wanted to branch off 0.32 on my side so I could use that as a dependency in my own
Cargo.toml, I merged it into main before creating this PR though.Also I wasn't sure on making
canceled_bya usize, I did it for consistency with other variants but task ids are usually u32 so I wasn't sure.Also I kept the 'wrong' spelling of cancelled with 1 'l'