Commit Graph

2394 Commits

Author SHA1 Message Date
rcourtman a170692683 Align AI discovery lifecycle with discovery settings
Refs #1425
2026-04-21 16:06:49 +01:00
rcourtman fd5c14b049 Close RC-era issue gaps blocking v6 GA
Refs #1430

Refs #1436

Refs #1435

Refs #1409

Refs #1429

Refs #1432
2026-04-21 14:46:23 +01:00
rcourtman 770cceae52 Fix self-hosted community entitlements reporting expired state 2026-04-20 23:48:31 +01:00
rcourtman d8d94c48e1 Expose local commercial funnel diagnostics 2026-04-20 22:27:34 +01:00
rcourtman c20766b7b8 Instrument self-hosted billing conversion stages 2026-04-20 21:46:59 +01:00
rcourtman 61430703b2 Reframe self-hosted paid value around operator outcomes 2026-04-20 17:30:52 +01:00
rcourtman c4a4d175ce Fix v6 dry run backend contract regressions 2026-04-20 14:57:49 +01:00
rcourtman 6db9aeadcf Prepare the v6 stable promotion candidate 2026-04-20 14:09:17 +01:00
rcourtman cdeb257754 Finish Pulse Account workspaces shell 2026-04-20 09:25:42 +01:00
rcourtman ec28bb3314 Accept aggregator semantic IDs on node mutation endpoints
The unified /api/connections aggregator emits IDs as {type}:{name}
(e.g. "pve:delly"), but the PUT/DELETE/refresh-cluster/test endpoints
only parsed the legacy {type}-{index} array-position form. That left
the new Connection surface unable to drive any mutation against the
entries it lists.

HandleUpdateNode, HandleDeleteNode, HandleRefreshClusterNodes, and
HandleTestNode now route the incoming ID through a shared
resolveNodeID helper: colon-form resolves by Name (404 on miss),
dash-form keeps the existing index semantics. Frontend connection
client gains setEnabled/remove that dispatch to the right per-type
endpoint by ID prefix.
2026-04-19 20:42:22 +01:00
rcourtman f221a71569 Probe web-UI root so PVE/PBS/PMG detection survives the 3s auth delay
/api2/json/version requires authentication, and PVE/PBS deliberately delay
401 responses by ~3s as a timing-attack mitigation. Our 3s probe budget
fired right as the 401 arrived — every probe returned zero candidates
against real targets.

Switch the PVE/PBS/PMG fingerprint path to the web-UI root (/), which
serves the login page in <100ms and carries the same identifying Server
banner (PVE/PMG) or an unambiguous HTML title (PBS, which omits the
Server header on /). Drop versionHintsFromProxmoxBody — /version was the
only caller, and we can surface version after authentication instead.

Verified end-to-end against a live PVE (delly:8006, 41ms) and live PBS
(100.106.60.119:8007, 70ms); fan-out on a bare hostname returns the
correct product.
2026-04-19 20:10:45 +01:00
rcourtman 5296bbf4c4 Complete Pulse Cloud runtime handoff 2026-04-19 15:42:08 +01:00
rcourtman 406b966b86 v6(settings): phase 8 — per-surface Monitor* scope for TrueNAS and VMware
Adds positive MonitorDatasets/Pools/Replication booleans to TrueNASInstance
and MonitorVMs/Hosts/Datastores to VMwareVCenterInstance, matching the
PVE/PBS/PMG scope pattern. NewInstance defaults all surfaces to true;
ApplyDefaults migrates legacy all-false records to all-true so existing
truenas.json / vmware.json on disk continue monitoring after upgrade.

The unified connections aggregator now reads those booleans into the
Scope map and flips SupportsScope to true for both types, so the Scope
UI in the ConnectionEditor is a straight wire-through to the native
config fields — no new storage or adapter layer. Per-type API clients,
form state, and the TrueNAS and VMware credential slots render the same
three-checkbox "Collection scope" panel used by PVE/PBS/PMG, replacing
the old per-type Stop-this-surface dialog end-to-end from the editor's
side.

