internal/pkg: destroy unreachable status entries
All checks were successful
Test / Create distribution (push) Successful in 1m28s
Test / Sandbox (push) Successful in 2m39s
Test / ShareFS (push) Successful in 3m39s
Test / Hakurei (push) Successful in 3m52s
Test / Sandbox (race detector) (push) Successful in 8m30s
Test / Hakurei (race detector) (push) Successful in 11m35s
Test / Flake checks (push) Successful in 8m54s

These must be destroyed alongside their corresponding identifier or substitute entries to avoid inconsistent state.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-06-02 15:50:30 +09:00
parent 74c18390b4
commit 6c2f7089b6
2 changed files with 30 additions and 15 deletions

View File

@@ -80,6 +80,13 @@ func (c *Cache) Clean(dry, inputs bool, keep ...Artifact) (
destroyedIdents := make([]unique.Handle[ID], 0, len(idents))
for _, pair := range idents {
if !dry {
if err = os.Remove(c.base.Append(
dirStatus,
pair.name,
).String()); err != nil && !errors.Is(err, os.ErrNotExist) {
return destroyedIdents, nil, err
}
if err = os.Remove(c.base.Append(
dirIdentifier,
pair.name,
@@ -125,6 +132,13 @@ func (c *Cache) Clean(dry, inputs bool, keep ...Artifact) (
c.msg.Verbosef("destroying substitute %s...", name)
if !dry {
if err = os.Remove(c.base.Append(
dirStatus,
name,
).String()); err != nil && !errors.Is(err, os.ErrNotExist) {
return destroyedIdents, nil, err
}
if err = os.Remove(c.base.Append(
dirSubstitute,
name,