Files
felhom-agent/REPORT.md
T
admin e68a7af4d3 fix(agent): slice-3 follow-ups — keep run-status on config fail, selftest usage, contract golden (v0.3.1)
- collect: a per-guest GuestConfig failure preserves the ListLXC run-status (only
  spec dropped); empty status normalized to "unknown". Test asserts preserved
  "running" + nil spec.
- main: --selftest usage error now reads (want read|task|hub).
- contract: testdata/host-report.golden.json + TestHostReport_ContractMatchesGolden
  (field-name key-set check vs golden; byte-identical with the hub copy).
- version 0.3.0 -> 0.3.1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 18:29:05 +02:00

48 lines
2.6 KiB
Markdown

# felhom-agent — latest task report
> This file holds the report for the **most recent** change, fully overwritten each task.
> Cumulative history lives in [CHANGELOG.md](CHANGELOG.md).
## Task: slice-3 validation follow-ups — v0.3.1
Small fixes surfaced during slice-3 validation (agent half). Pushed to `main`; build/vet/test
green locally (go1.26) and on the build server.
### §1 — `--selftest` usage string
`selftestFlag.Set`'s error now reads `(want read|task|hub)` (was missing `hub`, which became a
valid mode in slice 3). Cosmetic.
### §2 — collector keeps run-status on a `GuestConfig` failure
`internal/hub/collect.go` `collectGuests`: a per-guest `GuestConfig` error no longer forces
`status="unknown"`. The run-status from `ListLXC` is **preserved** (only `spec` is dropped — that's
the only thing actually unknown). An *empty* status is still normalized to `unknown`, so the wire
value is always `running|stopped|unknown` (matches the hub handler's empty→unknown defaulting).
Test renamed `TestCollect_GuestConfigFailureKeepsStatusOmitsSpec`, now asserting the preserved
`running` status **and** nil spec (not a hollow `!= "unknown"` check).
### §4 — cross-repo contract golden fixture (agent half)
The host-report shape lives in two repos with nothing failing on drift (the hub ignores unknown
fields). Locked it with a golden sample:
- `internal/hub/testdata/host-report.golden.json` — a populated report (host block, two guests:
one `running` with `spec`, one `stopped`; `cloudflared`; the four empty collections + `audit_tail`
as `[]`).
- `TestHostReport_ContractMatchesGolden` — marshals a constructed `HostReport`, unmarshals the
golden, and compares **field-name key sets** at top level + `host` + `guests[0]`. A renamed/added/
removed json tag fails it.
**Caveat (called out):** this is a *duplicated* contract — the file must stay **byte-identical**
with `felhom-hub`'s `hub/internal/api/testdata/host-report.golden.json`. JSON can't carry a comment,
so the mandatory "keep byte-identical" note lives in the test file's doc comment in both repos
instead of a JSON header. When slices 5/6 add real `storage_targets`/`backups` fields, revisit
promoting this to a shared Go types module (the proper fix).
### Not touched (confirmed)
The daemon's proxmox client timeout is already bounded: `proxmox.NewClient` defaults `HTTPTimeout`
to 30s when zero, and `newProxmoxClient` leaves it zero. No change (was a "confirm" item).
### Verification
`go build/vet/test ./...` green locally (go1.26) and on the build server (go1.26). Version 0.3.0 → 0.3.1.
### Repo state
Branch: `main` only. Dep unchanged (`golang.org/x/crypto v0.52.0`).