Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

fix: clean up debug logging and fix flaky encryption test

rcourtmanf67e7b3e97ae
diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx
index 8aa2e4228f..8826113062 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -308,7 +308,7 @@ export function Dashboard(props: DashboardProps) {
// Listen for metadata changes from AI or other sources
const handleMetadataChanged = (event: Event) => {
const customEvent = event as CustomEvent;
- console.log('[Dashboard] Metadata changed event received:', customEvent.detail);
+ logger.debug('[Dashboard] Metadata changed event received', customEvent.detail);
// Handle optimistic update if payload is present - this fixes the "guest url not appearing straight away" issue
if (customEvent.detail?.payload) {
@@ -339,7 +339,7 @@ export function Dashboard(props: DashboardProps) {
refreshGuestMetadata();
};
- console.log('[Dashboard] Adding pulse:metadata-changed listener');
+ logger.debug('[Dashboard] Adding pulse:metadata-changed listener');
window.addEventListener('pulse:metadata-changed', handleMetadataChanged);
// Note: SolidJS onMount doesn't support cleanup return, so we rely on component unmount
diff --git a/frontend-modern/src/components/SetupWizard/steps/CompleteStep.tsx b/frontend-modern/src/components/SetupWizard/steps/CompleteStep.tsx
index b6e9cfd4c3..c4b65f73e0 100644
--- a/frontend-modern/src/components/SetupWizard/steps/CompleteStep.tsx
+++ b/frontend-modern/src/components/SetupWizard/steps/CompleteStep.tsx
@@ -35,7 +35,6 @@ export const CompleteStep: Component<CompleteStepProps> = (props) => {
const checkForAgents = async () => {
try {
- console.log('[CompleteStep] Checking for agents with token:', props.state.apiToken?.slice(0, 8) + '...');
const response = await fetch('/api/state', {
headers: {
@@ -43,10 +42,7 @@ export const CompleteStep: Component<CompleteStepProps> = (props) => {
},
});
- console.log('[CompleteStep] API response status:', response.status);
-
if (!response.ok) {
- console.log('[CompleteStep] API returned non-OK status, skipping');
return;
}
@@ -54,8 +50,6 @@ export const CompleteStep: Component<CompleteStepProps> = (props) => {
const nodes = state.nodes || [];
const hosts = state.hosts || [];
- console.log('[CompleteStep] Received:', { nodes: nodes.length, hosts: hosts.length, hostNames: hosts.map((h: any) => h.hostname || h.displayName) });
-
// Check if we have new connections
const totalAgents = nodes.length + hosts.length;
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index 3cebf7c275..c616f7e650 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -3520,9 +3520,13 @@ function OverviewTab(props: {
const activeFindings: Finding[] = [];
const resolvedFindings: Finding[] = [];
+ // Only include warning+ severity findings (info/watch are filtered out)
+ const isDisplayableSeverity = (severity: string) =>
+ severity === 'warning' || severity === 'critical';
+
(run.finding_ids || []).forEach(id => {
const finding = findingsMap.get(id);
- if (finding) {
+ if (finding && isDisplayableSeverity(finding.severity)) {
if (finding.resolved_at) {
resolvedFindings.push(finding);
} else {
diff --git a/internal/ai/patrol.go b/internal/ai/patrol.go
index 9b2894e891..d60c167240 100644
--- a/internal/ai/patrol.go
+++ b/internal/ai/patrol.go
@@ -770,7 +770,10 @@ func (p *PatrolService) runPatrol(ctx context.Context) {
} else {
runStats.existingFindings++
}
- runStats.findingIDs = append(runStats.findingIDs, f.ID)
+ // Only track warning+ severity finding IDs in the run record
+ if f.Severity == FindingSeverityWarning || f.Severity == FindingSeverityCritical {
+ runStats.findingIDs = append(runStats.findingIDs, f.ID)
+ }
return isNew
}
diff --git a/internal/config/persistence_fail_test.go b/internal/config/persistence_fail_test.go
index 05b48c5fdd..35c2f17c88 100644
--- a/internal/config/persistence_fail_test.go
+++ b/internal/config/persistence_fail_test.go
@@ -9,6 +9,22 @@ import (
func TestNewConfigPersistenceFailsWhenEncryptedDataPresentWithoutKey(t *testing.T) {
dir := t.TempDir()
+ // The crypto package tries to migrate keys from /etc/pulse/.encryption.key
+ // We need to temporarily rename it if it exists to properly test this scenario
+ systemKeyPath := "/etc/pulse/.encryption.key"
+ backupKeyPath := "/etc/pulse/.encryption.key.test-backup"
+
+ if _, err := os.Stat(systemKeyPath); err == nil {
+ // Key exists - temporarily rename it
+ if err := os.Rename(systemKeyPath, backupKeyPath); err != nil {
+ t.Skipf("cannot rename system encryption key for test isolation: %v", err)
+ }
+ t.Cleanup(func() {
+ // Restore the key after test
+ os.Rename(backupKeyPath, systemKeyPath)
+ })
+ }
+
// Simulate existing encrypted data without providing the encryption key.
if err := os.WriteFile(filepath.Join(dir, "nodes.enc"), []byte("ciphertext"), 0600); err != nil {
t.Fatalf("failed to write simulated encrypted file: %v", err)