Skip to content

fix: add missing Action enum variants#752

Open
VedantMadane wants to merge 2 commits into
meilisearch:mainfrom
VedantMadane:fix-action-enum-746
Open

fix: add missing Action enum variants#752
VedantMadane wants to merge 2 commits into
meilisearch:mainfrom
VedantMadane:fix-action-enum-746

Conversation

@VedantMadane

@VedantMadane VedantMadane commented Jan 15, 2026

Copy link
Copy Markdown

Summary

This PR adds all missing Action enum variants that exist in Meilisearch server (v1.22.2+), fixing the issue where the SDK fails to deserialize keys that use newer actions like *.get.

Problem

As reported in #746, the SDK fails when reading keys because many Action enum values are missing, especially:

  • *.get\ (AllGet) - used by the Default Read-Only Admin API Key
  • Various wildcard actions (\documents., \indexes., etc.)
  • Many new actions added in recent Meilisearch versions

This caused errors like:
\
unknown variant *.get, expected one of *, \search, ...
\\

Changes

New Actions Added

Action Serde Name Description
AllGet *.get\ Read-only access to all get endpoints
DocumentsAll \documents.*\ All document operations
IndexesAll \indexes.*\ All index operations
IndexesSwap \indexes.swap\ Swap indexes
IndexesCompact \indexes.compact\ Compact index
TasksAll \ asks.*\ All task operations
TasksCancel \ asks.cancel\ Cancel tasks
TasksDelete \ asks.delete\ Delete tasks
SettingsAll \settings.*\ All settings operations
StatsAll \stats.*\ All stats operations
MetricsAll \metrics.*\ All metrics operations
MetricsGet \metrics.get\ Get metrics
DumpsAll \dumps.*\ All dump operations
SnapshotsAll \snapshots.*\ All snapshot operations
SnapshotsCreate \snapshots.create\ Create snapshot
ExperimentalFeaturesGet \experimental.get\ Get experimental features
ExperimentalFeaturesUpdate \experimental.update\ Update experimental features
Export \export\ Export data
NetworkGet \
etwork.get\ Get network config
NetworkUpdate \
etwork.update\ Update network config
ChatsAll \chats.*\ All chat operations
ChatsGet \chats.get\ Get chats
ChatsDelete \chats.delete\ Delete chats
ChatsSettingsAll \chatsSettings.*\ All chat settings
ChatsSettingsGet \chatsSettings.get\ Get chat settings
ChatsSettingsUpdate \chatsSettings.update\ Update chat settings
WebhooksAll \webhooks.*\ All webhook operations
WebhooksGet \webhooks.get\ Get webhooks
WebhooksCreate \webhooks.create\ Create webhook
WebhooksUpdate \webhooks.update\ Update webhook
WebhooksDelete \webhooks.delete\ Delete webhook
FieldsPost \ ields.post\ Fields post endpoint

Breaking Changes

The following variants were renamed to match the Meilisearch server naming convention:

Old Name New Name Serde Name
KeyGet KeysGet \keys.get\
KeyCreate KeysCreate \keys.create\
KeyUpdate KeysUpdate \keys.update\
KeyDelete KeysDelete \keys.delete\

Removed

  • \DumpsGet\ - This action does not exist in the Meilisearch server

Fixes

Fixes #746

Summary by CodeRabbit

  • New Features

    • Added comprehensive management controls for chats, webhooks, export, network, and experimental features
    • Expanded granular permission options across documents, indexes (swap/compact), tasks (get/cancel/delete), settings, metrics, stats, dumps and snapshots, fields, and metrics endpoints
  • Breaking Changes

    • Renamed key-related permissions to a consistent plural form
    • Removed legacy dump/get permission in favor of consolidated dump/snapshot permissions

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

@coderabbitai

coderabbitai Bot commented Jan 15, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The Action enum in src/key.rs was expanded with numerous new variants for finer-grained API permission scopes, several key-related variants were renamed (Key*Keys*), and the DumpsGet variant was removed. Serde renames/comments were updated accordingly.

Changes

