Clean up backup, restore, and collection commands#89
Open
austin-denoble wants to merge 2 commits into
Open
Conversation
…e indexes. An index is the primary resource for storing, managing, and querying your vector data. Pinecone offers two types of indexes: dense and sparse. Dense indexes are best for semantic search, and sparse indexes are best for keyword search.
…'re properly passing metric and dimension when creating an integrated index, expose description, source index ID, and dimension in PrintBackupTable
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
This PR makes two categories of changes ahead of v1: a command structure reorganization to establish permanent homes for backup, restore, and collection resources, and a set of correctness fixes found during an audit of the CLI against the 2025-10 control plane API spec.
Command restructuring
pc backup,pc backup restore, andpc collectionwere top-level commands. All three have been relocated underpc index, which better reflects their ownership relationship with the index resource. The move ships without backwards-compatibility aliases, as the existing public preview signal covers this kind of breaking change before v1.New command surface:
```
pc index backup create --index-name [--name ] [--description ]
pc index backup list [--index-name ] [--limit ] [--pagination-token ]
pc index backup describe --id
pc index backup delete --id
pc index restore --id --name [--tags k=v,...] [--deletion-protection enabled|disabled]
pc index restore list [--limit ] [--pagination-token ]
pc index restore describe --id
pc index collection create --name --source
pc index collection list
pc index collection describe --name
pc index collection delete --name
```
Restore is intentionally a peer of backup under
pc index, not nested beneath it. Restore jobs are a distinct resource — they have their own IDs and lifecycle — and placing them at the same level avoids thepc index backup restore describedepth while keeping related commands discoverable together.A new
GROUP_INDEX_MANAGEMENThelp group is registered on theindexcommand so that backup, restore, and collection appear in their own labeled section inpc index --help, alongside the existingIndex Data CommandsandIndex Namespace Commandsgroups.Files moved:
command/backup/→command/index/backup/command/backup/restore/→command/index/restore/command/collection/→command/index/collection/BackupServiceno longer includesCreateIndexFromBackup— that method now belongs exclusively toRestoreJobServicein the restore package, matching the new ownership boundary.Bug fixes and correctness improvements
pc index configure --namenot marked requiredconfigurewas the only resource command that did not callcmd.MarkFlagRequired("name"). Running it without--namewould silently pass an empty string to the API and return a confusing error. The flag is now required, consistent with every other command that takes a resource name.--metricand--dimensionsilently ignored when creating an integrated indexCreateIndexForModelEmbedexposes both aMetricandDimensionfield, but theindexTypeIntegratedbranch inrunCreateIndexCmdnever populated them. Both flags were accepted by the CLI but dropped before reaching the SDK.Dimensionis now forwarded viapointerOrNil(int(options.dimension)), producingnilwhen unset (zero value) and the user-supplied value otherwise.Metricrequires special handling: the flag defaults to"cosine", sopointerOrNilalone would always forward a non-nil value and override the embedding model's own default. The fix usescmd.Flags().Changed("metric")to only populateEmbed.Metricwhen the flag was explicitly passed.Two additions to
create_test.gocover this:Test_runCreateIndexWithService_Integrated_Argstest confirmsEmbed.MetricandEmbed.Dimensionarenilwhen neither flag is explicitly set.Test_runCreateIndexWithService_Integrated_MetricAndDimensiontest verifies both fields are correctly populated when the flags are explicitly provided.PrintBackupTablemissing fieldspc index backup describeomitted three fields present in theBackupstruct returned by the API:Description— a user can create a backup with--descriptionbut the value was not shown in describe outputSource Index ID— the source index UUID, complementing the existingSource Indexname fieldDimension— the vector dimension of the backed-up indexAll three are now rendered in the describe table.