Skip to content

Add task documents endpoint#698

Open
Nymuxyzo wants to merge 1 commit into
meilisearch:mainfrom
Nymuxyzo:feat/task-documents
Open

Add task documents endpoint#698
Nymuxyzo wants to merge 1 commit into
meilisearch:mainfrom
Nymuxyzo:feat/task-documents

Conversation

@Nymuxyzo
Copy link
Copy Markdown
Contributor

@Nymuxyzo Nymuxyzo commented May 30, 2026

Pull Request

Related issue

Fixes #685

What does this PR do?

  • Add task documents method
  • Set an alias for duplicated method

PR checklist

Please check if your PR fulfills the following requirements:

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Summary

This PR adds support for the GET /tasks/{task_id}/documents endpoint to retrieve task documents, as specified in Meilisearch v1.13.0. It includes the method implementation, tests, and documentation examples.

Changes

New functionality

  • Added task_documents(task_uid) method to Meilisearch::Client that retrieves the document payload associated with a task by delegating to task_endpoint.task_documents(task_uid)
  • Added task_documents(task_uid) method to Meilisearch::Task that performs a GET request to /tasks/{task_uid}/documents

Refactoring

  • Converted index_task in Meilisearch::Task from a separate method to an alias of the existing task method, eliminating duplicate code

Testing

  • Added RSpec test case in spec/meilisearch/client/tasks_spec.rb that verifies client.task_documents correctly returns documents from a task, including enabling/disabling the experimental getTaskDocumentsRoute feature flag

Documentation

  • Added code sample entry get_task_documents_1 in .code-samples.meilisearch.yaml demonstrating usage via client.task_documents(1)

Review Change Stack

Signed-off-by: Nymuxyzo <1729839+Nymuxyzo@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

📝 Walkthrough

Walkthrough

This PR adds a new task_documents(task_uid) method to retrieve document payloads associated with Meilisearch tasks, implementing the 1.13.0 API endpoint GET /tasks/{task_uid}/documents. The implementation flows from the low-level task endpoint through client delegation, with corresponding test coverage and documentation examples.

Changes

Task Documents API Integration

Layer / File(s) Summary
Task endpoint and Client delegation
lib/meilisearch/task.rb, lib/meilisearch/client.rb
Task endpoint adds task_documents(task_uid) method to GET /tasks/{task_uid}/documents; Client exposes this as a public method that delegates to the task endpoint. The index_task method is refactored to use an alias to the existing task method.
Test case and documentation example
spec/meilisearch/client/tasks_spec.rb, .code-samples.meilisearch.yaml
RSpec test verifies client.task_documents correctly returns task documents by enabling the experimental feature flag, inserting a document, and asserting the payload matches. YAML code sample demonstrates calling client.task_documents(1).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A task was waiting in the queue, documents to retrieve so true,
With /tasks and /{uid}/docs in hand, the ruby SDK takes a stand,
Now task_documents brings them near, swift payloads, crystal clear! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change—adding a task documents endpoint—which is the primary objective of this pull request.
Linked Issues check ✅ Passed All three coding requirements from issue #685 are fully met: the SDK method for GET /tasks/{task_id}/documents is implemented, test cases are added, and a YAML code sample entry is included.
Out of Scope Changes check ✅ Passed All changes are directly related to adding the task documents endpoint functionality; no unrelated or out-of-scope modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (857afce) to head (cf5bb5e).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #698   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          809       812    +3     
=========================================
+ Hits           809       812    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/meilisearch/client/tasks_spec.rb`:
- Around line 95-106: Wrap the test body that enables the experimental feature
so it always disables it in an ensure block: call
client.update_experimental_features(getTaskDocumentsRoute: true) inside a begin,
run the test actions (index.add_documents, client.task_documents, and
expectations), and then in ensure call
client.update_experimental_features(getTaskDocumentsRoute: false) to guarantee
teardown even if an exception occurs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b471e07-ddf2-4799-abff-924aa2d13584

📥 Commits

Reviewing files that changed from the base of the PR and between 857afce and cf5bb5e.

📒 Files selected for processing (4)
  • .code-samples.meilisearch.yaml
  • lib/meilisearch/client.rb
  • lib/meilisearch/task.rb
  • spec/meilisearch/client/tasks_spec.rb

Comment thread spec/meilisearch/client/tasks_spec.rb
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.

[Meilisearch v1.13.0] Add method to get tasks documents

1 participant