v0.172.0 fixup 2: drop import/* from the carry-list
Found on the demo-hp live leg: with import, import/paperless and import/calibre in the carry-list, the derived skeleton RE-CREATES a per-drive drop-zone on every drive forever — the dead lookalike the canonical root exists to remove, and one that is never backed up (class: excluded). Not a zero-removals violation: nothing deletes what an existing box has. Both demo boxes' old drop-zones were verified to hold zero files before the change.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -132,3 +133,31 @@ func TestEnsureUserdataSkeletonCreatesOnly(t *testing.T) {
|
||||
t.Errorf("a pre-existing customer dir was removed — zero-removals violated: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// R-75: a DATA drive must never get a per-drive drop-zone from the skeleton. Carrying the old
|
||||
// `import/*` entries would have the skeleton re-create a dead lookalike on every drive forever —
|
||||
// one that is also never backed up, since import paths are class: excluded.
|
||||
//
|
||||
// This is NOT a zero-removals violation: nothing deletes the dirs a box already has (see
|
||||
// TestEnsureUserdataSkeletonCreatesOnly). They stop being maintained and stop appearing on fresh boxes.
|
||||
func TestSkeletonNeverCreatesAPerDriveDropZone(t *testing.T) {
|
||||
// The catalog no longer implies any ${USERDATA_PATH}/import path — the binds moved to
|
||||
// ${IMPORT_PATH} — so the only way one could appear is via the carry-list.
|
||||
for _, derived := range [][]string{nil, {"media/podcasts", "roms"}} {
|
||||
for _, d := range BuildUserdataSkeleton(derived) {
|
||||
if d == "import" || strings.HasPrefix(d, "import/") {
|
||||
t.Errorf("derived=%v: skeleton created a per-drive drop-zone %q — the canonical root is on the SYSTEM drive", derived, d)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, c := range UserdataSkeletonCarry() {
|
||||
if c == "import" || strings.HasPrefix(c, "import/") {
|
||||
t.Errorf("the carry-list still holds %q", c)
|
||||
}
|
||||
}
|
||||
// A catalog app that genuinely declares a ${USERDATA_PATH}/import/... bind would still be
|
||||
// honoured — the rule is "don't carry them", not "filter them out".
|
||||
if !slices.Contains(BuildUserdataSkeleton([]string{"import/valami"}), "import/valami") {
|
||||
t.Error("a genuinely derived userdata import path must still be created")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user