Fix per-notifier error/warning count drift in dispatch chain#213
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR refactors the backup orchestrator's notification dispatch to introduce a snapshot boundary that captures pre-notification state before issuing channel notifications, centralizes log-count parsing through a shared refresh helper, and simplifies notification conversion to trust precomputed snapshots rather than re-reading logs. ChangesPre-Notification Issue Snapshot Boundary
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
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.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Complexity | 2 medium |
🟢 Metrics 58 complexity · 5 duplication
Metric Results Complexity 58 Duplication 5
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@paolostivanin I made a change and moved the snapshot to a later time. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/orchestrator/extensions.go`:
- Around line 129-145: In refreshLogIssuesFromFile, ParseLogCounts currently
unconditionally overwrites BackupStats.ErrorCount and WarningCount; change this
so parsed counts only replace the existing stats if they are > 0 (or if the
existing value is 0 and parsed >0), e.g. use the returned
errorCount/warningCount to update stats.ErrorCount and stats.WarningCount only
when those parsed values are positive (preserving pre-seeded counts such as
ErrorCount=1); keep the existing behavior for LogCategories controlled by
includeCategories and the ParseLogCounts call.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 74144e62-32ac-4364-9d10-b3c7b4d475f5
📒 Files selected for processing (7)
internal/orchestrator/additional_helpers_test.gointernal/orchestrator/backup_run_helpers.gointernal/orchestrator/backup_run_phases.gointernal/orchestrator/extensions.gointernal/orchestrator/notification_adapter.gointernal/orchestrator/notification_adapter_test.gointernal/orchestrator/orchestrator.go
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
sorry I could answer only now! Thanks again for the fast feedback and merge 😄 |
* deps: update Go modules and GitHub Actions Updates golang.org/x/crypto, x/term, x/text and the dependency-review/setup-node Actions with regenerated checksums * Simplify archiver drain receive Use a plain channel receive when draining the tar writer goroutine after compressor start failure * Update CONFIGURATION.md * Avoid copying exec info once in tests Store exec info cache state behind pointers so tests can override and restore it without copying sync.Once * Remove misleading mount guard status wrapper Call isMounted directly from guardMountPoint and remove the pass-through helper with misleading unmount wording * Remove duplicate install template sanitization 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 (#213) * 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> * Fix golangci-lint findings * Format PBS API apply tests * ci: bump github/codeql-action from 4.35.4 to 4.35.5 in the actions-updates 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> * Clarify dry-run stats finalization Keep common backup finalization separate from dry-run issue parsing. * Clarify issue exit code policy Remove dead success handling and cover issue promotion rules. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Paolo Stivanin <paolostivanin@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.
Summary by CodeRabbit
Bug Fixes & Improvements
Tests