From d752f159b914fd7f5ef0278afda97f5d91205931 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Mon, 13 Jul 2026 21:40:37 +0200 Subject: [PATCH] v0.128.1: suppress the class hint on USB drives (ruling F5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only Observe-sourced drives ever carried class, so legacy PVE dir:-backed USB drives showed 'lassú' while registry-sourced ones never did. The card already carries the USB type tag. Hub-report ClassHint UNCHANGED (UI-only). Pinned by TestStorageTemplate_USBClassBadgeSuppressed (red-proof run). --- CHANGELOG.md | 14 ++++++++ .../internal/web/storage_classtag_test.go | 36 +++++++++++++++++++ .../internal/web/templates/storage.html | 4 +++ 3 files changed, 54 insertions(+) create mode 100644 controller/internal/web/storage_classtag_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 932cf52..16ce4d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ ## Changelog +### v0.128.1 — USB drives never show the rotational class hint (2026-07-13, ruling F5) + +`storage.html` `classTag(d)`: `if(d.type==='usb') return '';` ahead of the class branches — +covers both render sites (card badges + metarow, the latter already guards on `d.class`). +Rationale: only Observe-sourced drives ever carried `class`, so the demo's legacy PVE +`dir:`-backed USB drives showed "lassú" while registry-sourced drives never did — a misleading +inconsistency, and the card already carries the USB type tag. Non-USB storages (e.g. a future +internal SATA data drive) keep the hint. **The hub-report `ClassHint` field is UNCHANGED** +(documented hint; UI-only suppression). Pinned by `TestStorageTemplate_USBClassBadgeSuppressed` +(red-proof: guard removed → FAIL "classTag USB guard missing"). Part 1 of the demo +storage-hygiene task (Part 2 = host-side `pvesm remove` of the two legacy dir storages — +operational, no repo change). Task was numbered v0.127.3 pre-sequencing; ships as v0.128.1 +(0.127.3 + 0.128.0 already taken). + ### v0.128.0 — browser .fab upload on the import page: chunked, tunnel-proof (2026-07-13) The Restore/import flow no longer requires copying `.fab` files to `{tároló}/exports/` by hand diff --git a/controller/internal/web/storage_classtag_test.go b/controller/internal/web/storage_classtag_test.go new file mode 100644 index 0000000..2f65a3f --- /dev/null +++ b/controller/internal/web/storage_classtag_test.go @@ -0,0 +1,36 @@ +package web + +import ( + "bytes" + "strings" + "testing" +) + +// F5 (2026-07-13): USB drives never show the rotational class hint — the card already carries +// the USB tag, and only Observe-sourced drives ever had class set, so USB cards flapped between +// "lassú" and nothing depending on the data source. The guard is client-side (classTag runs on +// /api/disks JSON), so the pin asserts the rendered page ships the guard FIRST in classTag. +// Companion red-proof: remove the `d.type==='usb'` guard line → FAIL. +func TestStorageTemplate_USBClassBadgeSuppressed(t *testing.T) { + s := testServer(t) + s.loadTemplates() + var buf bytes.Buffer + if err := s.tmpl.ExecuteTemplate(&buf, "storage", map[string]interface{}{ + "Page": "storage", "Title": "Tárolók", + }); err != nil { + t.Fatalf("render storage: %v", err) + } + html := buf.String() + + guard := strings.Index(html, `if(d.type==='usb') return '';`) + slow := strings.Index(html, `tag-off">lassú`) + if guard < 0 { + t.Fatal("classTag USB guard missing from the storage page") + } + if slow < 0 { + t.Fatal("classTag slow-branch missing — the guard has nothing to suppress (test needs updating)") + } + if guard > slow { + t.Fatalf("USB guard (at %d) must run BEFORE the class branches (at %d)", guard, slow) + } +} diff --git a/controller/internal/web/templates/storage.html b/controller/internal/web/templates/storage.html index 2eb45b9..51bca32 100644 --- a/controller/internal/web/templates/storage.html +++ b/controller/internal/web/templates/storage.html @@ -250,6 +250,10 @@ window.__registeredPaths=[{{range .StoragePaths}}{{if .Path}}"{{.Path}}",{{end}} function usageColorClass(p){ if(p>=85) return 'crit'; if(p>=70) return 'warn'; return 'nominal'; } var LOCK_ICO=''; function classTag(d){ + // F5 2026-07-13: USB drives never show the class hint — the card already carries the USB + // tag, and Observe-sourced USB drives showing "lassú" while registry-sourced ones never do + // was a misleading inconsistency. Hub-report ClassHint is UNCHANGED (UI-only suppression). + if(d.type==='usb') return ''; if(d.class==='fast') return 'gyors'; if(d.class==='slow') return 'lassú'; return '';