Fix incorrect JSON example for mmctl user migrate-auth (email → SAML)#9061
Fix incorrect JSON example for mmctl user migrate-auth (email → SAML)#9061ewwollesen wants to merge 1 commit into
Conversation
The "user.json Example" block showed an array of objects with
auth_data/idp_id/saml_user_id keys. mmctl does not parse that format:
migrateAuthToSamlCmdF in server/cmd/mmctl/commands/user.go unmarshals the
users file into a Go map[string]string, so the only valid format is a flat
object mapping each Mattermost email to its SAML username, e.g.
{"usr1@email.com": "usr.one"}. Feeding the array form returns
"invalid json".
That correct format is already documented just above under
migration-options (saml) -> users_file, so remove the misleading block.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughA duplicated "user.json Example" section (containing a JSON array block) under the Changesmmctl user migrate-auth Docs Cleanup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Pull request overview
Removes a misleading JSON example from the mmctl user migrate-auth documentation so the page only presents the map[email]saml_username format that mmctl actually accepts for SAML migrations.
Changes:
- Deleted the incorrect
user.json Exampleblock that showed an array/object structure unsupported bymmctl user migrate-auth email saml. - Leaves the existing, correct
users_fileJSON mapping example in place.
|
Newest code from mattermost has been published to preview environment for Git SHA 07adeb2 |
|
@hanzei Would you mind taking a look at this, please? It's just a simple docs change, but I want to make sure that I (and Claude) have read the code correctly that block isn't actually needed. |
Summary
The mmctl user migrate-auth docs page contained two conflicting JSON examples for the SAML users file. This removes the inaccurate one.
The "user.json Example" block showed an array of objects with
auth_data/idp_id/saml_user_idkeys. mmctl does not understand that format. Inserver/cmd/mmctl/commands/user.go,migrateAuthToSamlCmdFreads the users file straight into a Gomap[string]string:Feeding it the array form fails with
invalid json(cannot unmarshal an array into a map). The keysauth_data/idp_id/saml_user_idappear nowhere in the migrate-auth code path.The correct format — a flat object mapping each Mattermost email to its SAML username — is already documented immediately above, under migration-options (saml) → users_file:
{ "usr1@email.com": "usr.one", "usr2@email.com": "usr.two" }So this PR simply deletes the misleading second example, leaving the accurate one in place.
Test plan
server/cmd/mmctl/commands/user.go,migrateAuthToSamlCmdF) that the users file is unmarshalled intomap[string]string.auth_data/idp_id/saml_user_idare not referenced anywhere in the mmctl migrate-auth path.gmake clean htmlbuilds successfully (exit 0). Build reports 26 warnings, all in unrelated files (Azure deploy guide, upgrade notes, autotranslation, generated agents docs, etc.) and pre-existing; zero referencemmctl-command-line-tool.rst. This change is a pure deletion and introduces no new warnings.🤖 Generated with Claude Code