Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign vault clone name conflict handling #672

Open
tegefaulkes opened this issue Feb 7, 2024 · 2 comments
Open

Redesign vault clone name conflict handling #672

tegefaulkes opened this issue Feb 7, 2024 · 2 comments
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management

Comments

@tegefaulkes
Copy link
Contributor

Specification

Currently this is handled very simply where we take the existing name and increment the number on it as vaultname-1 vaultname-2 etc etc. It does this until the name doesn't already exists and uses that for the name. Otherwise it hits 50 attempts and throws. The problem with this is that the hard coded limit is not ideal.

In my mind there are two alternatives. When cloning a vault and there is a name conflict it will just fail. You can specify a new name and if that conflicts it will also fail. It's pretty simple and gives the user the ability to specify the desired name.

Alternatively since the names are indexed, if the name is taken we can reverse iterate once using that name as the starting position. Then take that and append -copy to it.

Additional context

Related: #652

Tasks

  1. Determine a better alternative method for handling name conflicts when cloning.
  2. Implement this method.
@tegefaulkes tegefaulkes added the development Standard development label Feb 7, 2024
@tegefaulkes
Copy link
Contributor Author

The 2nd option still rubs me wrong. It's too easy to have weird edge cases. For example say we have the following.

  1. a vault named vault
  2. a vault named vaultOther
  3. we clone a remote vault called vault.

Can we not end up with the naming conflict resolved as vaultOther-copy?

@CMCDragonkai
Copy link
Member

If you clone a vault vault and vault already exists, then you'd get vault-copy. If there was a vault-copy then it would be vault-copy-copy. I'm looking at something similar to Windows Explorer/Dropbox when they resolved this problem, we can just copy them.

@CMCDragonkai CMCDragonkai added the r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management
Development

No branches or pull requests

2 participants