Contracts updated: agent-lifecycle, api-contracts, storage-recovery.
Tests: truenas.test.ts and vmware.test.ts round-trip the new monitor*
flags through list + update payloads; config tests cover the legacy
all-false ApplyDefaults migration; aggregator test asserts the scope map
and SupportsScope: true for both types.

Provider Refresh paths still fetch everything in one trip; honoring
Monitor* inside VMware and TrueNAS pollers is deferred to a follow-up.
2026-04-19 15:02:18 +01:00
rcourtman 9e60f2aec6 Scrub stale community billing caps
Refs #1429
2026-04-19 12:17:20 +01:00
rcourtman 9c3d96cab2 Add unified connections API (list + probe) with Disabled flag
Introduces GET /api/connections and POST /api/connections/probe as the
backend half of the one-ledger / one-editor connection redesign.

- GET /api/connections aggregates PVE/PBS/PMG/VMware/TrueNAS/agent rows
  into a unified Connection shape with derived state (active, paused,
  unauthorized, unreachable, stale, pending) computed from in-memory
  scheduler health plus agent Host.LastSeen. No new persisted state.
- POST /api/connections/probe fingerprints a host across the five
  supported products in parallel (2s dial + 1s read, 3s total, max 5
  concurrent). Admin-gated (RequireAdmin + ScopeSettingsWrite) to block
  unauthenticated SSRF against internal hosts.
- Disabled bool on PVEInstance/PBSInstance/PMGInstance (zero-value =
  enabled, preserves existing nodes.json); pollers skip disabled
  instances at client init, reconnect, and per-node iteration.
- NodeConfigRequest/Response gain Enabled; write path translates
  *bool -> Disabled so omitted field leaves state untouched.
- ConnectionsAPI frontend client (list/probe) typed off the Go shape.

Contracts updated: api-contracts, monitoring, agent-lifecycle,
performance-and-scalability, storage-recovery. Proofs added:
contract_test.go JSON snapshot for Connection and ProbeResponse,
monitoring guardrails for the Disabled-skip behavior, and a vitest
mock-client test for ConnectionsAPI.

Frontend editor / drawer / table rewrite lands in a separate block.
2026-04-19 11:42:53 +01:00
rcourtman 329f59eddb Add health-state indicators to Infrastructure, Storage, Workloads, and Recovery summaries
Summary cards now show degraded/alerting/failing counts rather than raw
online/offline splits, giving operators an at-a-glance health posture without
drilling into the full resource list.

- InfrastructureSummary/infrastructureSummaryModel: adds degraded and alerting
  counts derived from resource statuses and active alerts
- StorageSummary/StoragePageSummary/useStoragePageSummary: adds poolsDegraded
  and disksFailing indicators, shows "all healthy" when zero degradation
- WorkloadsSummary/useDashboardWorkloadDerivedState: adds alerting guest count
  from activeAlerts accessor, included in summary header counts
- RecoverySummary: adds aggregate health-state summary row
- useDashboardState: threads alertsEnabled through workload derived state
- Fix monitored-system cap test helper to use TierEnterprise so limits are
  honored (self-hosted tiers are now uncapped per the v6 product model)
- Update registry and governance test snapshots to include
  useStoragePageSummary.test.ts in the storage-product-surface proof set
2026-04-19 08:35:45 +01:00
rcourtman 9bac3f421d Fix agent-token fallback to reject cross-org tokens and update security contract test
Two test regressions introduced when agent-report tokens were allowed as
fallback auth for /api/auto-register:

1. Org mismatch was not checked: a token belonging to org-a could authenticate
   a request whose context carried org-b. Add an explicit org consistency check
   before setting authenticated=true in the fallback path.

2. The security regression test assumed only setup tokens could authenticate
   auto-register. That contract has intentionally changed: agent-report tokens
   can now authenticate but are restricted to updating existing nodes (403 for
   new-node attempts). Update the test to assert the actual security boundary.
2026-04-18 23:10:50 +01:00
rcourtman 688bdd4246 Fix PVE connection health key in registration check
The isKnownDisconnected helper was building the key as
instanceType+"-"+instanceName ("pve-delly"), but the PVE
PollProvider's connectionKey function returns the bare instance
name ("delly"). PBS uses "pbs-"+name. The mismatch meant the
disconnected-node check always missed, rendering the server-side
stale-token detection inert.

