package web import ( "strings" "testing" "gitea.dooplex.hu/admin/felhom-controller/internal/stacks" ) // `09` §3 decision 36 — the file browser's kept-data view is READ-ONLY: every bind ends in :ro, and // two items never collide on one name. // COMPANION RED-PROOF: drop the ":ro" suffix in keptBindLines → fails. func TestKept_FileBrowserBindsAreReadOnly(t *testing.T) { items := []stacks.KeptItem{ {Path: "/mnt/felhom-drives/hdd_1/kept/nextcloud/2026-09-25_130000", Drive: "/mnt/felhom-drives/hdd_1", Kind: stacks.KeptKindDated}, {Path: "/mnt/felhom-drives/hdd_1/kept/nextcloud/2026-09-26_090000", Drive: "/mnt/felhom-drives/hdd_1", Kind: stacks.KeptKindDated}, {Path: "/mnt/felhom-drives/hdd_1/appdata/nextcloud", Drive: "/mnt/felhom-drives/hdd_1", Kind: stacks.KeptKindLeftover}, } lines := keptBindLines(items) seen := map[string]bool{} for i, l := range lines { if !strings.HasSuffix(l, ":ro") || !strings.HasPrefix(l, " - "+items[i].Path+":/srv/megorzott/") { t.Fatalf("bind %q is not a read-only bind of %s under /srv/megorzott", l, items[i].Path) } target := strings.Split(l, ":")[1] if seen[target] { t.Fatalf("two kept items share %s", target) } seen[target] = true } }