Files
supervisor/tests/store
a3e1752815 Offer reset for corrupt store repositories on load (#6958)
* Offer reset for corrupt store repositories on load

When a saved git store repository loads but fails validation (for
example because the local clone lost its repository configuration file),
the only suggestion offered was to remove the repository. Removal is
refused when an installed add-on still uses that repository, leaving the
user with no way to recover a corrupt local copy.

Offer a reset alongside removal so the repository can re-clone and
self-heal. The reset fixup runs automatically, matching how the pull
path already handles corruption. This branch is only reached for
repositories that validated before, so a now-invalid copy is most likely
local corruption that re-cloning fixes.

* Re-validate repository after reset

A reset only recovers a corrupt local copy of a repository. If the
freshly cloned repository still doesn't validate, the problem is
upstream (for example the repository configuration was removed). In that
case the reset fixup would previously consider the reset successful and
dismiss the issue, hiding a persistent problem and re-cloning on every
run.

Re-validate the repository after a reset and raise when it is still
invalid, so the issue stays surfaced to the user instead of being
silently dismissed.

* Report invalid repository after reset as a known error

When a manual repository reset re-clones successfully but the repository
still fails validation, the failure mode is known: it isn't a valid
add-on repository. Raising StoreRepositoryUnknownError reported this as
an unknown error (HTTP 500), which is misleading for users triggering a
reset through the API.

Raise StoreInvalidAppRepo instead, which carries a clear message and
maps to a 400. It is still a StoreError, so the reset fixup keeps the
issue surfaced as before.

* Stop auto-retrying reset when repository stays invalid

When a reset re-clones a repository successfully but it still fails
validation, the problem is upstream and retrying won't help. The reset
fixup runs automatically on every hourly resolution healthcheck as long
as a reset suggestion exists, which would re-clone such a repository
every hour with no chance of recovery.

Drop the reset suggestion in that case so the auto-retry stops, while
leaving the issue and its remove suggestion in place so the user stays
informed and can still act.

* Update supervisor/store/repository.py

* Adapt reset-suggestion dismissal to Suggestion-typed process_fixup

Main changed process_fixup to receive the applied Suggestion object
instead of a reference string (#6916). The branch predates that change
and still used the removed reference name, which the rebase merged
cleanly but left as an undefined variable.

Since the caller passes the exact suggestion being applied, dismiss it
directly instead of scanning all_suggestions for a matching reference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Stefan Agner <stefan@agner.ch>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 15:16:05 +02:00
..