Fix: use type-specific key construction matching the PollProvider
connectionKey implementations.
2026-04-18 22:37:24 +01:00
rcourtman 40a25f82d1 Add periodic Proxmox registration health check loop
The cold-startup race: if Pulse and the agent restart together, the
monitor has no connection-health data when the agent calls
checkRegistrationWithPulse at startup. The server defaults to
registered=true (no known-disconnected entry), so the agent skips
re-registration even though the token is stale. The node stays broken
until the next manual agent restart.

Fix: after the initial runProxmoxSetup call, start a background goroutine
that waits 2 minutes (giving the monitor time to poll PVE and record
failure state), then rechecks every 5 minutes via RunHealthCheck.

RunHealthCheck only acts on types that have a local registration marker.
Types without a marker are skipped to prevent uncontrolled token rotation
when Pulse is temporarily unreachable — those need a full startup setup
cycle via RunAll.

Together with the two earlier commits this closes all three stale-token
scenarios: install-time 401, long-running stale state, and cold-startup
race.
2026-04-18 22:25:18 +01:00
rcourtman 501c61b82f Fix PVE stale token self-healing after failed registration
Two gaps in the existing flow allowed a disconnected PVE node to stay
broken indefinitely even after the agent restarted:

1. Server-side: autoRegisteredNodeExists checked only that a PVE/PBS
   instance existed in the config, not whether its connection was
   healthy. A node with a stale token would return registered=true on
   every check, causing the agent to skip re-registration forever.
   Fixed: also consult GetConnectionStatuses(); return registered=false
   when the monitor has a definitive disconnected entry so the agent can
   rotate and re-register.

2. Agent-side: the type-specific registration marker was cleared only on
   success. If rotation succeeded but the Pulse update failed (e.g.
   transient network error), the old marker from a previous successful
   registration persisted, leaving next-startup to skip setup again.
   Fixed: clear the marker before entering the token setup/rotation
   phase so any failure leaves the system in a retriable state.

Together these two fixes make the stale-token scenario self-healing:
the monitor detects the broken connection, the next agent startup sees
registered=false, clears its marker, rotates the token, and updates
Pulse — without manual intervention.
2026-04-18 22:07:30 +01:00
rcourtman b0b790cf55 Fix PVE token re-registration after agent reinstall
When the agent is reinstalled on a Proxmox host, it rotates the PVE API
token in Proxmox but the Pulse server's /api/setup-script-url endpoint
requires settings:write scope — agent tokens only have agent:report — so
the 401 aborted the update, leaving Pulse with a stale token and a
disconnected PVE node.

Three-part fix:
- server: accept agent API tokens on /api/auto-register for updating
  existing nodes (new nodes still require setup-token auth)
- agent: fall through instead of aborting when setup token fetch returns
  4xx; send X-API-Token header so the server can authenticate via the
  agent token instead
- update: allow HTTP auto-update URLs for RFC 1918 private network
  addresses (LAN installs without HTTPS no longer block auto-update)
2026-04-18 21:44:42 +01:00
rcourtman 8f133b1be1 Fix agent infinite update loop on dev builds
The /api/agent/version endpoint was returning the git-describe version
(e.g. 6.0.0-rc.2+git.58.g53a9339.dirty) for dev builds, which is always
semantically newer than the binary's embedded version (v6.0.0-rc.1).
This caused agents to loop: check version → see "newer" → self-update →
restart → still same binary version → loop again.

The agent's guard ("skip if server reports 'dev'") only fires for the
literal string "dev". Fix: return "dev" whenever IsDevelopment is true,
which covers all git-built/dirty dev instances.
2026-04-18 20:42:12 +01:00
rcourtman 847d09d17b Unify settings infrastructure ledger 2026-04-18 14:54:53 +01:00
rcourtman b666d131b0 Migrate Docker integrations to maintained Moby modules 2026-04-18 11:40:38 +01:00
rcourtman e6b0d47bd6 Gate Docker mutations on authz-plugin posture 2026-04-18 10:45:25 +01:00
rcourtman 5ebb3d9952 Harden session and setup token auth flows 2026-04-18 00:06:50 +01:00
rcourtman f2d5892aa5 Skip onboarding overflow bonus on uncapped plans
The free-tier onboarding overflow adds +1 to MaxMonitoredSystems for 14
days after initial setup. Once rc.2 made self-hosted core monitoring
uncapped (MaxMonitoredSystems = 0 on Free), the bonus math silently
converted "unlimited" into a hard cap of 1 — the UI then surfaced
"Over plan by N. N monitored, 1 included." on healthy installs.

