Files
felhom-controller/REPORT.md
T

48 lines
3.2 KiB
Markdown

# REPORT — controller v0.79.0: disk view keys "registered" on the stable path
## Baseline
- felhom-controller `main` @ `081c1cd`, **v0.78.0 → v0.79.0**. Trunk-based, `main`.
- Follow-up to v0.78.0 (stable-path registration). Same path-model mismatch, on the **display** side.
## Problem (operator-reported, screenshot)
After v0.78.0, the storage disk view tagged both enrolled, working drives **"Nem regisztrált"** and
showed a **"Regisztrálás"** button — even though the registry holds them and the selftest reports them
`2 connected`. Root cause: the disk-view JS (`settings.html`) decided "registered?" by looking up the
drive's **raw** `mount_path` (`/mnt/felhom-flash`) in `window.__registeredPaths`, but v0.78.0 made the
registry store the **stable** path (`/mnt/felhom-drives/felhom-flash`), so the raw-key lookup always
missed. (Before v0.78.0 it read "Regisztrálva" because the registry held the raw path — looked right but
the drive was broken.)
## Fix (`controller/internal/web/templates/settings.html`, disk-view JS)
- New `regKey(d)` = `d.guest_path || d.mount_path` — the agent already reports each drive's STABLE
in-guest path as `guest_path` (`/mnt/felhom-drives/<name>`), which is what the registry stores.
- `regBadge(d, registered)` and `actions(d, registered)` now key the "is registered" check on
`regKey(d)` instead of `d.mount_path`. So an enrolled drive reads **"Regisztrálva"** and the spurious
Register button is hidden.
- `registerDrive()` still posts the RAW `mount_path` (unchanged) — the agent operates on raw, and
`handleStorageRegister` maps it to the stable path. Display-only change; no Go/handler change.
## Tests
- `go build ./... && go vet ./... && go test ./...`**all green** (incl. `TestTemplatesParse`, which
forces the edited template to parse).
## Deploy (v0.79.0 → guest 9201)
- Built + pushed `gitea.dooplex.hu/admin/felhom-controller:0.79.0` on 192.168.0.180; deployed to 9201
(pull → `/etc/felhom-controller-image` → restart `felhom-controller-bootstrap.service`); `docker ps`
`:0.79.0 Up (healthy)`.
## Verification (the two data inputs the fixed JS consumes — now aligned)
- `GET /api/disks` (in-guest): `felhom-flash``mount_path=/mnt/felhom-flash`,
`guest_path=/mnt/felhom-drives/felhom-flash`, `bound_under_parent=true`; `felhom-usb`
`guest_path=/mnt/felhom-drives/felhom-usb`, `bound=true`.
- Settings page `__registeredPaths` = `["/mnt/felhom-drives/felhom-flash","/mnt/felhom-drives/felhom-usb"]`.
-`regKey(d)=d.guest_path` now matches the registry → badge renders **"Regisztrálva"** and the
spurious **"Regisztrálás"** button is hidden. (The badge/button are pure client-side JS over these two
inputs; verified the inputs, not a browser render — the bridge wasn't available this session.)
- v0.78.0 state intact: storage selftest `2 connected`, no "Rendszermeghajtón", no activation banner.
## Observations (recorded, NOT acted on)
- `pendingActivationDrives` still keys off the agent's raw `MountPath` (the "~30 mp újraindítás" banner);
obsolete in the live-activating intermediary model — key off `GuestPath`/`BoundUnderParent` or retire.
- The free-form settings storage-add registers a user-typed path verbatim (advanced manual flow).