Cohort / File(s) Summary
Action enum & public API
src/key.rs
Added many new Action variants (e.g., AllGet, DocumentsAll, IndexesAll, IndexesSwap, IndexesCompact, TasksAll, TasksGet, TasksCancel, TasksDelete, SettingsAll, StatsAll, MetricsAll, MetricsGet, DumpsAll, SnapshotsAll, SnapshotsCreate, ExperimentalFeaturesGet, ExperimentalFeaturesUpdate, Export, NetworkGet, NetworkUpdate, ChatsAll, ChatsGet, ChatsDelete, ChatsSettingsAll, ChatsSettingsGet, ChatsSettingsUpdate, WebhooksAll, WebhooksGet, WebhooksCreate, WebhooksUpdate, WebhooksDelete, FieldsPost) with serde renames and docs. Renamed KeyGetKeysGet, KeyCreateKeysCreate, KeyUpdateKeysUpdate, KeyDeleteKeysDelete. Removed DumpsGet. Public documentation/comments updated.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through enums, adding more light,
Keys, chats, webhooks — a fluttering sight.
New variants sprout, old names made new,
I nibbled the bugs and tidied the view.
Hop on, reviewer — the rabbit made room! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding missing Action enum variants to fix deserialization issues reported in issue #746.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #746: adds missing Action enum variants (AllGet and others), enables SDK to deserialize keys from Meilisearch v1.22.2+, and fixes the parse error when reading default keys.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue: the Action enum expansion, variant renames for naming consistency (KeyGet→KeysGet), and removal of the invalid FieldsPost variant are all necessary to resolve the deserialization failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
src/key.rs (1)

746-765: Breaking change fully applied; confirm changelog documentation.

The migration from KeyGet/KeyCreate/KeyUpdate/KeyDelete to KeysGet/KeysCreate/KeysUpdate/KeysDelete is complete—no old variant names remain in the codebase. The doc comments properly note the previous names, which aids discoverability.

However, no CHANGELOG.md file exists in the repository, and the README.md does not reference this breaking change. Consider documenting this migration in a changelog or release notes to help users understand why their code breaks when upgrading.


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44951e5 and 2501475.

📒 Files selected for processing (1)
  • src/key.rs
🔇 Additional comments (7)
src/key.rs (7)

659-667: LGTM! New read-only and document wildcard actions.

The AllGet variant correctly maps to "*.get" for the Default Read-Only Admin API Key, and DocumentsAll provides wildcard access for all document endpoints. These additions fix the deserialization issue in #746.


677-709: LGTM! Index and task action variants.

The new IndexesAll, IndexesSwap, IndexesCompact, TasksAll, TasksCancel, and TasksDelete variants align with Meilisearch v1.22.2+ API actions. The serde rename attributes match the expected server action strings.


710-742: LGTM! Settings, stats, metrics, dumps, and snapshots wildcards.

The wildcard variants (SettingsAll, StatsAll, MetricsAll, DumpsAll, SnapshotsAll) and specific endpoints (MetricsGet, SnapshotsCreate) properly extend the permission model. Note that DumpsGet was correctly removed as it doesn't exist on the server.


766-780: LGTM! Experimental features, export, and network actions.

The ExperimentalFeaturesGet, ExperimentalFeaturesUpdate, Export, NetworkGet, and NetworkUpdate variants correctly map to their respective server actions.


784-816: LGTM! Chats and webhooks actions match server API.

The chat-related variants (ChatsAll, ChatsGet, ChatsDelete, ChatsSettingsAll, ChatsSettingsGet, ChatsSettingsUpdate) and webhook variants (WebhooksAll, WebhooksGet, WebhooksCreate, WebhooksUpdate, WebhooksDelete) are correctly implemented per the past review's verification against v1.22.2 documentation.

Note: The FieldsPost variant that was flagged in the past review has been correctly removed—it no longer appears in the code.


817-821: Good forward compatibility with Unknown variant.

The #[serde(untagged)] catch-all Unknown(String) variant ensures that future server actions won't cause deserialization failures. This is a resilient pattern for evolving APIs.


654-821: AI summary inconsistency: FieldsPost is not in the code.