Guard the addition on limit > 0 at all three call sites (ledger path,
commercial entitlement payload, runtime capabilities payload) so the
bonus only extends plans that actually have a cap.

Refs #1429
2026-04-17 12:16:03 +01:00
rcourtman f2746960d6 Relax mounted storage-root hardening semantics 2026-04-16 21:37:11 +01:00
rcourtman 9855973e5b Fix non-root storage hardening for Helm startup 2026-04-16 21:26:02 +01:00
rcourtman 5f0c895e81 Rebuild Pulse Account no-cap upgrade bundle
Refs #1409
2026-04-16 10:34:10 +01:00
rcourtman 1bc08f3bc1 Canonicalize self-hosted purchase handoff intent
Refs #1409
2026-04-16 10:17:37 +01:00
rcourtman 5914a4127d Make self-hosted core monitoring uncapped
Refs #1409
2026-04-16 01:21:57 +01:00
rcourtman 7e5971a3ee Allow local mergerfs mounts in disk metrics
Stop treating every fuse.* filesystem as a remote mount in the shared disk filter so local user-space filesystems such as mergerfs remain visible to host disk stats and alerts while explicit remote fuse types like sshfs still stay filtered.

Refs #1419
2026-04-15 20:11:25 +01:00
rcourtman 5e83877503 Flush OpenAI SSE buffers on EOF
Share OpenAI ChatStream finalization across DONE and clean EOF so buffered final chunks still produce tool calls and done events for OpenAI-compatible providers.\n\nFixes #1411
2026-04-15 17:37:51 +01:00
rcourtman 183fd41dd0 Resolve guest custom-rule alert paths
Fix snapshot, backup, powered-off, and config-reevaluation guest threshold resolution by routing them through shared guest alert context instead of override-only fallback paths.\n\nFixes #1418
2026-04-15 17:25:07 +01:00
rcourtman 523a64565b Keep shared Proxmox storage coherent
Refs #1416
2026-04-15 16:55:13 +01:00
rcourtman 0fa1cf5fc1 Normalize legacy Unraid raw statuses
Refs #1400
2026-04-15 16:46:20 +01:00
rcourtman 31315fb594 Normalize Proxmox special ZFS groups
Refs #1413
2026-04-15 16:40:43 +01:00
rcourtman c68d4b8ed3 Prioritize Unraid parity-loss summaries 2026-04-15 16:33:04 +01:00
rcourtman d573d3a85f Preserve standalone host continuity across restart
Refs #1402
2026-04-15 16:23:42 +01:00
rcourtman 3e09fd4493 Bound discovery AI response size 2026-04-15 14:51:50 +01:00
rcourtman bd8b2efd1b Add monitored-system admission extension hook 2026-04-15 14:04:21 +01:00
rcourtman 3596acfeb2 Trim stale SAML rebinding coverage 2026-04-15 13:57:40 +01:00
rcourtman 27367da17f Isolate internal/api tests from system data dir 2026-04-15 13:40:24 +01:00
rcourtman 8d703f2371 Explain monitored-system over-plan legitimacy 2026-04-15 13:38:57 +01:00
rcourtman a33983175b Port v5 SAML public URL rebinding 2026-04-15 13:17:01 +01:00
rcourtman 6c1364ef54 Clarify monitored-system admission freeze posture 2026-04-15 13:15:10 +01:00
rcourtman d03056f656 Port v5 NAS vendor identity and RAID normalization 2026-04-15 12:54:15 +01:00
rcourtman 84943907af Port v5 Ceph and Podman runtime compatibility 2026-04-15 12:32:05 +01:00
rcourtman b73dab2b64 Port v5 alert lifecycle and linked agent overrides 2026-04-15 12:18:57 +01:00