You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(#91): address Copilot review findings on PR #93
- api_capabilities.go: gate /api/{boxID}/capabilities on
ComponentMetrics + PermissionView. The manifest enumerates installed
services on the host, enough for fingerprinting in multi-tenant
deploys — a user without metrics:view shouldn't enumerate the
software inventory. Mirrors APIMetricsSummaryHandler's gate.
- history.templ: no-HAProxy banner now picks copy from the actual
capability entry — not_installed / inaccessible / disabled each get
distinct guidance, and the agent's `reason` is surfaced verbatim.
Previous copy ("Install HAProxy") pointed at the wrong fix when the
binary was present but stats unreachable.
- capabilities_cache.go: cache key is now (boxID, agentURL) so an
operator editing a box's Agent URL gets fresh capabilities on the
next render rather than stale data until the 5-min TTL expires.
Invalidate() drops every entry for the boxID regardless of URL.
- haproxy_config.go: invalidate the capabilities cache on box update
and delete so Agent URL / API key edits take effect immediately.
- api_metrics_insights.go: capability gating uses the sourceHAProxy
constant instead of a duplicate "haproxy" literal — prevents future
drift between KPI source IDs and capability lookups.
New tests:
- TestCapabilitiesCacheDifferentAgentURLBypassesCache — same boxID with
different agent URLs returns each agent's actual verdict, not stale.
- TestCapabilitiesCacheInvalidateDropsAllAgentURLsForBox — Invalidate
drops every entry for a boxID across all URLs it was fetched against.
0 commit comments