Skip to content

Conversation

@orbin123
Copy link
Contributor

@orbin123 orbin123 commented Dec 18, 2025

Meilisearch v1.30.0 removed the sharding flag in favor of a new Leader/Follower High Availability model. This commit updates the test suite to align with these breaking changes.

Pull Request

Related issue

Fixes #1183

What does this PR do?

This PR updates the SDK test suite to support the breaking networking changes introduced in Meilisearch v1.30.0.

Specifically, v1.30 removed the sharding boolean flag from the /network endpoint in favor of the new Leader/Follower High Availability model. The existing tests were failing because they explicitly sent sharding: true in payloads and asserted its presence in responses.

PR checklist

Please check if your PR fulfills the following requirements:

  • Tests: Removed deprecated sharding: true usage in
    test_client_network.py and test_client_sharding.py`
  • Utilities: Renamed the test utility disable_sharding to
    reset_network_config and updated its implementation to clear the remotes and leader configuration (sending remotes: {} and leader: None) instead of attempting to toggle sharding off.
  • Assertions: Removed assertions checking for the existence of the sharding key in API responses.

These changes ensure the SDK tests pass successfully when run against a Meilisearch v1.30+ instance.

Summary by CodeRabbit

  • Chores

    • Updated test utilities to use a reset-based network configuration helper for clearer teardown.
  • Tests

    • Simplified network-related tests by removing explicit sharding checks and relying on the updated reset behavior.
    • Extended wait timeout in an embedder-related test to allow longer task completion.

✏️ Tip: You can customize this high-level summary in your review settings.

Meilisearch v1.30.0 removed the sharding flag in favor of a new Leader/Follower High Availability model. This commit updates the test suite to align with these breaking changes.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

📝 Walkthrough

Walkthrough

Renamed test helper disable_shardingreset_network_config, updated it to use Meilisearch v1.30 network model (remotes, leader), replaced imports and teardown calls in tests, removed deprecated "sharding" payload and related assertions, and increased a single test wait timeout.

Changes

Cohort / File(s) Summary
Test utility definition
tests/test_utils.py
Renamed disable_shardingreset_network_config; changed body to call client.add_or_update_networks(body={"remotes": {}, "leader": None}) instead of {"sharding": False}.
Tests updating network teardown/imports
tests/client/test_client_multi_search_meilisearch.py, tests/client/test_client_sharding.py, tests/client/test_client_network.py
Replaced imports and call sites: disable_sharding(...)reset_network_config(...).
Removed deprecated sharding usage
tests/client/test_client_network.py
Removed sending "sharding": True in request payload and removed assertions checking response["sharding"].
Test timeout tweak
tests/settings/test_settings_embedders.py
Increased wait_for_task timeout to timeout_in_ms=60000 in test_huggingface_embedder_format.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Add sharding support #1164 — touches the same test network configuration helpers and sharding payload adjustments (strongly related).

Poem

🐰 I hopped through tests at break of dawn,
Renamed a helper, nudged flags gone,
Remotes cleared clean, the leader set free,
I stamped my paw — network tidy as can be,
CI hummed a tune, and I munched a carrot 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive All changes are directly aligned with the PR objectives: removing sharding flag references, renaming test utilities, and updating network config calls. The timeout change in test_settings_embedders.py appears tangentially related but may warrant clarification. Clarify whether the timeout extension in test_settings_embedders.py (timeout_in_ms=60000) is necessary for v1.30 compatibility or represents a separate issue.
✅ 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 clearly and specifically describes the main change: adapting network tests for Meilisearch v1.30 HA changes, which directly matches the PR's objective of updating tests for breaking networking changes.
Linked Issues check ✅ Passed The PR addresses the primary objective from issue #1183 by removing reliance on the deprecated sharding flag and updating network configuration handling to use the new leader/follower model semantics.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6360ba6 and 692dff2.

📒 Files selected for processing (1)
  • tests/settings/test_settings_embedders.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/settings/test_settings_embedders.py

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.

Copy link
Contributor

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/client/test_client_multi_search_meilisearch.py (1)

85-102: Critical: Remove deprecated sharding flag from request body.

The test still sends "sharding": True at line 88, which is incompatible with Meilisearch v1.30+. According to the PR objectives, v1.30 removed the sharding boolean from the /network endpoint in favor of the leader/follower HA model.

This will cause the test to fail against v1.30+ instances, defeating the purpose of this PR.

🔎 Apply this diff to remove the deprecated sharding flag:
     resp = client.add_or_update_networks(
         {
             "self": REMOTE_MS_1,
-            "sharding": True,
             "remotes": {
                 REMOTE_MS_1: {
                     "url": "http://ms-1235.example.meilisearch.io",
                     "searchApiKey": "xxxxxxxx",
                     "writeApiKey": "xxxxxxxx",
                 },
                 REMOTE_MS_2: {
                     "url": "http://ms-1255.example.meilisearch.io",
                     "searchApiKey": "xxxxxxxx",
                     "writeApiKey": "xxxxxxxx",
                 },
             },
         }
     )
tests/client/test_client_sharding.py (1)

11-21: Critical: Remove deprecated sharding flag from test options.

The test still includes "sharding": True at line 20, which is incompatible with Meilisearch v1.30+. The PR description explicitly states that sharding usage was removed from test_client_sharding.py, but this flag remains.

This will cause the test to fail against v1.30+ instances.

🔎 Apply this diff to remove the deprecated sharding flag:
     options = {
         "self": instance_name,
         "remotes": {
             instance_name: {
                 "url": BASE_URL,
                 "searchApiKey": "search-key-1",
                 "writeApiKey": "write-key-1",
             }
         },
-        "sharding": True,
     }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5c6fe3 and 83aed44.

📒 Files selected for processing (4)
  • tests/client/test_client_multi_search_meilisearch.py (2 hunks)
  • tests/client/test_client_network.py (2 hunks)
  • tests/client/test_client_sharding.py (2 hunks)
  • tests/test_utils.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
tests/client/test_client_multi_search_meilisearch.py (2)
tests/test_utils.py (1)
  • reset_network_config (37-38)
tests/conftest.py (1)
  • client (15-16)
tests/client/test_client_network.py (2)
tests/test_utils.py (1)
  • reset_network_config (37-38)
tests/conftest.py (1)
  • client (15-16)
tests/client/test_client_sharding.py (2)
tests/test_utils.py (1)
  • reset_network_config (37-38)
tests/conftest.py (1)
  • client (15-16)
🔇 Additional comments (7)
tests/test_utils.py (1)

37-38: LGTM! Clean migration to the new network configuration model.

The function rename from disable_sharding to reset_network_config is appropriate, and the body correctly resets the network configuration using the new v1.30 HA model semantics (remotes and leader fields).

tests/client/test_client_multi_search_meilisearch.py (2)

5-5: LGTM! Import correctly updated.

The import has been properly updated to use reset_network_config instead of disable_sharding.


115-115: LGTM! Cleanup correctly updated.

The teardown call has been properly updated to use reset_network_config(client).

tests/client/test_client_network.py (2)

4-4: LGTM! Import correctly updated.

The import has been properly updated to use reset_network_config instead of disable_sharding.


16-40: LGTM! Test correctly updated for v1.30 network model.

The test body no longer includes the deprecated sharding flag, and the assertions no longer check for it in the response. The teardown correctly uses reset_network_config(client).

tests/client/test_client_sharding.py (2)

4-4: LGTM! Import correctly updated.

The import has been properly updated to use reset_network_config instead of disable_sharding.


37-37: LGTM! Cleanup correctly updated.

The teardown call has been properly updated to use reset_network_config(client).

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/client/test_client_sharding.py (1)

11-21: Critical: Remove deprecated sharding field from request body.

The test still sends "sharding": True (line 20) to the API in the options dict. According to the PR objectives and Meilisearch v1.30 changes, this field is no longer supported and should be removed from the request body, not just from assertions.

🔎 Apply this diff to remove the deprecated field:
     options = {
         "self": instance_name,
         "remotes": {
             instance_name: {
                 "url": BASE_URL,
                 "searchApiKey": "search-key-1",
                 "writeApiKey": "write-key-1",
             }
         },
-        "sharding": True,
     }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83aed44 and dbcfbcc.

📒 Files selected for processing (1)
  • tests/client/test_client_sharding.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/client/test_client_sharding.py (2)
tests/test_utils.py (1)
  • reset_network_config (37-38)
tests/conftest.py (1)
  • client (15-16)
🔇 Additional comments (2)
tests/client/test_client_sharding.py (2)

4-4: LGTM: Import updated correctly.

The import statement correctly reflects the renamed utility function reset_network_config.


36-36: LGTM: Cleanup call updated correctly.

The function call correctly uses the renamed reset_network_config utility, which properly resets the network configuration using the new v1.30 semantics (remotes: {} and leader: None).

@curquiza curquiza requested a review from Strift December 29, 2025 17:28
@curquiza curquiza changed the title fix(tests): adapt network tests for Meilisearch v1.30 HA changes Fix tests: adapt network tests for Meilisearch v1.30 HA changes Dec 29, 2025
@curquiza curquiza added the maintenance Anything related to maintenance (CI, tests, refactoring...) label Dec 29, 2025
increased the timeout of test_huggingface_embedder_format to wait for 1 minute
Copy link
Contributor

@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

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e265f0e and 2dd198d.

📒 Files selected for processing (1)
  • tests/settings/test_settings_embedders.py
🧰 Additional context used
🧬 Code graph analysis (1)
tests/settings/test_settings_embedders.py (2)
meilisearch/client.py (1)
  • index (231-247)
meilisearch/index.py (1)
  • wait_for_task (261-288)

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
tests/settings/test_settings_embedders.py (1)

98-98: LGTM - past review concern addressed.

The inline comment now documents the extended timeout, addressing the previous review feedback. The 60-second timeout is appropriate for HuggingFace embedder configuration.

If you want to provide additional clarity for future maintainers, consider making the comment more specific about why HuggingFace needs extended timeout (e.g., model downloading) versus other embedder sources, but the current comment is acceptable.

Optional: More specific comment
-    index.wait_for_task(response.task_uid, timeout_in_ms=60000) # embedder config can take longer.
+    index.wait_for_task(response.task_uid, timeout_in_ms=60000)  # HuggingFace model download requires extended timeout
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2dd198d and 6360ba6.

📒 Files selected for processing (1)
  • tests/settings/test_settings_embedders.py
🧰 Additional context used
🧬 Code graph analysis (1)
tests/settings/test_settings_embedders.py (2)
meilisearch/client.py (1)
  • index (231-247)
meilisearch/index.py (1)
  • wait_for_task (261-288)

Copy link
Contributor

@Strift Strift left a comment

Choose a reason for hiding this comment

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

Hi @orbin123 and thanks for your contribution 🙌

@Strift Strift added this pull request to the merge queue Dec 30, 2025
Merged via the queue into meilisearch:main with commit 54b5e34 Dec 30, 2025
11 checks passed
@orbin123
Copy link
Contributor Author

Hi @orbin123 and thanks for your contribution 🙌

Thankyou for the opportunity! I am really glad to contribute, and if there is any other issues or areas where I can assist, please feel free to reach out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Anything related to maintenance (CI, tests, refactoring...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v1.30.0] Adopt breaking sharding / network changes introduced in Meilisearch

3 participants