Skip to content

feat: dashboard stats fallback for externally managed repos - #1322

Open
Yeraze wants to merge 2 commits into
garethgeorge:mainfrom
Yeraze:dashboard-stats-fallback
Open

feat: dashboard stats fallback for externally managed repos#1322
Yeraze wants to merge 2 commits into
garethgeorge:mainfrom
Yeraze:dashboard-stats-fallback

Conversation

@Yeraze

@Yeraze Yeraze commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Closes issue #1257

Screenshot 2026-07-24 at 12 34 52 PM

For repos whose restic backups are managed outside of backrest (no plans configured), the dashboard repo cards currently show empty stats. This change makes the dashboard fall back to the most recent OperationStats data when no OperationBackup operations exist for a repo:

  • Populates ProtectedBytes from RepoStats.TotalSize and TotalSnapshots from RepoStats.SnapshotCount
  • No frontend changes needed — RepoCard already renders protectedBytes when > 0
  • Fallback only applies when ProtectedBytes == 0 (i.e., no backup operations have set it), so repos with plans are unaffected

Changes

  • internal/api/summarydashboard.go — During the oplog walk, also capture the most recent OperationStats per repo GUID. After finalize, apply the fallback for repos without backup data.
  • internal/api/backresthandler_test.go — New TestGetSummaryDashboardStatsFallback verifying the fallback behavior for a repo with only stats operations and no backups.

Test plan

  • All 6 TestGetSummaryDashboard* tests pass (5 existing + 1 new)
  • Manual: add a repo without any plan, trigger stats, verify dashboard shows repo size

For repos whose backups are managed outside of backrest, the dashboard
now populates ProtectedBytes and TotalSnapshots from the most recent
OperationStats when no OperationBackup data is available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Yeraze

Yeraze commented Jul 24, 2026

Copy link
Copy Markdown
Author

Interested people can test this by pulling the container from ghcr.io/yeraze/backrest:dev

@CLAassistant

CLAassistant commented Jul 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

… repos

For repos whose backups are managed outside backrest, the dashboard now:
- Shows Check/Prune/Forget/Stats operations in the 30-day history strip
  instead of showing every day as "Missing"
- Displays "Managed externally" state label (blue) instead of
  "No backups yet" when the repo has snapshots but no backup operations
- Adds observeMaintenance() to track non-backup ops in per-day buckets
  without affecting backup-specific counters

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jogotcha

Copy link
Copy Markdown

Interesting people can test this by pulling the container from ghcr.io/yeraze/backrest:dev

works fine for me, thanks

@egmont1227

Copy link
Copy Markdown

like @Yeraze , i would like to see this merged as well @garethgeorge

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.

4 participants