Don't error maintenance commands on missing library clone folder #125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The maintenance commands
libraries-repository-engine modify
andlibraries-repository-engine remove
are designed in a conservative manner where the operation is to be immediately halted and all affected data restored if any unexpected conditions are encountered.Previously, the absence of a library's "Git clone folder" targeted for deletion was considered such an unexpected condition.
Investigation of some failures during the course of maintenance operations revealed that this folder may be absent under certain expected conditions.
The reason is that the "sync" operation deletes the folder after a failed
git fetch
operation before trying agit clone
of a fresh copy of the repository. If that retry fails, the result is that there is no longer a "Git clone folder" for that library on Arduino's server.libraries-repository-engine/internal/command/sync/sync.go
Lines 167 to 179 in 4fd9cf7
So the absence of this folder should not be treated as cause for the maintenance command to fail. Instead, the command should warn the user (i.e., the library registry backend maintainer) of the situation and then carry on with the operation.