The AI-generated summary lists FieldsPost as an added variant, but it does not appear in the current code. Per the commit messages, FieldsPost was added and then removed in a subsequent commit as invalid. The summary appears to reflect an intermediate state rather than the final code.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/key.rs`:
- Around line 784-819: Remove the invalid FieldsPost enum variant from the
permission enum in src/key.rs: delete the variant definition (#[serde(rename =
"fields.post")] FieldsPost) and any associated doc comment, leaving the
surrounding chat/webhook variants unchanged; then search the codebase for any
references to FieldsPost (e.g., pattern matches, tests, serialization
expectations) and remove or update them to use the correct existing
permission(s); run cargo build/tests to ensure no remaining references.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a4fbb3 and 44951e5.

📒 Files selected for processing (1)
  • src/key.rs
🔇 Additional comments (6)
src/key.rs (6)

659-667: LGTM! Critical fix for issue #746.

The AllGet variant with "*.get" rename directly addresses the deserialization failure when reading keys with the "Default Read-Only Admin API Key". The DocumentsAll wildcard variant properly complements the existing granular document actions.


677-697: LGTM!

The IndexesAll, IndexesSwap, and IndexesCompact variants properly extend the indexes action coverage with correct serde renames.


698-742: LGTM!

The task, settings, stats, metrics, dumps, and snapshots variants follow a consistent naming pattern with correct serde renames. The wildcard variants (*All with "resource.*") and specific action variants complement the existing granular actions.


766-780: LGTM!

The experimental features, export, and network configuration actions properly cover newer Meilisearch API endpoints with correct serde renames.


820-824: LGTM! Forward compatibility preserved.

The Unknown(String) variant with #[serde(untagged)] is correctly positioned as the last variant. This ensures serde will fall through to it for any action strings not yet supported by the SDK, preventing deserialization failures for future Meilisearch versions.


747-765: Breaking change is well-documented in code; no external changelog found.

The Key*Keys* renames are complete and clean—no references to the old variant names remain in the codebase. The doc comments noting "This was previously named KeyGet in older SDK versions" provide clear migration guidance for users encountering compile errors.

However, there is no CHANGELOG file in the repository to verify external documentation of this breaking change. The in-code migration notes are sufficient for developers using the SDK, though users upgrading from earlier versions will rely on the doc comments and release notes generated from .github/release-draft-template.yml to understand the impact.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread src/key.rs Outdated
This PR adds all missing Action enum variants that exist in Meilisearch v1.22.2:

- AllGet (*.get) - used by Default Read-Only Admin API Key
- DocumentsAll (documents.*)
- IndexesAll (indexes.*)
- IndexesSwap (indexes.swap)
- IndexesCompact (indexes.compact)
- TasksAll (tasks.*)
- TasksCancel (tasks.cancel)
- TasksDelete (tasks.delete)
- SettingsAll (settings.*)
- StatsAll (stats.*)
- MetricsAll (metrics.*)
- MetricsGet (metrics.get)
- DumpsAll (dumps.*)
- SnapshotsAll (snapshots.*)
- SnapshotsCreate (snapshots.create)
- ExperimentalFeaturesGet (experimental.get)
- ExperimentalFeaturesUpdate (experimental.update)
- Export (export)
- NetworkGet (network.get)
- NetworkUpdate (network.update)
- ChatsAll (chats.*)
- ChatsGet (chats.get)
- ChatsDelete (chats.delete)
- ChatsSettingsAll (chatsSettings.*)
- ChatsSettingsGet (chatsSettings.get)
- ChatsSettingsUpdate (chatsSettings.update)
- WebhooksAll (webhooks.*)
- WebhooksGet (webhooks.get)
- WebhooksCreate (webhooks.create)
- WebhooksUpdate (webhooks.update)
- WebhooksDelete (webhooks.delete)
- FieldsPost (fields.post)

Breaking changes:
- Renamed KeyGet -> KeysGet
- Renamed KeyCreate -> KeysCreate
- Renamed KeyUpdate -> KeysUpdate
- Renamed KeyDelete -> KeysDelete
- Removed DumpsGet (does not exist in Meilisearch)

Fixes meilisearch#746
The fields.post action does not exist in Meilisearch server. This variant was incorrectly added and would cause issues if used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant