Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Measure Pro feature adoption and drop the dead Patrol autofix counter
rcourtman54a312bebd97
diff --git a/docs/PRIVACY.md b/docs/PRIVACY.mdindex 231fcf45db..d73ab858d0 100644--- a/docs/PRIVACY.md+++ b/docs/PRIVACY.md@@ -103,11 +103,20 @@ Every field is listed below with the reason it exists. Nothing else is included| Notification failures configuration 7d (schema v5) | `0` | Count terminal failures classified locally as missing or invalid destination configuration without sending configuration values || Notification failures rejected 7d (schema v5) | `0` | Count terminal failures classified locally as destination request or payload rejection without sending response or payload content || Notification failures unknown 7d (schema v5) | `0` | Count terminal failures that do not match another fixed class without sending raw errors |+| Alert AI enabled | `true`/`false` | See whether AI analysis on alert firing is switched on, without sending alert content, resource identifiers, or analysis text || Relay enabled | `true`/`false` | See whether remote-access features are being used || SSO enabled | `true`/`false` | See whether single-sign-on support is being used || Multi-tenant | `true`/`false` | See whether multi-tenant/runtime-org features are being used || Paid license | `true`/`false` | Distinguish free from paid posture without sending the exact commercial tier || Has API tokens | `true`/`false` | See whether token-based automation/integration is being used without sending token counts |+| RBAC custom roles | `3` | Count roles created by the operator, excluding the roles that ship built in, without sending role names, permissions, or scopes |+| RBAC user assignments | `7` | Count user-to-role assignments without sending usernames, role names, or permissions |+| Audit logging persistent | `true`/`false` | See whether a persistent audit store is active rather than console-only logging, without sending any audit event |+| Audit events 30d | `41` | Count audit events retained in the current 30-day telemetry window without sending event types, actors, targets, outcomes, or event detail |+| Report schedules | `5` | Count configured scheduled reports without sending schedule names, report scope, formats, or delivery recipients |+| Report schedules enabled | `4` | Count scheduled reports that are switched on, without sending schedule names, scope, or recipients |+| Report schedules run 30d | `2` | Count scheduled reports that last ran inside the current 30-day telemetry window, without sending run times, report contents, or delivery results |+| Agent profiles | `9` | Count configured agent profiles without sending profile names, targets, or profile contents || Update attempts 30d | `2` | Count update attempts recorded in the current 30-day telemetry window without sending download URLs, logs, or command output || Update successes 30d | `1` | Count successful update attempts in the current 30-day telemetry window || Update failures 30d | `1` | Count failed or rolled-back update attempts in the current 30-day telemetry window without sending raw errors, logs, URLs, or command output |@@ -152,7 +161,6 @@ Every field is listed below with the reason it exists. Nothing else is included| Pulse Intelligence Patrol new findings 30d | `5` | Count new findings produced by Patrol in the current 30-day telemetry window without sending finding IDs or details || Pulse Intelligence Patrol investigations 30d | `3` | Count findings investigated by Patrol in the current 30-day telemetry window without sending finding IDs, resource IDs, or details || Pulse Intelligence Patrol resolved findings 30d | `2` | Count findings resolved or fix-verified in the current 30-day telemetry window without sending finding IDs, resource IDs, fix details, or verification detail |-| Pulse Intelligence Patrol autofixes 30d | `1` | Count Patrol autofix records in the current 30-day telemetry window without sending target resources or fix content || Pulse Intelligence external agent enabled | `true`/`false` | See whether at least one token can use the external Pulse Intelligence agent/MCP surface without sending token counts, names, scopes, or values || Pulse Intelligence external agent used 30d | `true`/`false` | See whether an external-agent-capable API token reached a Pulse Intelligence agent/MCP route in the current 30-day telemetry window without sending token identity, route parameters, resource IDs, or request details || Pulse Intelligence MCP adapter used 30d | `true`/`false` | See whether the `pulse-mcp` adapter reached a Pulse Intelligence agent/MCP route in the current 30-day telemetry window without sending token identity, route parameters, resource IDs, prompts, or request details |diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex c50be016da..a705fb7ee2 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -5791,3 +5791,13 @@ bounded and classified temperature nodes, and leaves the host report intactwhen the helper is absent or incompatible. It does not treat Windows ACPIthermal zones as hardware sensor evidence, accept remote provider locations,or grant Pulse hardware-control authority.+### Agent profile adoption is reported as a count only++The usage telemetry snapshot reads `LoadAgentProfiles` and reports+`agent_profiles`, the number of configured profiles, in the outbound payload.+Profile names, targets, assignment mappings, and profile contents are not sent.+The read happens in `applyLicensedFeatureConfigSnapshot`+(`pkg/server/telemetry_licensed_features.go`) and is pinned by+`TestApplyLicensedFeatureConfigSnapshot_CountsScheduledReportingAndProfiles`,+which also asserts an unconfigured install reports zero rather than omitting+the field.diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 658d40afa9..0788fd9c8d 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -6863,3 +6863,16 @@ to the same policy as the outer address, so `PULSE_AI_ALLOW_LOOPBACK` and`PULSE_AI_ALLOW_PRIVATE_IPS` relax the embedded check exactly as they relax theouter one, and a transition address wrapping a permitted public target stayspermitted.+### Patrol run records no longer carry a dead auto-fix count++`PatrolRunRecord.AutoFixCount` was removed from `internal/ai/patrol.go`,+`internal/ai/patrol_run.go`, `internal/ai/patrol_history_persistence.go`,+`internal/ai/patrol_assistant_handoff.go`, and the persisted mirror in+`internal/config/persistence.go`. The field was constructed as a literal `0` in+`buildPatrolRunRecord` and had no increment site anywhere in the tree, so it was+structurally incapable of holding a non-zero value while still being plumbed+through run history, the Assistant handoff summary, and outbound telemetry.+Governed Patrol fixes are delivered through the approved-action pipeline and+are already counted there (`pulse_intelligence_approved_action_*`), which is the+signal to read for remediation activity. Existing persisted history files that+still contain `auto_fix_count` load cleanly; the unknown key is ignored.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 9145152acb..2f4d1757ac 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -8852,3 +8852,16 @@ optional and additive: older agents omit it, older stored hosts may have nodataset collection, and provider ZFS pool responses omit `datasets` when nolinked host evidence exists. Ingest trims text, rejects invalid counters, andbounds rows and field lengths before the data reaches runtime models.+### Telemetry payload parity spans three surfaces at schema v6++The outbound telemetry contract is defined in exactly three places that must+move together: `type Ping struct` in `internal/telemetry/telemetry.go`, the+`var ping struct` receiver in the private license server, and+`export interface TelemetryPingPreview` in+`frontend-modern/src/api/settings.ts`. `scripts/check_telemetry_schema_parity.py`+fails if any field, or any field type, differs between them; only+`license_tier` and `api_tokens` are allowed to exist receiver-side as legacy+scrubbed columns. Schema v6 adds nine licensed-feature adoption fields and+removes `pulse_intelligence_patrol_autofixes_30d`. The frontend interface is+not decorative: the Settings telemetry preview renders the payload verbatim, so+a field missing there is a field the user is not shown before it is sent.diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.mdindex 546c315d7c..ba5ea96dfe 100644--- a/docs/release-control/v6/internal/subsystems/security-privacy.md+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md@@ -1866,3 +1866,40 @@ server-filtered runtime payload; hiding controls or checking a client-sidecapability is not treated as the authorization boundary.`internal/api/runtime_branding_test.go` proves the no-entitlement non-leakageand image normalization.+### Licensed-feature adoption telemetry stays count-only++Schema v6 of the outbound usage payload adds nine licensed-feature adoption+signals so Pro feature usage is measurable at all: `alert_ai_enabled`,+`rbac_custom_roles`, `rbac_user_assignments`, `audit_logging_persistent`,+`audit_events_30d`, `report_schedules`, `report_schedules_enabled`,+`report_schedules_run_30d`, and `agent_profiles`. Every one is a count or a+coarse boolean. Role names, permission sets, usernames, schedule names,+delivery recipients, report scope and contents, profile names, and every audit+event field (type, actor, target, outcome, detail) stay on the install.+`audit_logging_persistent` reports only that a persistent store is active+rather than console logging, and `audit_events_30d` is a retained-row count+inside the same 30-day window used by the other counters, so it cannot be+linked to one pseudonymous identifier indefinitely. Config-sourced signals are+read in `applyLicensedFeatureConfigSnapshot`+(`pkg/server/telemetry_licensed_features.go`); RBAC and audit are read behind+the router in `Router.ApplyLicensedFeatureTelemetrySnapshot`+(`internal/api/telemetry_licensed_features.go`). Both are disclosed in+`docs/PRIVACY.md` and its `frontend-modern/public/docs/` copy, pinned by+`TestAllTelemetryFieldsAreDisclosed`, and the counts are pinned by+`TestApplyLicensedFeatureConfigSnapshot_CountsScheduledReportingAndProfiles`+and `TestApplyLicensedFeatureTelemetrySnapshot_CountsOnlyOperatorAuthoredRBAC`.++### Telemetry RBAC reads never provision an RBAC store++The usage telemetry snapshot runs on a timer against every known org, so it+reads RBAC through `TenantRBACProvider.PeekManager`+(`internal/api/access_tenant_provider.go`), which returns an already-cached+manager and never creates one. Using the provisioning `GetManager` there would+have created a SQLite RBAC store for every org that has never used RBAC, as a+side effect of a background read. A store reporting a migration failure is+skipped rather than counted, so a degraded store cannot silently understate+adoption. `TestTenantRBACProvider_PeekManagerDoesNotProvision` and+`TestTenantRBACProvider_PeekManagerNilProviderIsSafe` in+`internal/api/rbac_tenant_provider_test.go` pin both properties, and+`TestApplyLicensedFeatureTelemetrySnapshot_DoesNotCreateRBACStores` pins it+through the router boundary.diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 3403af1c44..dc24359e5b 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -4960,3 +4960,16 @@ The ZFS pool-detail summary has one stable shape: `datasets` is always anarray, including when the backend reports no dataset inventory. Consumers andbranch proofs must retain the empty array instead of treating dataset supportas an optional return-field contract.+### Scheduled reporting adoption is read from persisted config as counts++The usage telemetry snapshot reads `LoadReportScheduleStore` and reports three+counts: `report_schedules` (configured), `report_schedules_enabled` (switched+on), and `report_schedules_run_30d` (schedules whose `LastRunAt` falls inside+the 30-day telemetry window). Schedule names, cadence, scope, format, delivery+method, and recipients are never sent, and no report content is read. A+disabled schedule that last ran inside the window still counts toward+`report_schedules_run_30d`, because the question the field answers is whether+reporting actually produced output, not whether it is currently armed. The read+is in `applyLicensedFeatureConfigSnapshot`+(`pkg/server/telemetry_licensed_features.go`), pinned by+`TestApplyLicensedFeatureConfigSnapshot_CountsScheduledReportingAndProfiles`.diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.jsonindex 379126194f..36ba60631c 100644--- a/frontend-modern/browser-verification.json+++ b/frontend-modern/browser-verification.json@@ -1,32 +1,39 @@{"version": 1,- "base_sha": "364a3f458938a0610eb2a27c1ce81a73d0a0ffa7",- "verified_at": "2026-08-05T14:24:00Z",+ "base_sha": "f271313b3d8d69bb303129f7310f2696d164f40c",+ "verified_at": "2026-08-05T13:34:22Z","result": "passed","changed_paths": [- "frontend-modern/src/components/Alerts/Thresholds/sections/CollapsibleSection.tsx"+ "frontend-modern/src/api/settings.ts"],"content_sha256": {- "frontend-modern/src/components/Alerts/Thresholds/sections/CollapsibleSection.tsx": "4ea1aee30e4c5c0ecc0f07285a2da70f90b234137793d3d6bca1fcb73a9bb108"+ "frontend-modern/src/api/settings.ts": "ab0bf34f16a18a2d6a4cb0ce7341480ee4d9e961201b2f5290c366fef9c4c26b"},"routes": [- "/alerts/thresholds/proxmox"+ "/settings"],"viewports": [- { "width": 600, "height": 900 },- { "width": 1440, "height": 1000 }+ {+ "width": 1280,+ "height": 720+ },+ {+ "width": 375,+ "height": 812+ }],"states": [- "Guests section expanded at 1440 wide reporting a 10958px grid row track with computed max-height none and no clipping",- "Guests section collapsed at 1440 wide reporting a 0px row track with its content clipped by the inner overflow wrapper",- "Guests section expanded at 600 wide reporting a 10810px row track and no clipping",- "Nodes section expanded alongside at 2414px, confirming a second CollapsibleSection instance resolves its own track",- "Document scroll width equal to client width at both viewports with no console errors"+ "Settings > General > Usage data and privacy with no telemetry payload loaded yet",+ "Heartbeat payload rendered on a fresh install: schema_version 6, all nine new licensed-feature fields present, pulse_intelligence_patrol_autofixes_30d absent",+ "Heartbeat payload after seeding three report schedules (two enabled, one last run inside the window) and two agent profiles: report_schedules 3, report_schedules_enabled 2, report_schedules_run_30d 1, agent_profiles 2",+ "Audit adoption reported live from the running install: audit_logging_persistent true and audit_events_30d 1 after the sign-in event",+ "Payload block at the 375px narrow viewport scrolling inside its own overflow-x container with no horizontal page scroll",+ "Re-verified on parent f271313b3 after that commit reworked CollapsibleSection expansion: payload block renders its full 2949px height at the 375px viewport with no clipping and no horizontal page scroll"],"interactions": [- "Collapsed and expanded the guests section three times at 1440 wide and confirmed the row track alternates between 0px and the full content height",- "Collapsed and expanded the guests section at 600 wide and confirmed the same alternation",- "Compared inner scrollHeight against clientHeight in every expanded state to prove the content is no longer truncated at the former 5000px cap",- "Confirmed the computed transition-property is opacity, since transition-all pinned grid-template-rows at its pre-toggle pixel value and left the section stuck"+ "Signed in at /settings with the admin credentials",+ "Opened Settings > General and clicked Preview payload",+ "Clicked Refresh payload after seeding report_schedules.json and agent_profiles.json to confirm the counts track real configuration",+ "Resized to the 375px narrow viewport and scrolled the payload block to confirm it contains its own horizontal overflow"]}diff --git a/frontend-modern/public/docs/PRIVACY.md b/frontend-modern/public/docs/PRIVACY.mdindex 231fcf45db..d73ab858d0 100644--- a/frontend-modern/public/docs/PRIVACY.md+++ b/frontend-modern/public/docs/PRIVACY.md@@ -103,11 +103,20 @@ Every field is listed below with the reason it exists. Nothing else is included| Notification failures configuration 7d (schema v5) | `0` | Count terminal failures classified locally as missing or invalid destination configuration without sending configuration values || Notification failures rejected 7d (schema v5) | `0` | Count terminal failures classified locally as destination request or payload rejection without sending response or payload content || Notification failures unknown 7d (schema v5) | `0` | Count terminal failures that do not match another fixed class without sending raw errors |+| Alert AI enabled | `true`/`false` | See whether AI analysis on alert firing is switched on, without sending alert content, resource identifiers, or analysis text || Relay enabled | `true`/`false` | See whether remote-access features are being used || SSO enabled | `true`/`false` | See whether single-sign-on support is being used || Multi-tenant | `true`/`false` | See whether multi-tenant/runtime-org features are being used || Paid license | `true`/`false` | Distinguish free from paid posture without sending the exact commercial tier || Has API tokens | `true`/`false` | See whether token-based automation/integration is being used without sending token counts |+| RBAC custom roles | `3` | Count roles created by the operator, excluding the roles that ship built in, without sending role names, permissions, or scopes |+| RBAC user assignments | `7` | Count user-to-role assignments without sending usernames, role names, or permissions |+| Audit logging persistent | `true`/`false` | See whether a persistent audit store is active rather than console-only logging, without sending any audit event |+| Audit events 30d | `41` | Count audit events retained in the current 30-day telemetry window without sending event types, actors, targets, outcomes, or event detail |+| Report schedules | `5` | Count configured scheduled reports without sending schedule names, report scope, formats, or delivery recipients |+| Report schedules enabled | `4` | Count scheduled reports that are switched on, without sending schedule names, scope, or recipients |+| Report schedules run 30d | `2` | Count scheduled reports that last ran inside the current 30-day telemetry window, without sending run times, report contents, or delivery results |+| Agent profiles | `9` | Count configured agent profiles without sending profile names, targets, or profile contents || Update attempts 30d | `2` | Count update attempts recorded in the current 30-day telemetry window without sending download URLs, logs, or command output || Update successes 30d | `1` | Count successful update attempts in the current 30-day telemetry window || Update failures 30d | `1` | Count failed or rolled-back update attempts in the current 30-day telemetry window without sending raw errors, logs, URLs, or command output |@@ -152,7 +161,6 @@ Every field is listed below with the reason it exists. Nothing else is included| Pulse Intelligence Patrol new findings 30d | `5` | Count new findings produced by Patrol in the current 30-day telemetry window without sending finding IDs or details || Pulse Intelligence Patrol investigations 30d | `3` | Count findings investigated by Patrol in the current 30-day telemetry window without sending finding IDs, resource IDs, or details || Pulse Intelligence Patrol resolved findings 30d | `2` | Count findings resolved or fix-verified in the current 30-day telemetry window without sending finding IDs, resource IDs, fix details, or verification detail |-| Pulse Intelligence Patrol autofixes 30d | `1` | Count Patrol autofix records in the current 30-day telemetry window without sending target resources or fix content || Pulse Intelligence external agent enabled | `true`/`false` | See whether at least one token can use the external Pulse Intelligence agent/MCP surface without sending token counts, names, scopes, or values || Pulse Intelligence external agent used 30d | `true`/`false` | See whether an external-agent-capable API token reached a Pulse Intelligence agent/MCP route in the current 30-day telemetry window without sending token identity, route parameters, resource IDs, or request details || Pulse Intelligence MCP adapter used 30d | `true`/`false` | See whether the `pulse-mcp` adapter reached a Pulse Intelligence agent/MCP route in the current 30-day telemetry window without sending token identity, route parameters, resource IDs, prompts, or request details |diff --git a/frontend-modern/src/api/__tests__/settings.test.ts b/frontend-modern/src/api/__tests__/settings.test.tsindex 9c6a9d0ee6..8851d0b80c 100644--- a/frontend-modern/src/api/__tests__/settings.test.ts+++ b/frontend-modern/src/api/__tests__/settings.test.ts@@ -57,12 +57,21 @@ const mockTelemetryPreviewPayload = {discovery_enabled: false,notifications_enabled: false,ai_actions_enabled: false,+ alert_ai_enabled: false,active_alerts: 0,relay_enabled: false,sso_enabled: false,multi_tenant: false,paid_license: false,has_api_tokens: true,+ rbac_custom_roles: 0,+ rbac_user_assignments: 0,+ audit_logging_persistent: false,+ audit_events_30d: 0,+ report_schedules: 0,+ report_schedules_enabled: 0,+ report_schedules_run_30d: 0,+ agent_profiles: 0,update_attempts_30d: 0,update_successes_30d: 0,update_failures_30d: 0,@@ -120,7 +129,6 @@ const mockTelemetryPreviewPayload = {pulse_intelligence_patrol_new_findings_30d: 0,pulse_intelligence_patrol_investigations_30d: 0,pulse_intelligence_patrol_resolved_findings_30d: 0,- pulse_intelligence_patrol_autofixes_30d: 0,pulse_intelligence_external_agent_enabled: false,pulse_intelligence_external_agent_used_30d: false,pulse_intelligence_mcp_adapter_used_30d: false,diff --git a/frontend-modern/src/api/settings.ts b/frontend-modern/src/api/settings.tsindex f97c8be446..49be29848c 100644--- a/frontend-modern/src/api/settings.ts+++ b/frontend-modern/src/api/settings.ts@@ -58,12 +58,21 @@ export interface TelemetryPingPreview {discovery_enabled: boolean;notifications_enabled: boolean;ai_actions_enabled: boolean;+ alert_ai_enabled: boolean;active_alerts: number;relay_enabled: boolean;sso_enabled: boolean;multi_tenant: boolean;paid_license: boolean;has_api_tokens: boolean;+ rbac_custom_roles: number;+ rbac_user_assignments: number;+ audit_logging_persistent: boolean;+ audit_events_30d: number;+ report_schedules: number;+ report_schedules_enabled: number;+ report_schedules_run_30d: number;+ agent_profiles: number;update_attempts_30d: number;update_successes_30d: number;update_failures_30d: number;@@ -121,7 +130,6 @@ export interface TelemetryPingPreview {pulse_intelligence_patrol_new_findings_30d: number;pulse_intelligence_patrol_investigations_30d: number;pulse_intelligence_patrol_resolved_findings_30d: number;- pulse_intelligence_patrol_autofixes_30d: number;pulse_intelligence_external_agent_enabled: boolean;pulse_intelligence_external_agent_used_30d: boolean;pulse_intelligence_mcp_adapter_used_30d: boolean;diff --git a/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts b/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.tsindex bf23b8a100..7c505ea751 100644--- a/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts@@ -63,12 +63,21 @@ const buildTelemetryPreviewPayload = (discovery_enabled: false,notifications_enabled: false,ai_actions_enabled: false,+ alert_ai_enabled: false,active_alerts: 0,relay_enabled: false,sso_enabled: false,multi_tenant: false,paid_license: false,has_api_tokens: true,+ rbac_custom_roles: 0,+ rbac_user_assignments: 0,+ audit_logging_persistent: false,+ audit_events_30d: 0,+ report_schedules: 0,+ report_schedules_enabled: 0,+ report_schedules_run_30d: 0,+ agent_profiles: 0,update_attempts_30d: 0,update_successes_30d: 0,update_failures_30d: 0,@@ -126,7 +135,6 @@ const buildTelemetryPreviewPayload = (pulse_intelligence_patrol_new_findings_30d: 0,pulse_intelligence_patrol_investigations_30d: 0,pulse_intelligence_patrol_resolved_findings_30d: 0,- pulse_intelligence_patrol_autofixes_30d: 0,pulse_intelligence_external_agent_enabled: false,pulse_intelligence_external_agent_used_30d: false,pulse_intelligence_mcp_adapter_used_30d: false,diff --git a/internal/ai/patrol.go b/internal/ai/patrol.goindex 70e1a77d8b..8f937fcd9b 100644--- a/internal/ai/patrol.go+++ b/internal/ai/patrol.go@@ -150,7 +150,6 @@ type PatrolRunRecord struct {ExistingFindings int `json:"existing_findings"`RejectedFindings int `json:"rejected_findings"`ResolvedFindings int `json:"resolved_findings"`- AutoFixCount int `json:"auto_fix_count,omitempty"`FindingsSummary string `json:"findings_summary"` // e.g., "All healthy" or "2 warnings, 1 critical"FindingIDs []string `json:"finding_ids"` // IDs of findings from this runFindingAssessments []PatrolFindingAssessment `json:"finding_assessments,omitempty"`@@ -198,7 +197,6 @@ type patrolRunRecordJSON struct {ExistingFindings int `json:"existing_findings"`RejectedFindings int `json:"rejected_findings"`ResolvedFindings int `json:"resolved_findings"`- AutoFixCount int `json:"auto_fix_count,omitempty"`FindingsSummary string `json:"findings_summary"`FindingIDs []string `json:"finding_ids"`FindingAssessments []PatrolFindingAssessment `json:"finding_assessments,omitempty"`@@ -329,7 +327,6 @@ func (r PatrolRunRecord) MarshalJSON() ([]byte, error) {ExistingFindings: normalized.ExistingFindings,RejectedFindings: normalized.RejectedFindings,ResolvedFindings: normalized.ResolvedFindings,- AutoFixCount: normalized.AutoFixCount,FindingsSummary: normalized.FindingsSummary,FindingIDs: normalized.FindingIDs,FindingAssessments: normalized.FindingAssessments,@@ -382,7 +379,6 @@ func (r *PatrolRunRecord) UnmarshalJSON(data []byte) error {ExistingFindings: payload.ExistingFindings,RejectedFindings: payload.RejectedFindings,ResolvedFindings: payload.ResolvedFindings,- AutoFixCount: payload.AutoFixCount,FindingsSummary: payload.FindingsSummary,FindingIDs: payload.FindingIDs,FindingAssessments: payload.FindingAssessments,diff --git a/internal/ai/patrol_assistant_handoff.go b/internal/ai/patrol_assistant_handoff.goindex ee4c9ad336..c7e8a075f1 100644--- a/internal/ai/patrol_assistant_handoff.go+++ b/internal/ai/patrol_assistant_handoff.go@@ -302,7 +302,6 @@ func patrolRunOutcomeSummary(run PatrolRunRecord) string {countPatrolRunSingularFact(run.ExistingFindings, "existing finding"),countPatrolRunSingularFact(run.ResolvedFindings, "resolved finding"),countPatrolRunSingularFact(run.RejectedFindings, "rejected finding"),- countPatrolRunSingularFact(run.AutoFixCount, "auto-remediation"),countPatrolRunSingularFact(run.ErrorCount, "error"),})}diff --git a/internal/ai/patrol_history_persistence.go b/internal/ai/patrol_history_persistence.goindex 842ca59175..f1605a46f3 100644--- a/internal/ai/patrol_history_persistence.go+++ b/internal/ai/patrol_history_persistence.go@@ -66,7 +66,6 @@ func (a *PatrolHistoryPersistenceAdapter) SavePatrolRunHistory(runs []PatrolRunRExistingFindings: normalized.ExistingFindings,RejectedFindings: normalized.RejectedFindings,ResolvedFindings: normalized.ResolvedFindings,- AutoFixCount: normalized.AutoFixCount,FindingsSummary: normalized.FindingsSummary,FindingIDs: normalized.FindingIDs,ErrorCount: normalized.ErrorCount,@@ -125,7 +124,6 @@ func (a *PatrolHistoryPersistenceAdapter) LoadPatrolRunHistory() ([]PatrolRunRecExistingFindings: r.ExistingFindings,RejectedFindings: r.RejectedFindings,ResolvedFindings: r.ResolvedFindings,- AutoFixCount: r.AutoFixCount,FindingsSummary: r.FindingsSummary,FindingIDs: r.FindingIDs,ErrorCount: r.ErrorCount,diff --git a/internal/ai/patrol_history_persistence_test.go b/internal/ai/patrol_history_persistence_test.goindex b0c5a49529..cd1c787914 100644--- a/internal/ai/patrol_history_persistence_test.go+++ b/internal/ai/patrol_history_persistence_test.go@@ -666,7 +666,6 @@ func TestPatrolHistoryPersistenceAdapter_SaveAndLoad(t *testing.T) {NewFindings: 1,ExistingFindings: 2,ResolvedFindings: 1,- AutoFixCount: 0,FindingsSummary: "summary",FindingIDs: []string{"f1", "f2"},ErrorCount: 0,diff --git a/internal/ai/patrol_run.go b/internal/ai/patrol_run.goindex 38477446c3..273e2b782f 100644--- a/internal/ai/patrol_run.go+++ b/internal/ai/patrol_run.go@@ -748,7 +748,6 @@ func (p *PatrolService) runPatrolWithTriggerStart(ctx context.Context, trigger TExistingFindings: runStats.existingFindings,RejectedFindings: runStats.rejectedFindings,ResolvedFindings: resolvedCount,- AutoFixCount: 0,FindingsSummary: findingsSummaryStr,FindingIDs: patrolRunFindingIDs(runStats.findingIDs, assessmentsForRun(runStats.aiAnalysis)),ErrorCount: runStats.errors,diff --git a/internal/api/access_tenant_provider.go b/internal/api/access_tenant_provider.goindex 6720dcb374..a043de21c8 100644--- a/internal/api/access_tenant_provider.go+++ b/internal/api/access_tenant_provider.go@@ -30,6 +30,25 @@ func NewTenantRBACProvider(baseDataDir string) *TenantRBACProvider {}}+// PeekManager returns an already-initialized RBAC Manager for the given org+// without creating one. Read-only callers that must not have side effects —+// notably the usage telemetry snapshot — use this so a background read never+// provisions an RBAC store for an org that has never used RBAC.+func (p *TenantRBACProvider) PeekManager(orgID string) (auth.ExtendedManager, bool) {+ if p == nil {+ return nil, false+ }+ orgID = normalizeOrgID(orgID)++ p.mu.RLock()+ defer p.mu.RUnlock()+ manager, exists := p.managers[orgID]+ if !exists || manager == nil {+ return nil, false+ }+ return manager, true+}+// GetManager returns the RBAC Manager for the given org, creating it lazily if needed.// For "default" org: DataDir = baseDataDir (db at {baseDataDir}/rbac/rbac.db — existing location).// For other orgs: DataDir = {baseDataDir}/orgs/{orgID} (db at {baseDataDir}/orgs/{orgID}/rbac/rbac.db).diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex db2f47c1fe..7ba4fb90b9 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -11921,7 +11921,6 @@ func TestContract_PatrolRunRecordJSONSnapshot(t *testing.T) {ExistingFindings: 2,RejectedFindings: 1,ResolvedFindings: 1,- AutoFixCount: 0,FindingsSummary: "All clear",FindingIDs: []string{},ErrorCount: 0,diff --git a/internal/api/rbac_tenant_provider_test.go b/internal/api/rbac_tenant_provider_test.goindex 2bd4d15762..420ecd862d 100644--- a/internal/api/rbac_tenant_provider_test.go+++ b/internal/api/rbac_tenant_provider_test.go@@ -319,3 +319,48 @@ func sqliteManagerPointer(t *testing.T, manager auth.ExtendedManager) *auth.SQLi}return sqliteManager}++// PeekManager is the read-only accessor used by background readers such as the+// usage telemetry snapshot. It must never provision a store, or a periodic read+// would create RBAC state for every org that has never used RBAC.+func TestTenantRBACProvider_PeekManagerDoesNotProvision(t *testing.T) {+ baseDir := t.TempDir()+ provider := NewTenantRBACProvider(baseDir)+ t.Cleanup(func() {+ if err := provider.Close(); err != nil {+ t.Errorf("cleanup close failed: %v", err)+ }+ })++ if manager, ok := provider.PeekManager("default"); ok || manager != nil {+ t.Fatalf("PeekManager returned a manager before one was created: ok=%v manager=%v", ok, manager != nil)+ }+ if got := provider.ManagerCount(); got != 0 {+ t.Fatalf("PeekManager provisioned %d manager(s); it must be side-effect free", got)+ }++ created, err := provider.GetManager("default")+ if err != nil {+ t.Fatalf("GetManager(default) failed: %v", err)+ }++ peeked, ok := provider.PeekManager("default")+ if !ok || peeked == nil {+ t.Fatal("PeekManager did not return the existing manager")+ }+ if peeked != created {+ t.Fatal("PeekManager returned a different manager than GetManager cached")+ }+ if got := provider.ManagerCount(); got != 1 {+ t.Fatalf("manager count = %d, want 1", got)+ }+}++// A nil provider must be safe: the telemetry snapshot runs before every+// dependency is guaranteed to be wired.+func TestTenantRBACProvider_PeekManagerNilProviderIsSafe(t *testing.T) {+ var provider *TenantRBACProvider+ if manager, ok := provider.PeekManager("default"); ok || manager != nil {+ t.Fatalf("nil provider must report no manager: ok=%v manager=%v", ok, manager != nil)+ }+}diff --git a/internal/api/telemetry_licensed_features.go b/internal/api/telemetry_licensed_features.gonew file mode 100644index 0000000000..0cf821db7d--- /dev/null+++ b/internal/api/telemetry_licensed_features.go@@ -0,0 +1,68 @@+package api++import (+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/telemetry"+ "github.com/rcourtman/pulse-go-rewrite/pkg/audit"+ "github.com/rs/zerolog/log"+)++// ApplyLicensedFeatureTelemetrySnapshot adds router-owned, content-free+// adoption counts for licensed features whose state lives behind the router+// rather than in persisted config files.+//+// Everything here is a count or a coarse boolean. Role names, permission sets,+// usernames, audit event types, actors, and audit event detail all stay on the+// install; only "how many" and "is a persistent store active" leave it.+func (r *Router) ApplyLicensedFeatureTelemetrySnapshot(s *telemetry.Snapshot, now time.Time) {+ if r == nil || s == nil {+ return+ }++ since := now.Add(-telemetry.PulseIntelligenceTelemetryWindow)+ for _, orgID := range r.pulseIntelligenceTelemetryOrgIDs() {+ applyRBACAdoption(s, r, orgID)+ applyAuditAdoption(s, orgID, since)+ }+}++// applyRBACAdoption counts operator-authored roles and role assignments.+// Built-in roles ship with every install and are excluded so the count means+// "this operator configured RBAC", not "this install booted".+func applyRBACAdoption(s *telemetry.Snapshot, r *Router, orgID string) {+ manager, ok := r.rbacProvider.PeekManager(orgID)+ if !ok || manager == nil {+ return+ }+ if err := rbacMigrationFailure(manager); err != nil {+ // A degraded store reports a partial picture; counting it would+ // understate adoption without any way to tell from the aggregate.+ log.Debug().Err(err).Str("org_id", orgID).Msg("Skipping RBAC telemetry for degraded store")+ return+ }++ for _, role := range manager.GetRoles() {+ if !role.IsBuiltIn {+ s.RBACCustomRoles+++ }+ }+ s.RBACUserAssignments += len(manager.GetUserAssignments())+}++// applyAuditAdoption records whether a persistent audit store is active and how+// many events it retained inside the telemetry window.+func applyAuditAdoption(s *telemetry.Snapshot, orgID string, since time.Time) {+ logger := getLoggerForOrg(orgID)+ if logger == nil || !isPersistentLogger(logger) {+ return+ }+ s.AuditLoggingPersistent = true++ count, err := logger.Count(audit.QueryFilter{StartTime: &since})+ if err != nil {+ log.Debug().Err(err).Str("org_id", orgID).Msg("Unable to count audit events for telemetry summary")+ return+ }+ s.AuditEvents30d += count+}diff --git a/internal/api/telemetry_licensed_features_test.go b/internal/api/telemetry_licensed_features_test.gonew file mode 100644index 0000000000..7ba992fd90--- /dev/null+++ b/internal/api/telemetry_licensed_features_test.go@@ -0,0 +1,88 @@+package api++import (+ "testing"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/telemetry"+ "github.com/rcourtman/pulse-go-rewrite/pkg/audit"+ "github.com/rcourtman/pulse-go-rewrite/pkg/auth"+)++// The RBAC adoption count must mean "this operator configured RBAC", so the+// built-in roles every install ships with are excluded.+func TestApplyLicensedFeatureTelemetrySnapshot_CountsOnlyOperatorAuthoredRBAC(t *testing.T) {+ provider := NewTenantRBACProvider(t.TempDir())+ t.Cleanup(func() {+ if err := provider.Close(); err != nil {+ t.Errorf("provider close failed: %v", err)+ }+ })++ manager, err := provider.GetManager("default")+ if err != nil {+ t.Fatalf("GetManager(default) failed: %v", err)+ }+ builtInRoles := 0+ for _, role := range manager.GetRoles() {+ if role.IsBuiltIn {+ builtInRoles+++ }+ }+ if builtInRoles == 0 {+ t.Fatal("expected the RBAC store to seed built-in roles")+ }++ if err := manager.SaveRole(auth.Role{ID: "ops-oncall", Name: "Ops On-Call"}); err != nil {+ t.Fatalf("SaveRole failed: %v", err)+ }+ if err := manager.AssignRole("alice", "ops-oncall"); err != nil {+ t.Fatalf("AssignRole failed: %v", err)+ }++ router := &Router{rbacProvider: provider}+ var snap telemetry.Snapshot+ router.ApplyLicensedFeatureTelemetrySnapshot(&snap, time.Now().UTC())++ if snap.RBACCustomRoles != 1 {+ t.Fatalf("custom roles = %d, want 1 (built-ins must not count)", snap.RBACCustomRoles)+ }+ if snap.RBACUserAssignments != 1 {+ t.Fatalf("user assignments = %d, want 1", snap.RBACUserAssignments)+ }+}++// The OSS console audit logger is not a persistent store; reporting it as one+// would overstate audit-logging adoption across the fleet.+func TestApplyLicensedFeatureTelemetrySnapshot_ConsoleAuditLoggerIsNotAdoption(t *testing.T) {+ provider := NewTenantRBACProvider(t.TempDir())+ t.Cleanup(func() {+ if err := provider.Close(); err != nil {+ t.Errorf("provider close failed: %v", err)+ }+ })++ // The audit logger is process-global, so pin it rather than inheriting+ // whatever a sibling test in this package installed.+ previous := audit.GetLogger()+ audit.SetLogger(audit.NewConsoleLogger())+ t.Cleanup(func() { audit.SetLogger(previous) })++ router := &Router{rbacProvider: provider}+ var snap telemetry.Snapshot+ router.ApplyLicensedFeatureTelemetrySnapshot(&snap, time.Now().UTC())++ if snap.AuditLoggingPersistent {+ t.Fatal("console audit logger must not report persistent audit logging")+ }+ if snap.AuditEvents30d != 0 {+ t.Fatalf("audit events = %d, want 0 without a persistent store", snap.AuditEvents30d)+ }+}++func TestApplyLicensedFeatureTelemetrySnapshot_ToleratesNilInputs(t *testing.T) {+ var router *Router+ var snap telemetry.Snapshot+ router.ApplyLicensedFeatureTelemetrySnapshot(&snap, time.Now().UTC())+ (&Router{}).ApplyLicensedFeatureTelemetrySnapshot(nil, time.Now().UTC())+}diff --git a/internal/config/persistence.go b/internal/config/persistence.goindex 52085d4f3f..345d370966 100644--- a/internal/config/persistence.go+++ b/internal/config/persistence.go@@ -2676,7 +2676,6 @@ type PatrolRunRecord struct {ExistingFindings int `json:"existing_findings"`RejectedFindings int `json:"rejected_findings"`ResolvedFindings int `json:"resolved_findings"`- AutoFixCount int `json:"auto_fix_count,omitempty"`FindingsSummary string `json:"findings_summary"`FindingIDs []string `json:"finding_ids"`ErrorCount int `json:"error_count"`@@ -2723,7 +2722,6 @@ type patrolRunRecordJSON struct {ExistingFindings int `json:"existing_findings"`RejectedFindings int `json:"rejected_findings"`ResolvedFindings int `json:"resolved_findings"`- AutoFixCount int `json:"auto_fix_count,omitempty"`FindingsSummary string `json:"findings_summary"`FindingIDs []string `json:"finding_ids"`ErrorCount int `json:"error_count"`@@ -2804,7 +2802,6 @@ func (r PatrolRunRecord) MarshalJSON() ([]byte, error) {ExistingFindings: normalized.ExistingFindings,RejectedFindings: normalized.RejectedFindings,ResolvedFindings: normalized.ResolvedFindings,- AutoFixCount: normalized.AutoFixCount,FindingsSummary: normalized.FindingsSummary,FindingIDs: normalized.FindingIDs,ErrorCount: normalized.ErrorCount,@@ -2856,7 +2853,6 @@ func (r *PatrolRunRecord) UnmarshalJSON(data []byte) error {ExistingFindings: payload.ExistingFindings,RejectedFindings: payload.RejectedFindings,ResolvedFindings: payload.ResolvedFindings,- AutoFixCount: payload.AutoFixCount,FindingsSummary: payload.FindingsSummary,FindingIDs: payload.FindingIDs,ErrorCount: payload.ErrorCount,diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.goindex 91819d99f8..8c6570d875 100644--- a/internal/telemetry/telemetry.go+++ b/internal/telemetry/telemetry.go@@ -137,7 +137,11 @@ const (// schema v4 adds complete approved-action outcome accounting, fixed// pre-dispatch refusal categories, and verified finding-resolution linkage.// Schema v5 adds bounded, content-free notification failure classes.- TelemetrySchemaVersion = 5+ // Schema v6 adds licensed-feature adoption counts (RBAC, audit logging,+ // scheduled reporting, agent profiles, alert-triggered AI) and drops+ // pulse_intelligence_patrol_autofixes_30d, which no code path could ever+ // set to a non-zero value.+ TelemetrySchemaVersion = 6)type installIDRecord struct {@@ -217,15 +221,27 @@ type Ping struct {DiscoveryEnabled bool `json:"discovery_enabled"`NotificationsEnabled bool `json:"notifications_enabled"`AIActionsEnabled bool `json:"ai_actions_enabled"`+ AlertAIEnabled bool `json:"alert_ai_enabled"`ActiveAlerts int `json:"active_alerts"`RelayEnabled bool `json:"relay_enabled"`SSOEnabled bool `json:"sso_enabled"`MultiTenant bool `json:"multi_tenant"`PaidLicense bool `json:"paid_license"`HasAPITokens bool `json:"has_api_tokens"`- UpdateAttempts30d int `json:"update_attempts_30d"`- UpdateSuccesses30d int `json:"update_successes_30d"`- UpdateFailures30d int `json:"update_failures_30d"`++ // Licensed-feature adoption. Counts only: no role names, schedule names,+ // profile names, recipients, report contents, or audit event detail.+ RBACCustomRoles int `json:"rbac_custom_roles"`+ RBACUserAssignments int `json:"rbac_user_assignments"`+ AuditLoggingPersistent bool `json:"audit_logging_persistent"`+ AuditEvents30d int `json:"audit_events_30d"`+ ReportSchedules int `json:"report_schedules"`+ ReportSchedulesEnabled int `json:"report_schedules_enabled"`+ ReportSchedulesRun30d int `json:"report_schedules_run_30d"`+ AgentProfiles int `json:"agent_profiles"`+ UpdateAttempts30d int `json:"update_attempts_30d"`+ UpdateSuccesses30d int `json:"update_successes_30d"`+ UpdateFailures30d int `json:"update_failures_30d"`// Last coarse update failure category; never raw error text.UpdateLastFailureCategory string `json:"update_last_failure_category,omitempty"`@@ -288,7 +304,6 @@ type Ping struct {PulseIntelligencePatrolNewFindings30d int `json:"pulse_intelligence_patrol_new_findings_30d"`PulseIntelligencePatrolInvestigations30d int `json:"pulse_intelligence_patrol_investigations_30d"`PulseIntelligencePatrolResolvedFindings30d int `json:"pulse_intelligence_patrol_resolved_findings_30d"`- PulseIntelligencePatrolAutofixes30d int `json:"pulse_intelligence_patrol_autofixes_30d"`PulseIntelligenceExternalAgentEnabled bool `json:"pulse_intelligence_external_agent_enabled"`PulseIntelligenceExternalAgentUsed30d bool `json:"pulse_intelligence_external_agent_used_30d"`PulseIntelligenceMCPAdapterUsed30d bool `json:"pulse_intelligence_mcp_adapter_used_30d"`@@ -356,12 +371,21 @@ type Snapshot struct {DiscoveryEnabled boolNotificationsEnabled boolAIActionsEnabled bool+ AlertAIEnabled boolActiveAlerts intRelayEnabled boolSSOEnabled boolMultiTenant boolPaidLicense boolHasAPITokens bool+ RBACCustomRoles int+ RBACUserAssignments int+ AuditLoggingPersistent bool+ AuditEvents30d int+ ReportSchedules int+ ReportSchedulesEnabled int+ ReportSchedulesRun30d int+ AgentProfiles intUpdateAttempts30d intUpdateSuccesses30d intUpdateFailures30d int@@ -421,7 +445,6 @@ type Snapshot struct {PulseIntelligencePatrolNewFindings30d intPulseIntelligencePatrolInvestigations30d intPulseIntelligencePatrolResolvedFindings30d int- PulseIntelligencePatrolAutofixes30d intPulseIntelligenceExternalAgentEnabled boolPulseIntelligenceExternalAgentOperationsLoopReady boolPulseIntelligenceExternalAgentUsed30d bool@@ -927,12 +950,21 @@ func applySnapshot(base Ping, fn SnapshotFunc) Ping {ping.DiscoveryEnabled = s.DiscoveryEnabledping.NotificationsEnabled = s.NotificationsEnabledping.AIActionsEnabled = s.AIActionsEnabled+ ping.AlertAIEnabled = s.AlertAIEnabledping.ActiveAlerts = s.ActiveAlertsping.RelayEnabled = s.RelayEnabledping.SSOEnabled = s.SSOEnabledping.MultiTenant = s.MultiTenantping.PaidLicense = s.PaidLicenseping.HasAPITokens = s.HasAPITokens+ ping.RBACCustomRoles = s.RBACCustomRoles+ ping.RBACUserAssignments = s.RBACUserAssignments+ ping.AuditLoggingPersistent = s.AuditLoggingPersistent+ ping.AuditEvents30d = s.AuditEvents30d+ ping.ReportSchedules = s.ReportSchedules+ ping.ReportSchedulesEnabled = s.ReportSchedulesEnabled+ ping.ReportSchedulesRun30d = s.ReportSchedulesRun30d+ ping.AgentProfiles = s.AgentProfilesping.UpdateAttempts30d = s.UpdateAttempts30dping.UpdateSuccesses30d = s.UpdateSuccesses30dping.UpdateFailures30d = s.UpdateFailures30d@@ -992,7 +1024,6 @@ func applySnapshot(base Ping, fn SnapshotFunc) Ping {ping.PulseIntelligencePatrolNewFindings30d = s.PulseIntelligencePatrolNewFindings30dping.PulseIntelligencePatrolInvestigations30d = s.PulseIntelligencePatrolInvestigations30dping.PulseIntelligencePatrolResolvedFindings30d = s.PulseIntelligencePatrolResolvedFindings30d- ping.PulseIntelligencePatrolAutofixes30d = s.PulseIntelligencePatrolAutofixes30dping.PulseIntelligenceExternalAgentEnabled = s.PulseIntelligenceExternalAgentEnabledping.PulseIntelligenceExternalAgentUsed30d = s.PulseIntelligenceExternalAgentUsed30dping.PulseIntelligenceMCPAdapterUsed30d = s.PulseIntelligenceMCPAdapterUsed30ddiff --git a/internal/telemetry/telemetry_test.go b/internal/telemetry/telemetry_test.goindex 868a682890..8a47849422 100644--- a/internal/telemetry/telemetry_test.go+++ b/internal/telemetry/telemetry_test.go@@ -352,9 +352,18 @@ func TestApplySnapshot(t *testing.T) {DiscoveryEnabled: true,NotificationsEnabled: true,AIActionsEnabled: true,+ AlertAIEnabled: true,ActiveAlerts: 2,PaidLicense: true,HasAPITokens: true,+ RBACCustomRoles: 3,+ RBACUserAssignments: 7,+ AuditLoggingPersistent: true,+ AuditEvents30d: 41,+ ReportSchedules: 5,+ ReportSchedulesEnabled: 4,+ ReportSchedulesRun30d: 2,+ AgentProfiles: 9,UpdateAttempts30d: 4,UpdateSuccesses30d: 2,UpdateFailures30d: 1,@@ -399,7 +408,6 @@ func TestApplySnapshot(t *testing.T) {PulseIntelligencePatrolNewFindings30d: 5,PulseIntelligencePatrolInvestigations30d: 6,PulseIntelligencePatrolResolvedFindings30d: 3,- PulseIntelligencePatrolAutofixes30d: 2,PulseIntelligenceExternalAgentEnabled: true,PulseIntelligenceExternalAgentUsed30d: true,PulseIntelligenceMCPAdapterUsed30d: true,@@ -451,12 +459,27 @@ func TestApplySnapshot(t *testing.T) {if !ping.PatrolEnabled || !ping.DiscoveryEnabled || !ping.NotificationsEnabled || !ping.AIActionsEnabled {t.Fatalf("expanded feature flags not applied: %#v", ping)}+ if !ping.AlertAIEnabled {+ t.Fatal("AlertAIEnabled should be true")+ }if !ping.PaidLicense {t.Fatal("PaidLicense should be true")}if !ping.HasAPITokens {t.Fatal("HasAPITokens should be true")}+ if ping.RBACCustomRoles != 3 || ping.RBACUserAssignments != 7 {+ t.Fatalf("RBAC adoption counts not applied: %#v", ping)+ }+ if !ping.AuditLoggingPersistent || ping.AuditEvents30d != 41 {+ t.Fatalf("audit adoption signals not applied: %#v", ping)+ }+ if ping.ReportSchedules != 5 || ping.ReportSchedulesEnabled != 4 || ping.ReportSchedulesRun30d != 2 {+ t.Fatalf("report schedule adoption counts not applied: %#v", ping)+ }+ if ping.AgentProfiles != 9 {+ t.Fatalf("agent profile count not applied: %#v", ping)+ }if ping.UpdateAttempts30d != 4 || ping.UpdateSuccesses30d != 2 || ping.UpdateFailures30d != 1 ||ping.UpdateLastFailureCategory != "download" {t.Fatalf("update telemetry counters not applied: %#v", ping)@@ -502,7 +525,6 @@ func TestApplySnapshot(t *testing.T) {ping.PulseIntelligencePatrolNewFindings30d != 5 ||ping.PulseIntelligencePatrolInvestigations30d != 6 ||ping.PulseIntelligencePatrolResolvedFindings30d != 3 ||- ping.PulseIntelligencePatrolAutofixes30d != 2 ||ping.PulseIntelligenceActionPlans30d != 6 ||ping.PulseIntelligenceApprovalRequests30d != 2 ||ping.PulseIntelligenceRejectedActionDecisions30d != 1 ||diff --git a/pkg/server/server.go b/pkg/server/server.goindex b8348e1494..1267deb1ed 100644--- a/pkg/server/server.go+++ b/pkg/server/server.go@@ -559,11 +559,14 @@ func Run(ctx context.Context, version string) error {snap.PatrolEnabled = aiCfg.IsPatrolEnabled()snap.DiscoveryEnabled = snap.DiscoveryEnabled || aiCfg.IsDiscoveryEnabled()snap.AIActionsEnabled = aiCfg.IsControlEnabled()+ snap.AlertAIEnabled = aiCfg.IsAlertTriggeredAnalysisEnabled()}if relayCfg, err := telemetryPersistence.LoadRelayConfig(); err == nil {snap.RelayEnabled = relayCfg.Enabled}+ applyLicensedFeatureConfigSnapshot(&snap, telemetryPersistence, time.Now().UTC())+// SSO/OIDC status.if ssoCfg, err := telemetryPersistence.LoadSSOConfig(); err == nil && ssoCfg != nil {snap.SSOEnabled = ssoCfg.HasEnabledProviders()@@ -600,6 +603,7 @@ func Run(ctx context.Context, version string) error {now := time.Now().UTC()if router != nil {router.ApplyUpdateTelemetrySnapshot(&snap, now)+ router.ApplyLicensedFeatureTelemetrySnapshot(&snap, now)}var actionSnapshot telemetry.PulseIntelligenceActionSnapshotif router != nil {diff --git a/pkg/server/telemetry_licensed_features.go b/pkg/server/telemetry_licensed_features.gonew file mode 100644index 0000000000..3315a2af78--- /dev/null+++ b/pkg/server/telemetry_licensed_features.go@@ -0,0 +1,37 @@+package server++import (+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/telemetry"+)++// applyLicensedFeatureConfigSnapshot adds content-free adoption counts for+// licensed features whose state lives in persisted config files.+//+// Counts only. Schedule names, delivery recipients, report scope, and profile+// names all stay on the install; the aggregate answers "how many are+// configured and how many ran", nothing about what they contain.+func applyLicensedFeatureConfigSnapshot(snap *telemetry.Snapshot, persistence *config.ConfigPersistence, now time.Time) {+ if snap == nil || persistence == nil {+ return+ }++ if store, err := persistence.LoadReportScheduleStore(); err == nil && store != nil {+ since := now.Add(-telemetry.PulseIntelligenceTelemetryWindow)+ for _, schedule := range store.Schedules {+ snap.ReportSchedules+++ if schedule.Enabled {+ snap.ReportSchedulesEnabled+++ }+ if schedule.LastRunAt != nil && schedule.LastRunAt.After(since) {+ snap.ReportSchedulesRun30d+++ }+ }+ }++ if profiles, err := persistence.LoadAgentProfiles(); err == nil {+ snap.AgentProfiles = len(profiles)+ }+}diff --git a/pkg/server/telemetry_licensed_features_test.go b/pkg/server/telemetry_licensed_features_test.gonew file mode 100644index 0000000000..aaaa9b4358--- /dev/null+++ b/pkg/server/telemetry_licensed_features_test.go@@ -0,0 +1,69 @@+package server++import (+ "testing"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/models"+ "github.com/rcourtman/pulse-go-rewrite/internal/telemetry"+)++func TestApplyLicensedFeatureConfigSnapshot_CountsScheduledReportingAndProfiles(t *testing.T) {+ now := time.Date(2026, 8, 5, 12, 0, 0, 0, time.UTC)+ recent := now.Add(-48 * time.Hour)+ old := now.Add(-(telemetry.PulseIntelligenceTelemetryWindow + time.Hour))++ persistence := config.NewConfigPersistence(t.TempDir())+ if err := persistence.SaveReportScheduleStore(config.ReportScheduleStore{+ Schedules: []config.ReportSchedule{+ {ID: "a", Name: "weekly-capacity", Enabled: true, LastRunAt: &recent},+ {ID: "b", Name: "monthly-uptime", Enabled: true, LastRunAt: &old},+ {ID: "c", Name: "paused", Enabled: false, LastRunAt: &recent},+ {ID: "d", Name: "never-run", Enabled: true},+ },+ }); err != nil {+ t.Fatalf("SaveReportScheduleStore: %v", err)+ }+ if err := persistence.SaveAgentProfiles([]models.AgentProfile{+ {ID: "profile-1", Name: "edge"},+ {ID: "profile-2", Name: "core"},+ }); err != nil {+ t.Fatalf("SaveAgentProfiles: %v", err)+ }++ var snap telemetry.Snapshot+ applyLicensedFeatureConfigSnapshot(&snap, persistence, now)++ if snap.ReportSchedules != 4 {+ t.Fatalf("report schedules = %d, want 4", snap.ReportSchedules)+ }+ if snap.ReportSchedulesEnabled != 3 {+ t.Fatalf("enabled report schedules = %d, want 3", snap.ReportSchedulesEnabled)+ }+ // Only the two schedules whose last run falls inside the window count, and+ // a disabled schedule that still ran recently is one of them.+ if snap.ReportSchedulesRun30d != 2 {+ t.Fatalf("report schedules run in window = %d, want 2", snap.ReportSchedulesRun30d)+ }+ if snap.AgentProfiles != 2 {+ t.Fatalf("agent profiles = %d, want 2", snap.AgentProfiles)+ }+}++func TestApplyLicensedFeatureConfigSnapshot_LeavesCountsZeroWhenNothingConfigured(t *testing.T) {+ var snap telemetry.Snapshot+ applyLicensedFeatureConfigSnapshot(&snap, config.NewConfigPersistence(t.TempDir()), time.Now().UTC())++ if snap.ReportSchedules != 0 || snap.ReportSchedulesEnabled != 0 || snap.ReportSchedulesRun30d != 0 || snap.AgentProfiles != 0 {+ t.Fatalf("unconfigured install must report zeroes: %#v", snap)+ }+}++// A nil persistence must not panic: the telemetry snapshot runs on a timer and+// a failed persistence init cannot be allowed to take the process down.+func TestApplyLicensedFeatureConfigSnapshot_ToleratesNilInputs(t *testing.T) {+ var snap telemetry.Snapshot+ applyLicensedFeatureConfigSnapshot(&snap, nil, time.Now().UTC())+ applyLicensedFeatureConfigSnapshot(nil, config.NewConfigPersistence(t.TempDir()), time.Now().UTC())+}diff --git a/pkg/server/telemetry_pulse_intelligence.go b/pkg/server/telemetry_pulse_intelligence.goindex cc6978e68a..17776879f0 100644--- a/pkg/server/telemetry_pulse_intelligence.go+++ b/pkg/server/telemetry_pulse_intelligence.go@@ -74,12 +74,10 @@ func applyPulseIntelligenceAdoptionSnapshot(snap *telemetry.Snapshot) {snap.PulseIntelligencePatrolRuns30d > 0 ||snap.PulseIntelligencePatrolNewFindings30d > 0 ||snap.PulseIntelligencePatrolInvestigations30d > 0 ||- snap.PulseIntelligencePatrolResolvedFindings30d > 0 ||- snap.PulseIntelligencePatrolAutofixes30d > 0+ snap.PulseIntelligencePatrolResolvedFindings30d > 0patrolIssueEvidenceCount := snap.PulseIntelligencePatrolNewFindings30d +snap.PulseIntelligencePatrolInvestigations30d +- snap.PulseIntelligencePatrolResolvedFindings30d +- snap.PulseIntelligencePatrolAutofixes30d+ snap.PulseIntelligencePatrolResolvedFindings30dpatrolIssueEvidenceActive := patrolIssueEvidenceCount > 0assistantCollaborationCount := snap.PulseIntelligenceAssistantContextAICalls30d +snap.PulseIntelligenceAssistantToolCalls30d@@ -235,9 +233,6 @@ func applyPulseIntelligencePatrolRunSnapshot(snap *telemetry.Snapshot, persistenif run.NewFindings > 0 {snap.PulseIntelligencePatrolNewFindings30d += run.NewFindings}- if run.AutoFixCount > 0 {- snap.PulseIntelligencePatrolAutofixes30d += run.AutoFixCount- }}}diff --git a/pkg/server/telemetry_pulse_intelligence_test.go b/pkg/server/telemetry_pulse_intelligence_test.goindex ec96f0955c..2174fb6880 100644--- a/pkg/server/telemetry_pulse_intelligence_test.go+++ b/pkg/server/telemetry_pulse_intelligence_test.go@@ -27,9 +27,9 @@ func TestApplyPulseIntelligenceTelemetrySnapshot_AggregatesContentFreeLoopCountst.Fatalf("SaveAIUsageHistory: %v", err)}if err := persistence.SavePatrolRunHistory([]config.PatrolRunRecord{- {StartedAt: recent.Add(-5 * time.Minute), CompletedAt: recent, NewFindings: 2, AutoFixCount: 1},+ {StartedAt: recent.Add(-5 * time.Minute), CompletedAt: recent, NewFindings: 2},{StartedAt: recent.Add(-time.Hour), CompletedAt: recent.Add(-30 * time.Minute), NewFindings: 3},- {StartedAt: old, CompletedAt: old, NewFindings: 99, AutoFixCount: 99},+ {StartedAt: old, CompletedAt: old, NewFindings: 99},}); err != nil {t.Fatalf("SavePatrolRunHistory: %v", err)}@@ -150,9 +150,6 @@ func TestApplyPulseIntelligenceTelemetrySnapshot_AggregatesContentFreeLoopCountsif snap.PulseIntelligencePatrolResolvedFindings30d != 2 {t.Fatalf("patrol resolved findings = %d, want 2", snap.PulseIntelligencePatrolResolvedFindings30d)}- if snap.PulseIntelligencePatrolAutofixes30d != 1 {- t.Fatalf("patrol autofixes = %d, want 1", snap.PulseIntelligencePatrolAutofixes30d)- }if !snap.PulseIntelligenceExternalAgentEnabled || !snap.PulseIntelligenceExternalAgentUsed30d {t.Fatalf("external-agent booleans = enabled %v used %v, want true/true", snap.PulseIntelligenceExternalAgentEnabled, snap.PulseIntelligenceExternalAgentUsed30d)}