v0.143.0 — guest RAM resize UI (R-24) — MinAgent: 0.90.0

The customer sees the guest's current memory + allowed range on the Rendszer settings
page and resizes it. The controller proxies + maps the agent's machine code to Hungarian;
the agent (felhom-agent v0.90.0) enforces every bound and applies live (no reboot).

agentapi: GuestMemory + ResizeMemory; ruled 412 -> *MemoryRefusedError (code+bounds);
pre-0.90 agent 404 -> typed *StatusError. Capability: FeatureGuestMemoryResize +
featureMinAgent 0.90.0 + a featureProbes row (type-asserts GuestMemory so the shared
SupportProber/netAgent are untouched).

UI (internal/web/system_memory_handlers.go, settings_system.html): "Szerver memoria (RAM)"
card + number input; POST /api/system/memory/resize -> capability gate -> agent -> flash.
JS confirm only on shrink. Code->Hungarian map; agent-outdated hides the control;
agent-unreachable falls back to the guest's /proc/meminfo. Agent English never shown raw.

Tests: agentapi (decode, 404, refusal-code, capability table) + web handler (success/
below_usage_floor/agent_outdated). Gates + go build/vet/test all pass.
This commit is contained in:
2026-07-17 19:10:00 +02:00
parent f900c83eed
commit 3286c7faaf
10 changed files with 688 additions and 1 deletions
+25 -1
View File
@@ -25,6 +25,10 @@ type Feature string
// capability signal.
const FeatureNetstorageVerify Feature = "netstorage_verify"
// FeatureGuestMemoryResize is the guest RAM resize (agent v0.90.0, R-24): the resize endpoints
// (GET/POST /guest/memory) shipped together, so GET /guest/memory IS the capability signal.
const FeatureGuestMemoryResize Feature = "guest_memory_resize"
// SupportState is a probe verdict. The zero value is SupportUnknown (fail-open: unknown never
// refuses — the existing agent-error paths speak honestly when the agent is down).
type SupportState int
@@ -67,14 +71,34 @@ var featureProbes = map[Feature]func(ctx context.Context, p SupportProber) error
_, err := p.NetVerifyStatus(ctx)
return err
},
// The memory-resize prober needs GET /guest/memory, not NetVerifyStatus. Rather than couple the
// shared SupportProber (and every unrelated prober/fake) to the memory surface, the probe
// type-asserts the ONE method it needs — the memory feature is only ever probed with a
// GuestMemory-capable prober (the web memAgent seam / *Client). A prober without it → a non-404
// error → SupportUnknown (fail-open), never a false "supported".
FeatureGuestMemoryResize: func(ctx context.Context, p SupportProber) error {
gm, ok := p.(interface {
GuestMemory(ctx context.Context) (GuestMemoryInfo, error)
})
if !ok {
return errNoMemoryProbe
}
_, err := gm.GuestMemory(ctx)
return err
},
}
// errNoMemoryProbe classifies to SupportUnknown (not a *StatusError 404), so a prober that cannot be
// asked never reads as "unsupported".
var errNoMemoryProbe = errors.New("agentapi: prober does not support the guest-memory probe")
// featureMinAgent maps each coupled feature to the MINIMUM agent version that carries its coupled
// semantics (the CHANGELOG `MinAgent:` header value). Used by Supports when the agent's version is
// KNOWN (the v0.82.0 X-Felhom-Agent-Version channel) — a direct comparison, no probe traffic. A
// feature missing here (or an unparseable table value) falls back to the probe.
var featureMinAgent = map[Feature]string{
FeatureNetstorageVerify: "0.81.0",
FeatureNetstorageVerify: "0.81.0",
FeatureGuestMemoryResize: "0.90.0",
}
// AgentVersionReporter is optionally implemented by a SupportProber (*Client is one): it reports