Repository navigation
fix(codearts): serve console credential import from the codec - #461
Merged
caigee-cmd merged 1 commit intoNov 2, 2026
Merged
Conversation
control.Accounts.Import resolves the importer through Adapter.Credential.(providers.CredentialImporter), but the CodeArts adapter put Format and PrepareImport on the ImportExport slot instead. Every console import of a codearts-oauth-v1 credential therefore answered unsupported_format: no importer matched the format and ImportAll fell through to its final error. Move the two methods onto credentialCodec, matching kimi and qwenwork, and pin the wiring in the adapter contract test so the slot cannot drift again. Verified against a real endpoint: the same POST /api/accounts/import body answers 400 unsupported_format on the published v0.7.26 image and 201 with a created account on this branch.
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.
Summary
control.Accounts.ImportAllresolves a credential importer withadapter.Credential.(providers.CredentialImporter), but the CodeArts adapter declaredFormatandPrepareImportonimporter{}— the value inAdapter.ImportExport. The type assertion never matched, no provider claimed the format, and the loop returned its finalunsupported_format.codearts-oauth-v1credential answers400 unsupported_format, and no account is created. Browser OAuth login is unaffected, which is why this stayed hidden.kimi/import.go:12, andqwenworkasserts the same in its own test), so this PR moves them ontocredentialCodecand leavesImportExportholdingValidateImport+Exportonly.Reproduced against the published image, same request body, only the server differs:
Test plan
go test ./internal/providers/... ./internal/control/... ./internal/console/... ./internal/app/... ./internal/gateway/...— greengo vet ./...— greengit diff --check— cleanpython scripts/release-notes.py validate— green; addedchangelog/unreleased/codearts-credential-import.mdnpm run sync/ worker test neededTestS04InterfaceContractnow asserts theAdapter.Credentialslot itself implementsproviders.CredentialImporter, andTestCredentialCodecServesConsoleImportdrivesFormat+PrepareImporton an encoded credential — the two halves the console consumesNote for local runners: on my Windows box a clean
fb2eb35checkout already failsTestLoadLocalCredentialMissing,TestRuntimeSpecSelectsCNCLIAndConfigDir,TestStarterEnvSetsRegionAndProxy,TestRepeatedFailuresBackOff,TestBackoffResetsOnKindChange, and theinternal/storebackup/tempdir cases (backup mode = 666, want 600, locked-file cleanup). Verified by running the same packages in a worktree atfb2eb35. CI does not reproduce them, so it is local-environment noise, not this PR.Scope
Only the import wiring changes. The
ImportExportdescriptor capability, the export path'sErrUnsupportedanswer,PrepareImport's validation, and the OAuth login flow are untouched. Thechangelog/unreleased/codearts-provider.mdfragment from the original provider PR has already shipped in v0.7.26, so this uses a new filename.