Repository navigation
fix(auth): keep auth.json entries with non-string metadata and never drop them on write - #2830
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MiMo Desktop's one-click platform link writes
metadata.platform_linked: true(a boolean). The CLI'sAuth.Apischema declaresmetadataasRecord<string, string>, so:Auth.all()silently dropped thosexiaomi/xiaomi-token-plan-*credentials, and requests went out with no valid key (401 Invalid API Key).Auth.set/Auth.removerewrote the file from the decoded view. Re-linking one provider in the CLI therefore erased the other Desktop-linked entry, leaving onlyxiaomi-token-plan-cn.Fix:
apientry's metadata before decoding. The publicAuth.Infotype is unchanged.set/removenow change the raw JSON, so entries and fields the CLI does not understand are kept.Spec: docs/compose/spec/auth-metadata-tolerant.md
Verification: 2 regression tests in test/auth (both failed on base); test/provider + test/cli 1048 pass; typecheck pass. Manual check with a Desktop-shaped auth.json and
providers list: base shows 0 credentials, this branch shows 2.