fix(keygen): call /auth/cli/ssh-key instead of /users/me (2.4.5)#19
Merged
fix(keygen): call /auth/cli/ssh-key instead of /users/me (2.4.5)#19
Conversation
`cf keygen` was trying to auto-register the generated SSH public key via `PUT /users/me`, but that route is only wired on the internal backend. Hitting api.chipfoundry.io produced an `HTTP 404: Not Found` that looked like a CLI bug and leaked through `_api_put`'s error printer before the friendly "To register this key" fallback, confusing users. Switch `_try_register_ssh_key` to the new CLI-native endpoint `PUT /api/v1/auth/cli/ssh-key` on the public API (see backend PR), and swallow transport errors silently so the manual-registration instructions are the only thing the user sees when auto-registration is unavailable (e.g. not logged in, older backend, offline). Made-with: Cursor
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
cf keygenattempted to auto-register the generated SSH public key viaPUT /users/me, but that route isn't mounted on the public API atapi.chipfoundry.io. Users saw an uglyHTTP 404: Not Foundprinted right above the friendly "To register this key" fallback._try_register_ssh_keyto call the new CLI-native endpointPUT /api/v1/auth/cli/ssh-keyon the public API (added in chipfoundry/chipignite-backend-services PR).✗ API request failedline preceding the fallback.pyproject.tomlto2.4.5.Test plan
cf keygenon a machine where the user is not logged in: prints the existing key and the manual-registration fallback, no API error line.cf keygen --overwriteon a machine where the user is logged in and the backend is deployed: prints "✓ Key registered on your ChipFoundry profile. SFTP access is ready."cf keygen --overwritewith a stubbed offline backend: falls back cleanly to the manual instructions without a stack trace.cf push,cf whoami,cf initall still work (error handling unchanged for every other call site of_api_put).Made with Cursor