From b774a0b4f9520ec7294986909e104b3a381ffb2d Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 5 Oct 2026 00:36:08 +0200 Subject: [PATCH] An undeclared file is deleted only when it holds what the host wrote; otherwise moved aside (hq issue 241) --- internal/apply/apply.go | 36 +++++++++++++++++++ internal/apply/remove_file_test.go | 57 ++++++++++++++++++++++++++++++ internal/apply/whole.go | 14 ++++---- 3 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 internal/apply/remove_file_test.go diff --git a/internal/apply/apply.go b/internal/apply/apply.go index cb8c37f..ca0c3da 100644 --- a/internal/apply/apply.go +++ b/internal/apply/apply.go @@ -2897,3 +2897,39 @@ func managerAway(ctx context.Context, sys system.System, scope, user string, run } return "", nil } + +// removeFile undoes a file the host wrote whole, and destroys nothing it did not make (novox/hq +// issue 241). +// +// **Deleted only when it holds exactly what this host last wrote** — then nothing is lost, because +// the mesh can write it again. Anything else is moved aside to `.removed-