From 1506c7dcd6032c04c1df6f5785b6dd3dfe4511cc Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 10:56:21 +0200 Subject: krino: duplicates are found, never deleted A rule combining (duplicate) with a delete action is refused at load, and a file that is a duplicate under any duplicate scope its directory uses gets no delete step from any rule: the plan shows it skipped and the chain continues. A failed duplicate check blocks the delete too. Tests cover (matched), another rule's own condition, a test evaluation skipped, two scopes and a failed check, each checking every copy is still on disk. --- internal/plan/chain.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/plan/chain.go') diff --git a/internal/plan/chain.go b/internal/plan/chain.go index bfa2484..e504504 100644 --- a/internal/plan/chain.go +++ b/internal/plan/chain.go @@ -32,6 +32,10 @@ func NewClaims() *Claims { type Input struct { File scan.File Rules []RuleMatch + // NoDelete, when non-empty, skips every delete step of this file with + // this text as the step's Skip, without ending the chain (spec §5.5 + // rule 2, §7.1). + NoDelete string } // Build turns each file's matching rules into a chain. root is the @@ -166,6 +170,10 @@ func buildOne(root string, in Input, now time.Time, d Disk, claim claimed) Chain } case config.Delete, config.DeletePermanent: + if in.NoDelete != "" { + step.Skip = in.NoDelete + break + } deletedBy = rule.Name } -- cgit v1.3