dotter icon indicating copy to clipboard operation
dotter copied to clipboard

Bugs arising from encoding one logical operation as two operations

Open SuperCuber opened this issue 5 years ago • 4 comments

Description

In --dry-run, if a template is supposed to be deleted and then created again with another target, it reports that as a cache corruption because it didn't actually delete the file.

Reproduction

Run with following file mapping:

foo = "bar"

Then run with following with --dry-run:

foo = "baz"

SuperCuber avatar Nov 07 '20 09:11 SuperCuber

Similar bugs happen for any case where a file is first deleted then created again - for example, swapping a template to a symlink during a dry run

SuperCuber avatar Nov 07 '20 09:11 SuperCuber

To solve this I'd probably need to restructure my deployment logic a bit and add a concept of "replace_template" and "replace_symlink", of course while handling all the edge cases. I might need to rewrite FileState again for this too - it can be backed by a map

SuperCuber avatar Nov 14 '20 12:11 SuperCuber

False negative case:

Going from empty to foo = "bar"; baz = "bar" should produce an "already exists" error but doesn't because file doesn't actually exist so it happily "creates" both

SuperCuber avatar Dec 14 '20 16:12 SuperCuber

The cases described previously are now fixed, but there's a new case:

Start with template a -> b deployed, modify b's contents, swap a -> b to symlink. Now the deletion of the template is correctly skipped, but in a perfect world the creation of the symlink should not even be attempted.

The same will happen with a target location change

SuperCuber avatar Feb 03 '21 16:02 SuperCuber