Skip to content

Add 'canceled' status to task::Task#769

Open
SneedSeedFeed wants to merge 3 commits into
meilisearch:mainfrom
SneedSeedFeed:cancel-task-fix-updated-to-main
Open

Add 'canceled' status to task::Task#769
SneedSeedFeed wants to merge 3 commits into
meilisearch:mainfrom
SneedSeedFeed:cancel-task-fix-updated-to-main

Conversation

@SneedSeedFeed
Copy link
Copy Markdown

@SneedSeedFeed SneedSeedFeed commented Feb 11, 2026

Pull Request

Related issue

Fixes #768

What does this PR do?

Adds the canceled variant to the Task enum.

PR checklist

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? No AI was used
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? 'canceled' variant missing from Task enum #768
  • 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'

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

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!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

'canceled' variant missing from Task enum

1 participant