Files
felhom.eu/REPORT.md
T

57 lines
4.2 KiB
Markdown

# felhom.eu — task reports
> **Overwrite** this file with a summary of the most recent task only (uniform with the other repos; not cumulative). The cumulative hub history lives in [hub/CHANGELOG.md](hub/CHANGELOG.md); the scripts history lives in [scripts/CHANGELOG.md](scripts/CHANGELOG.md).
## TASK — hub v0.42.0: remote "Debug mód" toggle on the customer config editor — 2026-07-10
**Scope:** hub only (`felhom.eu/hub`). Agent/controller unchanged — the controller already honours
`Logging.Level=="debug"` (`isDebug()``/debug` menu + verbose log). Version 0.41.0 → **0.42.0**.
### Goal
Let an operator enable the controller's debug mode **remotely, without SSH**, from the hub's customer
config editor — the support workflow (today: Peti's box). Enabling on any specific customer is a Viktor
decision/click; this task does not turn it on for anyone.
### Why a form field, not raw-JSON injection
`handleConfigUpdate` rebuilds `ConfigJSON` from the form on every save (`configs.go``buildConfigJSON`),
so a foreign key poked straight into the stored JSON is dropped on the next save. The toggle is therefore
a first-class **form field**, which by construction survives every save. The offsite descriptor survives
independently, via the post-save provision-merge — untouched by this change.
### Changes
- `internal/web/configs.go``buildConfigJSON`: `debug_mode` checked → `"logging":{"level":"debug"}`;
unchecked → the `logging` key is omitted entirely (controller.yaml default stands; no needless `"info"`).
- `internal/web/templates/config_form.html` — new collapsible **"Hibakeresési mód (fejlesztői)"** section
with the `debug_mode` checkbox + a Hungarian hint (restart-next-cycle + the `/debug` URL + "turn it off
after"). Render state parsed from `ConfigJSON`. No emoji, no BOM (consistent with the hub templates).
- `internal/web/configs_debug_test.go` — new tests (below).
- Untouched, as required: configgen, the offsite provision-merge, the controller. No generic raw-JSON editor.
### Tests (non-hollow) — all green
- `TestBuildConfigJSON_DebugMode` — checked emits `logging.level=debug`; unchecked omits the `logging` key.
- `TestConfigUpdate_DebugSurvivesRebuild_OffsiteUntouched` — full path through `handleConfigUpdate`:
(a) the debug key lands, (b) the offsite descriptor (`host/user/repo_path/host_fingerprint/quota_gb`) is
unchanged across save + idempotent re-provision, and the **red-proof** that a hand-injected foreign key
(`foo`) is gone after one save — the concrete proof of why the switch had to be a form field.
- `TestConfigForm_DebugRenderState` — debug-on ConfigJSON renders the checkbox `checked`; plain renders it unchecked.
- **Red-proof exercised:** with the `logging` block removed from `buildConfigJSON`, the survival + form tests fail.
Green gate: `go build ./... && go vet ./... && go test ./...` — all pass.
### Deploy — DONE
GitOps: image `felhom-hub:0.42.0` built on 180 → `manifests/hub.yaml` tag bumped (0.41.0→0.42.0) → ArgoCD
hard-refresh + sync → **Synced/Healthy**, live image 0.42.0, pod rolled out (2026-07-10 15:17 CEST).
### Live validation — done except the one operator-gated click
- **Off-baseline (live, operator-free):** the demo controller's generated `controller.yaml` carries
`logging.level: info` and its `/debug` route returns **404** — the exact observable the toggle flips, and
proof the `logging.level` merge target exists in the real generated config.
- **Propagation leg (green test):** `configgen.TestGenerate_DebugLevelOverride` pins that
`logging.level=debug` in ConfigJSON deep-merges over the `info` default into the generated YAML (the merge
target shape taken from the live box). configgen itself was not modified.
- **The one operator step:** ticking "Debug mód" on the demo customer and saving goes through the hub's
operator-password-gated UI — a credential CC does not have (no logged-in browser session available this
run). That single save (→ demo controller restarts next cycle → `/debug` ≠ 404 → untick → 404) is the last
hands-on confirmation; Viktor can click it. **Peti-box use (enabling on his config) is likewise Viktor's
click — not part of this task.**