Skip to content

Clean up backup, restore, and collection commands#89

Open
austin-denoble wants to merge 2 commits into
mainfrom
adenoble/backups-cleanup
Open

Clean up backup, restore, and collection commands#89
austin-denoble wants to merge 2 commits into
mainfrom
adenoble/backups-cleanup

Conversation

@austin-denoble
Copy link
Copy Markdown
Collaborator

@austin-denoble austin-denoble commented May 26, 2026

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, and pc collection were top-level commands. All three have been relocated under pc 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 the pc index backup restore describe depth while keeping related commands discoverable together.

A new GROUP_INDEX_MANAGEMENT help group is registered on the index command so that backup, restore, and collection appear in their own labeled section in pc index --help, alongside the existing Index Data Commands and Index Namespace Commands groups.

Files moved:

  • command/backup/command/index/backup/
  • command/backup/restore/command/index/restore/
  • command/collection/command/index/collection/

BackupService no longer includes CreateIndexFromBackup — that method now belongs exclusively to RestoreJobService in the restore package, matching the new ownership boundary.


Bug fixes and correctness improvements

pc index configure --name not marked required

configure was the only resource command that did not call cmd.MarkFlagRequired("name"). Running it without --name would 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.

--metric and --dimension silently ignored when creating an integrated index

CreateIndexForModelEmbed exposes both a Metric and Dimension field, but the indexTypeIntegrated branch in runCreateIndexCmd never populated them. Both flags were accepted by the CLI but dropped before reaching the SDK.

  • Dimension is now forwarded via pointerOrNil(int(options.dimension)), producing nil when unset (zero value) and the user-supplied value otherwise.
  • Metric requires special handling: the flag defaults to "cosine", so pointerOrNil alone would always forward a non-nil value and override the embedding model's own default. The fix uses cmd.Flags().Changed("metric") to only populate Embed.Metric when the flag was explicitly passed.

Two additions to create_test.go cover this:

  • An assertion added to the existing Test_runCreateIndexWithService_Integrated_Args test confirms Embed.Metric and Embed.Dimension are nil when neither flag is explicitly set.
  • A new Test_runCreateIndexWithService_Integrated_MetricAndDimension test verifies both fields are correctly populated when the flags are explicitly provided.

PrintBackupTable missing fields

pc index backup describe omitted three fields present in the Backup struct returned by the API:

  • Description — a user can create a backup with --description but the value was not shown in describe output
  • Source Index ID — the source index UUID, complementing the existing Source Index name field
  • Dimension — the vector dimension of the backed-up index

All three are now rendered in the describe table.

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant