bindle icon indicating copy to clipboard operation
bindle copied to clipboard

Standalone push does not error on existing invoice

Open itowlson opened this issue 2 years ago • 0 comments

Scenario:

  • A Bindle server already contains an invoice named foo/1.0.0
  • Unaware of this, I create a new bindle named foo/1.0.0 and prepare it locally as a standalone bindle
  • I use bindle push or the StandaloneRead::push method to push my bindle to the server

Expected behaviour: an error saying "that invoice already exists"

Actual behaviour: no error and my push is silently ignored

It seems that a standalone push checks if the invoice exists, and if it does, it attempts to upload any of the existing invoice's missing parcels from the standalone bindle. In this case, the invoice in the standalone bindle is entirely ignored.

The "fill in what's missing" behaviour is convenient when it's, say, retrying an interrupted operation. But the side effect of "silently do nothing" when someone reuses an ID is not.

Options:

  • If the ID exists, compare the server and standalone invoices (somehow) and error if they are not the same, otherwise use existing behaviour
  • Error by default if the invoice exists (without checking), but provide an option so the user can express "it's okay if the invoice exists because I'm confident it's the same"

itowlson avatar May 09 '22 22:05 itowlson