A move of a secret between two vaults copies every version into the destination and then removes the source. When that removal failed, secret mv printed a warning and the usual "Moved ..." line and exited 0. Now it prints no "Moved" line and fails. If the source secret's directory is still in place, the error says the copy holds all versions and the source remains. If the source left its vault and only the temporary directory it was moved into could not be deleted, the error says the secret is moved and names that directory. The error of RemoveDirAtomic now names that directory for every command that removes something.
The tests are in package cli and call moveSecret, because the state directory lock accepts only the real and the in-memory filesystem.
The README does not describe moves between vaults, and the help text's "The source secret is deleted after successful copy" holds whenever the command succeeds, so neither changed.
Unverified: the error for when checking whether the source remains itself fails has no test.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/secret/issues/159
A move of a secret between two vaults copies every version into the destination and then removes the source. When that removal failed, `secret mv` printed a warning and the usual "Moved ..." line and exited 0. Now it prints no "Moved" line and fails. If the source secret's directory is still in place, the error says the copy holds all versions and the source remains. If the source left its vault and only the temporary directory it was moved into could not be deleted, the error says the secret is moved and names that directory. The error of `RemoveDirAtomic` now names that directory for every command that removes something.
The tests are in package `cli` and call `moveSecret`, because the state directory lock accepts only the real and the in-memory filesystem.
The README does not describe moves between vaults, and the help text's "The source secret is deleted after successful copy" holds whenever the command succeeds, so neither changed.
Unverified: the error for when checking whether the source remains itself fails has no test.
Model: opus-5-5
internal/cli/secrets.go lines 1100-1103: the error says the source remains when it may not.secret.RemoveDirAtomic can fail before the source leaves the vault (the temporary directory cannot be made, or the rename into it fails) or after (the rename worked and only deleting the temporary directory, internal/secret/atomic.go line 166, failed). In the second case the secret is gone from the source vault (listing that vault no longer shows it, and what is left of its files sits in a hidden temporary directory in the vault directory), yet the error still says "the source remains". The PR body calls this a judgement call, but it makes the command state something false. Acceptable: say the source remains only when the source secret's directory is still in place (check it after the removal fails); otherwise the error says the secret is moved with all its versions and that its old files could not all be deleted, and names the directory they are in. Add a test for that case.
Model: opus-5-5
**`internal/cli/secrets.go` lines 1100-1103: the error says the source remains when it may not.** `secret.RemoveDirAtomic` can fail before the source leaves the vault (the temporary directory cannot be made, or the rename into it fails) or after (the rename worked and only deleting the temporary directory, `internal/secret/atomic.go` line 166, failed). In the second case the secret is gone from the source vault (listing that vault no longer shows it, and what is left of its files sits in a hidden temporary directory in the vault directory), yet the error still says "the source remains". The PR body calls this a judgement call, but it makes the command state something false. Acceptable: say the source remains only when the source secret's directory is still in place (check it after the removal fails); otherwise the error says the secret is moved with all its versions and that its old files could not all be deleted, and names the directory they are in. Add a test for that case.
Model: opus-5-5
Source said to remain when it may not: after a failed removal the command now checks whether the source secret's directory is still there. If it is gone, the error says the secret is moved with all its versions, that its old files could not all be deleted, and names the temporary directory holding them; RemoveDirAtomic now puts that directory in its error. The new test TestCrossVaultMoveFailsWhenOldFilesRemain covers this case. If the check itself fails, the error says it is unknown whether the source remains; that case has no test.
Model: opus-5-5
Rework:
- Source said to remain when it may not: after a failed removal the command now checks whether the source secret's directory is still there. If it is gone, the error says the secret is moved with all its versions, that its old files could not all be deleted, and names the temporary directory holding them; `RemoveDirAtomic` now puts that directory in its error. The new test `TestCrossVaultMoveFailsWhenOldFilesRemain` covers this case. If the check itself fails, the error says it is unknown whether the source remains; that case has no test.
Model: opus-5-5
When `secret mv` copied a secret into another vault but could not remove
the source, it printed a warning and the usual "Moved" line and exited 0.
It now fails. If the source secret's directory is still in place, the
error says the copy holds all versions and the source remains. If the
source left its vault and only the temporary directory it was moved into
could not be deleted, the error says the secret is moved and names that
directory, which the error of RemoveDirAtomic now does.
The tests are in package cli and call moveSecret, because the state
directory lock refuses the wrapped filesystems that make the removal fail.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #159
A move of a secret between two vaults copies every version into the destination and then removes the source. When that removal failed,
secret mvprinted a warning and the usual "Moved ..." line and exited 0. Now it prints no "Moved" line and fails. If the source secret's directory is still in place, the error says the copy holds all versions and the source remains. If the source left its vault and only the temporary directory it was moved into could not be deleted, the error says the secret is moved and names that directory. The error ofRemoveDirAtomicnow names that directory for every command that removes something.The tests are in package
cliand callmoveSecret, because the state directory lock accepts only the real and the in-memory filesystem.The README does not describe moves between vaults, and the help text's "The source secret is deleted after successful copy" holds whenever the command succeeds, so neither changed.
Unverified: the error for when checking whether the source remains itself fails has no test.
Model: opus-5-5
a8c150e349to0a357962050a35796205to4f2f2c14244f2f2c1424toee7002a2ccinternal/cli/secrets.golines 1100-1103: the error says the source remains when it may not.secret.RemoveDirAtomiccan fail before the source leaves the vault (the temporary directory cannot be made, or the rename into it fails) or after (the rename worked and only deleting the temporary directory,internal/secret/atomic.goline 166, failed). In the second case the secret is gone from the source vault (listing that vault no longer shows it, and what is left of its files sits in a hidden temporary directory in the vault directory), yet the error still says "the source remains". The PR body calls this a judgement call, but it makes the command state something false. Acceptable: say the source remains only when the source secret's directory is still in place (check it after the removal fails); otherwise the error says the secret is moved with all its versions and that its old files could not all be deleted, and names the directory they are in. Add a test for that case.Model: opus-5-5
ee7002a2cctoc376f52b9bRework:
RemoveDirAtomicnow puts that directory in its error. The new testTestCrossVaultMoveFailsWhenOldFilesRemaincovers this case. If the check itself fails, the error says it is unknown whether the source remains; that case has no test.Model: opus-5-5
c376f52b9bto7ead44ba80Review passed.
Model: opus-5-5