Skip to content

Sync dev to main#215

Closed
tis24dev wants to merge 10 commits into
mainfrom
dev
Closed

Sync dev to main#215
tis24dev wants to merge 10 commits into
mainfrom
dev

Conversation

@tis24dev
Copy link
Copy Markdown
Owner

@tis24dev tis24dev commented May 18, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved email delivery for Proxmox Mail Forward method to gracefully proceed when recipient detection fails
  • Documentation

    • Added documentation for EMAIL_DELIVERY_METHOD pmf alias variants (proxmox, proxmox-notifications, proxmox-mail-forward)
  • Chores

    • Updated Go dependencies (crypto, term, text, and sys packages)
    • Updated GitHub Actions workflow versions

Review Change Stack

tis24dev and others added 10 commits May 13, 2026 22:07
Updates golang.org/x/crypto, x/term, x/text and the dependency-review/setup-node Actions with regenerated checksums
Use a plain channel receive when draining the tar writer goroutine after compressor start failure
Store exec info cache state behind pointers so tests can override and restore it without copying sync.Once
Call isMounted directly from guardMountPoint and remove the pass-through helper with misleading unmount wording
Keep runtime-derived env key removal only at the final write point in the install config flow
* Fix per-notifier error/warning count drift in dispatch chain

Snapshot ErrorCount, WarningCount and LogCategories into BackupStats once
at backup completion (finalizeBackupStats / parseFailedBackupLogCounts)
and have convertBackupStatsToNotificationData read them as-is. Re-parsing
the log file per-notifier was over-counting warnings emitted by earlier
notifiers in the dispatch chain, so e.g. Pushover reported 5 warnings
while Email reported 0 on the same run.

* Place issue snapshot at notification boundary

* Align exit code with notification snapshot

---------

Co-authored-by: tis24dev <github@tis24.it>
…dates group (#214)

ci: bump github/codeql-action in the actions-updates group

Bumps the actions-updates group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 4.35.4 to 4.35.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@68bde55...9e0d7b8)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd9feb3e-315a-4d9e-9091-1d1be6506572

📥 Commits

Reviewing files that changed from the base of the PR and between 56b6a95 and 0e55cf1.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (21)
  • .github/workflows/dependabot-automerge.yml
  • .github/workflows/dependency-review.yml
  • .github/workflows/security-ultimate.yml
  • cmd/proxsave/base_dir_test.go
  • cmd/proxsave/install.go
  • cmd/proxsave/runtime_helpers.go
  • docs/CONFIGURATION.md
  • go.mod
  • internal/backup/archiver.go
  • internal/notify/email.go
  • internal/orchestrator/additional_helpers_test.go
  • internal/orchestrator/backup_run_helpers.go
  • internal/orchestrator/backup_run_phases.go
  • internal/orchestrator/encryption_exported_test.go
  • internal/orchestrator/extensions.go
  • internal/orchestrator/extensions_additional_test.go
  • internal/orchestrator/mount_guard.go
  • internal/orchestrator/notification_adapter.go
  • internal/orchestrator/notification_adapter_test.go
  • internal/orchestrator/orchestrator.go
  • internal/orchestrator/pbs_api_apply_test.go

📝 Walkthrough

Walkthrough

The pull request refactors the notification dispatch phase to capture backup statistics (error counts, warning counts, and log categories) once before any notifier is invoked, replacing per-notifier log re-parsing with consistent snapshot values. BackupStats gains a LogCategories field. Four new helper functions in extensions.go orchestrate snapshot and exit-code aggregation. Email delivery method pmf gains special handling for empty recipients. Supporting changes update dependencies, document pmf aliases, simplify helpers, and improve test infrastructure.

Changes

Notification Snapshot and Exit-Code Aggregation

