docs: REPORT for hub v0.29.0 (artifact version dropdowns + auto-derived sha)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-01 09:06:49 +02:00
parent 585f12e04f
commit 6148e6131c
+58 -59
View File
@@ -4,81 +4,80 @@
---
# REPORT — appliance CPU/RAM cap passthrough (`--cores` / `--memory`) (host-install v1.4.0)
# REPORT — Day-0 artifact manifest: version dropdowns + auto-derived sha (hub v0.29.0)
**Date:** 2026-07-01 · **Repo:** `felhom.eu` (`scripts/` only)
**Date:** 2026-07-01 · **Repo:** `felhom.eu` (`hub/` + `manifests/`)
Colleague-safety batch **#3** (host-install half; the cap mechanism is agent **v0.52.0**, a separate
repo/task). Adds optional `--cores`/`--memory` passthrough so an operator can cap the provisioned
appliance guest and keep it from pressuring a colleague's existing guests on a shared production host.
Removes the hand-copied sha256 from the Day-0 artifact manifest UI. The operator now **picks a version**
from a dropdown of what's actually in Gitea, and the hub **reads that version's sha256 from Gitea itself**
— no transcription, no stale checksums — while keeping the deliberate human "which version is approved"
gate (never auto-promotes "latest") and the hub as the checksum trust root.
## 1. Confirmed baseline
## 1. Baseline → target
| Repo | `main` @ commit | Current | → Target |
|------|-----------------|---------|----------|
| felhom.eu (`scripts/felhom-host-install.sh`) | `710afb0` | script **v1.3.0** | **v1.4.0** |
hub `v0.28.0` @ `ce26c9d`**`v0.29.0`**. (Follow-up to the colleague-safety batch; motivated by the
manual manifest-bump toil flagged in the prior task.)
## 2. Files changed + commit
## 2. Feasibility verified against live Gitea (before coding)
- `scripts/felhom-host-install.sh` (v1.3.0 → **v1.4.0**).
- `scripts/CHANGELOG.md` — v1.4.0 entry.
- `REPORT.md` — this file (overwritten).
- Commit **`f7905b7`** on `main` (parent `710afb0`).
- **List versions:** `GET /api/v1/packages/admin?type=generic&q=<pkg>` returns name+version — reflects
what's actually present (pruned olders gone). Live: felhom-agent `[0.52.0, 0.43.0]`, felhom-golden `[0.85.1]`.
- **sha without downloading:** `GET /api/v1/packages/admin/generic/<pkg>/<ver>/files` returns `sha256`
in metadata (agent `5bfc690c…`, golden file `golden.tar.zst` `f87031cc…`) — so the ~GB golden is
never fetched just to hash it.
## 3. What was implemented
## 3. Files changed + commits (on `main`)
- **`--cores N` / `--memory M` (MiB)** — new vars `CPU_CORES`/`MEM_MIB`; arg-parse entries; `usage()`
header gains an "Appliance cap (optional)" group (needs agent ≥ v0.52.0; `0`/unset = golden default).
- **Conditional passthrough** — `step_provision` builds a `cap_args` array (`-cores`/`-memory` appended
only when set) and passes it to BOTH the dry-run log and the real agent `--selftest=provision` call.
Never sent unset, so an agent < v0.52.0 never sees an unknown flag.
- **Pre-flight sanity WARN (soft, provision only)** — if `--cores` > host `nproc` or `--memory` > host
`MemTotal`, `log_warn`; never `die`.
- `hub/internal/gitea/gitea.go` (new) — read-only Gitea packages client: `ListVersions` (semver-desc),
`FileSHA256` (metadata, no download). `hub/internal/gitea/gitea_test.go` — httptest unit tests.
- `hub/internal/web/server.go``gitea` field + `SetGiteaClient`; `artifactChoices` helper; pkg/file
consts; `handleConfiguration` passes `AgentChoices`/`GoldenChoices`.
- `hub/internal/web/configs.go``handleSetArtifacts` reworked to derive the sha from Gitea
authoritatively (`resolveArtifactSHA`); refuses the save on a lookup failure.
- `hub/internal/web/templates/configuration.html` — version `<select>` dropdowns + read-only sha display
+ inline sync script; broadened the sha-failure flash.
- `hub/cmd/hub/main.go` — wires `SetGiteaClient` when registry creds are present.
- `manifests/hub.yaml` — image `0.28.0``0.29.0`.
- Commits: **`079a2cd`** (code + CHANGELOG), **`585f12e`** (manifest tag).
## 4. Green gate
- `bash -n scripts/felhom-host-install.sh` → OK (locally + on felhom-pve).
- `shellcheck v0.10.0`: v1.4.0 = **2× SC2015 (info)** at lines 1160 & 1170 — both the *pre-existing*
`step_verify` `A && B || C` lines, unchanged. **0 new warnings** vs. the v1.3.0 baseline.
`go build ./...`, `go vet ./...`, `go test ./...` — all clean (new `internal/gitea` tests pass:
filter+semver-sort, preferred-file match + fallback, non-200 → error).
## 5. Tests → §7 mapping (dry-run transcripts on felhom-pve; real demo customer via 0600 passphrase-file, free vmid 9300)
## 5. Behaviour
| # | Scenario | Result |
|---|----------|--------|
| T-C | script passthrough | **PASS**`--cores 2 --memory 4096 --dry-run` → provision command shows `… -sysdata-grow 42 -cores 2 -memory 4096`. |
| T-C⁻ | no cap → flags absent | **PASS** — without `--cores`/`--memory` the provision command ends `… -sysdata-grow 42 ` with NEITHER flag. |
| T-D | sanity WARN | **PASS**`--cores 64 --memory 65536 --dry-run` (host = 4 cores / ~15771 MiB) → two WARN lines: "requested cap (64 cores) exceeds host cores (4)…" and "requested cap (65536 MiB) exceeds host RAM (~15771 MiB)…"; does not die. |
- Operator picks a version → the read-only sha field mirrors that version's Gitea sha (inline JS). On
save the hub **re-derives the sha from Gitea** (a client-submitted sha is ignored) and stores it. A
Gitea lookup failure REFUSES the save (never stores a version with a wrong/blank checksum).
- "— none —" clears an artifact.
- **Graceful degradation:** without registry creds the form falls back to the previous manual text
inputs (keeps `render_test` + any credential-less deploy working).
- Trust model unchanged: the operator still deliberately chooses the version; the hub stays the checksum
trust root; "latest" is never auto-promoted (rationale in the design discussion — auto-latest would
move the trust root back to Gitea and could promote an RC/broken build).
(T-A cap-pre-boot + T-B omit-when-zero are the AGENT side — see `felhom-agent/REPORT.md`: live scratch
bring-up on vmid 9300 showed `cores:1`/`memory:1024`, then destroyed; `TestBuildBringUpConfig_ResourceCaps`
+ red-proof.)
## 6. Deploy + validation
## 6. Served-copy version check
- Image `gitea.dooplex.hu/admin/felhom-hub:0.29.0` built + pushed on 192.168.0.180; `manifests/hub.yaml`
bumped; ArgoCD `felhom` app hard-refreshed + synced → **Synced / Healthy**; `deploy/hub` rolled out to
`0.29.0`.
- Startup log confirms **`[INFO] Gitea artifact browser enabled (Day-0 version dropdowns)`** (registry
creds present → the client initialized).
- **Prior follow-up RESOLVED:** the served manifest is now **agent 0.52.0** / sha `5bfc690c…` (saved via
the operator UI earlier this session; `GET /api/v1/artifacts/demo-felhom` confirms). Fresh
`--cores`/`--memory` installs now fetch the cap-capable agent.
```
curl -fsSL https://felhom.eu/scripts/felhom-host-install.sh | grep SCRIPT_VERSION
```
**`SCRIPT_VERSION="1.4.0"`** (served copy confirmed ~1 min after push).
## 7. NOT yet visually confirmed — awaiting operator login
## 7. Hub artifact manifest status — REQUIRED FOLLOW-UP
The hub pod restart cleared the in-memory session, logging the browser out; entering the operator
password is the operator's action (CC must not type credentials). **Please log in at
`https://hub.felhom.eu/configuration`** so the version fields can be visually confirmed as dropdowns
(agent `0.52.0`/`0.43.0`, golden `0.85.1`) with a read-only sha. All server-side signals (deploy healthy,
gitea client enabled, live API returns versions+sha, unit tests) are green.
The `--cores`/`--memory` passthrough depends on a fresh install fetching **agent ≥ v0.52.0**. Status:
- ✅ Agent v0.52.0 published to Gitea (`admin/generic/felhom-agent/0.52.0/felhom-agent`, sha
`5bfc690c421b7799f4e0640f13559c41e5933ee60962bf80471eca7eae0e94cb`, round-trip verified).
- ✅ Hub deploy env fallback bumped to `ARTIFACT_AGENT_VERSION=0.52.0` + new sha (seeds an empty manifest).
-**The served manifest still returns agent 0.43.0** — the hub seeds env only into an *empty* DB field
and the stored value (0.43.0) wins. The manifest can only be changed via the **password-gated operator
UI** (Configs → Day-0 artifacts), which is out of CC's reach. **An operator must set the artifact
manifest to agent 0.52.0 / sha 5bfc690c421b7799f4e0640f13559c41e5933ee60962bf80471eca7eae0e94cb before
the colleague uses `--cores`/`--memory` on a fresh install.** (Details in `felhom-agent/REPORT.md` §6.)
## 8. Observations
## 8. NOT yet live-validated — awaiting supervised run
- A **capped real customer provision** end-to-end via the script (`--cores`/`--memory` without
`--dry-run` against a real customer/guest) — the supervised step on the colleague's box.
## 9. Observations (noticed, NOT acted on)
- The hub artifact manifest was already stale (agent 0.43.0) before this task; fresh installs fetched an
old agent regardless of this change. The operator manifest bump in §7 also clears that lag.
- Spec 2's sibling items #4 (pool-scoped ACL) is a separate later task; not touched here.
- Registry creds + the `ARTIFACT_*` env survived the ArgoCD sync (present on the live deploy).
- The `ARTIFACT_*` env remains a seed-only fallback (fills an empty DB field); the DB value (set via the
now-dropdown UI) is authoritative.