-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Problem Currently, when you try and use the `pinecone login` command the login fails after confirming authentication in your browser because of a panic:  We're unsafely accessing a slice. Our decoding of the JSON responses from the `dashboard` API are failing because the shape of some responses has changed. We've had several people run into this issue: - https://pinecone-io.slack.com/archives/C06V9RSCBLG/p1723806488866219 - https://pinecone-io.slack.com/archives/C06V9RSCBLG/p1721693472202859 ## Solution I looked at the `dashboard` repo to try and figure out what changed along with directly dumping the response bodies in the CLI locally. It seems the json naming and structure of how `organizations` and `projects` are returned has changed slightly, and projects are no longer explicitly nested under organizations. Specifically, this value in the response is now `newOrgs` rather than `organizations`: https://github.com/pinecone-io/dashboard/blob/f31f9b126781adf6bf30eb5f137cc0d983ba691b/api-server/functions/src/api/dashboard/organizations/organizations.router.ts#L48 It also seems like there was a `globalProject` field being returned inside of each `project` previously, and that's no longer the case. Looks like the fields were flattened into `project`. - Get rid of `GlobalProject` type and move fields into `Project` which is what we get back from the `/organizations` functions now. - Update the json marshaling in `OrganizationResponse` to ``json:"newOrgs"`` to properly decode the response. - Add logic to re-nest `Projects` inside of `Organizations` when the `ListOrganizations` response is returned. ### Follow Up Our reliance on the `dashboard` APIs is somewhat brittle because we're not always aware when changes to the API interface happen. We need to improve this process moving forward, and work to make the CLI more robust in how it handles failures. ## Type of Change - [X] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan You should be able to pull this branch down, use `goreleaser` to build the CLI locally, and then attempt logging in: ``` goreleaser build --single-target --snapshot --clean ./dist/pinecone_darwin_arm64/pinecone login ``` Here's the testing flow from my end: Login:  Target Organization / Project:  List Indexes:  --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1207873887567497
- Loading branch information
1 parent
51bbc6b
commit 81f7555
Showing
7 changed files
with
43 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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