Layer / File(s) Summary
BackupStats data model extension
internal/orchestrator/orchestrator.go
BackupStats struct gains LogCategories []notify.LogCategory field and new internal/notify import to carry structured log-category metadata alongside existing counters and log file path.
Notification snapshot and exit-code helpers
internal/orchestrator/extensions.go
Four new internal helpers (startNotificationGroup, snapshotPreNotificationIssues, refreshLogIssuesFromFile, applyIssueExitCode) consolidate pre-notification snapshot and exit-code aggregation logic. dispatchNotificationsAndLogs is updated to wrap notification dispatch with the group flow, ensuring all notifiers see consistent pre-notification totals. Comment in DispatchEarlyErrorNotification is clarified.
Notification conversion to use snapshot values
internal/orchestrator/notification_adapter.go, internal/orchestrator/notification_adapter_test.go
convertBackupStatsToNotificationData switches from re-parsing the log file per call to using stats.ErrorCount/stats.WarningCount directly and snapshot-copying stats.LogCategories. Tests enforce that counts/categories are sourced only from BackupStats, with a new regression test verifying the converter does not re-read LogFilePath.
Email delivery method handling for pmf
internal/notify/email.go
EmailNotifier.Send recipient auto-detection now special-cases pmf delivery method: when recipient is empty, pmf proceeds with warnings (recipient only used for To: header), while relay/sendmail delivery methods skip and return failure.
Backup stats log parsing refactoring
internal/orchestrator/backup_run_helpers.go, internal/orchestrator/backup_run_phases.go
parseFailedBackupLogCounts delegates to the new refreshLogIssuesFromFile helper. finalizeBackupStats introduces dry-run-only log parsing via snapshot helpers and applyIssueExitCode instead of direct ParseLogCounts calls.
Test infrastructure for snapshot validation
internal/orchestrator/additional_helpers_test.go, internal/orchestrator/extensions_additional_test.go
stubNotifierChannel test double is enhanced to snapshot error/warning counts, category count, and exit code from BackupStats. New warningStorageTarget test double logs warnings before snapshot. New test TestDispatchPostBackupSnapshotsIssuesImmediatelyBeforeNotifications validates pre-notification snapshot consistency across notifiers. New test TestDispatchEarlyErrorNotificationPreservesSyntheticIssueWithLogFile verifies early error preservation with log files.
Configuration, dependencies, and workflow updates
docs/CONFIGURATION.md, go.mod, .github/workflows/*
docs/CONFIGURATION.md documents pmf aliases. go.mod updates golang.org/x/crypto, golang.org/x/term, golang.org/x/text, and golang.org/x/sys. Three GitHub Actions workflows update action pins: actions/setup-node, actions/dependency-review-action, and github/codeql-action (three steps).
Singleton globals and minor refactorings
cmd/proxsave/runtime_helpers.go, cmd/proxsave/base_dir_test.go, cmd/proxsave/install.go, internal/orchestrator/mount_guard.go, internal/backup/archiver.go, internal/orchestrator/encryption_exported_test.go, internal/orchestrator/pbs_api_apply_test.go
Singleton cache storage in getExecInfo and test helper forceDetectedBaseDirForTest switch to pointer-based storage. mount_guard.go eliminates thin ensureGuardTargetUnmounted wrapper. archiver.go simplifies errChan consume. install.go removes pre-skip RemoveRuntimeDerivedEnvKeys call. Test cleanup uses t.Cleanup instead of defer. Test formatting aligns whitespace.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • tis24dev/proxsave#213: Identical notification snapshot/aggregation refactoring in internal/orchestrator, adding BackupStats.LogCategories, snapshot helpers, and conversion test updates.
  • tis24dev/proxsave#198: Overlapping changes to internal/notify/email.go for EmailNotifier recipient-empty handling and pmf-vs-relay delivery method control flow.
  • tis24dev/proxsave#212: Direct overlap in cmd/proxsave/base_dir_test.go refactoring forceDetectedBaseDirForTest to use pointer-based global overrides.

Poem

A rabbit hops through stats that now align,
No more re-parsing—snapshots in one line.
From early errors to notification's call,
Each notifier sees the same totals for all. 🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

go.mod

PackageVersionLicenseIssue Type
golang.org/x/term0.43.0NullUnknown License
Allowed Licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, LicenseRef-scancode-google-patent-license-golang

OpenSSF Scorecard

PackageVersionScoreDetails
actions/github/codeql-action/analyze 9e0d7b8d25671d64c341c19c0152d693099fb5ba UnknownUnknown
actions/github/codeql-action/init 9e0d7b8d25671d64c341c19c0152d693099fb5ba UnknownUnknown
actions/github/codeql-action/upload-sarif 9e0d7b8d25671d64c341c19c0152d693099fb5ba UnknownUnknown
gomod/golang.org/x/crypto 0.51.0 UnknownUnknown
gomod/golang.org/x/sys 0.44.0 UnknownUnknown
gomod/golang.org/x/term 0.43.0 UnknownUnknown
gomod/golang.org/x/text 0.37.0 UnknownUnknown

Scanned Files

  • .github/workflows/security-ultimate.yml
  • go.mod

@tis24dev tis24dev closed this May 18, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 79.24528% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/orchestrator/extensions.go 81.25% 4 Missing and 2 partials ⚠️
internal/orchestrator/backup_run_phases.go 63.63% 3 Missing and 1 partial ⚠️
internal/notify/email.go 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants