Files
felhom-controller/REPORT.md
T

5.1 KiB

REPORT — controller v0.70.0: config-apply self-restart + geo-restriction UX fixes (2026-06-16)

Deployed: controller v0.70.0 on guest 9201 / felhom-pve (bootstrap-managed; healthy, hub-reporting OK). Scope: controller-only. Fixes found during live geo testing (rotating the Cloudflare API token). Commits (trunk, per-commit green gate): A ba87412, B 02a4ba0, C 09d75c1, docs c514c00, live-fix 9b7a265.

What shipped

  1. Config-apply self-restart (core fix). POST /api/config/apply previously wrote the new controller.yaml but logged "restart needed" and left stale in-process singletons — the Cloudflare client is built once at startup, so a rotated CF token kept 403'ing until a manual LXC restart. Now: byte-identical re-push → no-op (no write, no restart); changed config → write, respond 200 (flushed), then graceful self-restart (os.Exit(0) after ~500 ms; container is restart: unless-stopped). Exit is behind an injectable Restarter seam. Removed the stale wording and the dead OnConfigApplied hook (Phase-1-retired infra-backup push).
  2. Manual "Vezérlő újraindítása" buttonPOST /api/selfrestart (auth + CSRF via /api/ mount), same helper; confirm → POST → poll GET / every 2 s → reload.
  3. Immediate hub report push on geo change (Router.reportPushNow, wired in main.go): a successful geo save and a successful manual geo sync fire a non-blocking report push so the hub reflects the new state within seconds instead of after the ~15-min cycle. Scoped to geo handlers.
  4. Always report geo_restriction (buildGeoRestrictionReport): always populated (Enabled=false, empty countries when never configured) so the hub always renders the section ("Inaktív" when off).
  5. Country autocomplete fixed. See root cause below.

Country autocomplete — root cause (diagnosed live, NOT the hypothesised JS throw)

filterCountries runs without error and correctly populates the list, but reveals it with list.style.display = ''. The .geo-country-list CSS default is display:none (style.css:3084), so clearing the inline style falls back to the stylesheet and the populated list stays hidden — no console error, just an invisible dropdown. Proven live via javascript_tool: calling filterCountries('Német') set innerHTML to the "Németország (DE)" option but computed display stayed none; forcing display:block revealed it. Latent since the geo feature's first commit (e1fb852), not a recent regression; the operator's "1 console error" was unrelated (the stray DevTools filter noted in the task). Fix: reveal with 'block'.

Tests (non-hollow, per-commit green gate; companions proven red pre-fix)

  • A: selfrestart_test.go — changed config → restart once; identical → not called (companion, red without the no-op guard); invalid YAML → not called; /api/selfrestart → restart once.
  • B: geo_test.go — geo save success → push once; invalid country → no push (companion). geo_report_test.gobuildGeoRestrictionReport(nil) → non-nil disabled (companion vs old nil-omit); passthrough; disabled-nil-countries.
  • C: template/CSS visibility fix — verified live (no Go unit test applies).

Live verification on guest 9201 (all 5 pass)

  • (a) config-apply auto-restart: no-op re-push → "…változatlan…", container StartedAt unchanged; changed config → "…a vezérlő újraindul." + StartedAt advanced (11:04:18 → 11:08:50) + healthy — no manual step.
  • (b) restart button: renders (btn-restart-controller in rendered HTML); POST /api/selfrestart"Újraindítás folyamatban…" + restart (11:14:19 → 11:14:50) + healthy. (Full button click not automated — its confirm() dialog blocks the browser extension; the poll-reload JS is code-reviewed.)
  • (c) geo save → hub within seconds: save → controller logs "Hub report pushed successfully" 1 s later; hub's latest demo report received_at = 11:15:52 (the save time) with geo_restriction = {"enabled":true,"allowed_countries":["HU"]}.
  • (d) hub "Inaktív" when off: geo disabled → report carries geo_restriction = {"enabled":false,…} (present-but-disabled = the data the hub renders as "Inaktív"; pre-fix this field was omitted and the section hidden). Demo re-enabled (HU) afterwards.
  • (e) country dropdown: typing "Német" lists Németország (DE) on the deployed 0.70.0 (the 'block' fix; confirmed the deployed JS uses 'block' and the list becomes visible).

Bug found + fixed during verification

The restart button was initially placed inside the {{if .RetrievalPassword}} block, so it was hidden on the demo (no retrieval password set). Moved outside the conditional (commit 9b7a265), rebuilt + redeployed 0.70.0, re-verified it renders.

Notes / cleanup

  • All temp files removed from the build host (incl. a copied controller.yaml that held plaintext secrets), guest, and local; the demo's controller.yaml was restored to its clean pre-test content.
  • Out of scope (untouched): the Komga healthcheck; extending the immediate-report-push pattern beyond geo handlers.