Skip to content

[PB-7100] refactor: stop deleting the remote folder when disabling a backup - #546

Merged
AlexisMora merged 2 commits into
mainfrom
refactor/pb-7100-disable-backup-folder-stats
Dec 4, 2026
Merged

AlexisMora merged 2 commits into
mainfrom
refactor/pb-7100-disable-backup-folder-stats

Conversation

@AlexisMora

@AlexisMora AlexisMora commented Dec 3, 2026 •

Copy link
Copy Markdown

What is Changed / Added

In this pull request 2 things are being done:
Previously, the client downloaded the whole folder tree with GET /folders/{uuid}/tree and moved the backup folder to the trash if it was empty.

Now We have removed both steps so the disable flow no longer makes any request to the server and is no backup is being trashed when disabling it. We took this decision so that it follows the same business logic of the windows client, check the reference here in disableBackup

This is the first of a few smaller PRs that replace #519.

Why

GET /folders/{uuid}/tree is being deprecated because large trees were causing out of memory errors on the backend, and it will start returning 410 Gone in 2.7.2. Rather than moving the empty check to another endpoint, we dropped it so that disabling a backup behaves the same as in the Windows app, where it never deletes anything on the server. An empty backup folder left behind is harmless, and it is still removed when the user deletes the backups from that device.

Summary by CodeRabbit

  • Behavior Changes
    • Disabling a backup now marks it as disabled without deleting it, even when its folder is empty. The operation also no longer checks the folder’s contents, so errors from fetching a snapshot or deleting the backup are not raised during this action.

Replaces the GET /folders/{uuid}/tree call in the disable flow with
GET /folders/{uuid}/stats. If the stats request fails the backup is kept.
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Disabling a backup now saves its disabled state without fetching the folder snapshot or deleting the backup. The test verifies the state change and confirms that deletion is not called.

Changes: Disable backup

Layer / File(s) Summary
Save disabled backup state
src/backend/features/backup/disable-backup.ts, src/backend/features/backup/disable-backup.test.ts
disableBackup saves the updated backup list without fetching a folder snapshot or deleting the backup. The test checks that the backup is disabled and deleteBackup is not called. Snapshot-fetch and logging tests were removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

Suggested reviewers: egalvis27

Merge Risk: Minimal · up to d1eeb

Disabling a backup now only saves the disabled state locally and no longer contacts the server or deletes the remote folder. No merge-blocking risk was found. An empty remote folder may remain until the user deletes backups from that device.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: disabling a backup no longer deletes the remote folder. The raw summary says the disable flow stops fetching the folder snapshot and stops deleting the backup when its…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: disabling a backup no longer deletes the remote folder. The raw summary says the disable flow stops fetching the folder snapshot and stops deleting the backup when its size is zero, and the objectives confirm the change marks the backup disabled in local configuration instead. The title's "refactor:" prefix and ticket ID are conventional and do not reduce its accuracy.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 437beab1-362b-4652-bb89-f29721649821
Commits

Reviewing files that changed from the base of the PR and between 846af1f and d1eeb32.

Files selected for processing: 2

  • src/backend/features/backup/disable-backup.test.ts
  • src/backend/features/backup/disable-backup.ts
Files with no reviewable changes: 1

  • src/backend/features/backup/disable-backup.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Disabling a backup now only marks it as disabled in the local config,
matching the Windows app. This removes the GET /folders/{uuid}/tree call
from the disable flow without needing a replacement endpoint.
@AlexisMora AlexisMora changed the title [PB-7100] refactor: check if a backup is empty on disable using folder stats [PB-7100] refactor: stop deleting the remote folder when disabling a backup Dec 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

@AlexisMora
AlexisMora merged commit 63ab01f into main Dec 4, 2026
16 checks passed
@AlexisMora
AlexisMora deleted the refactor/pb-7100-disable-backup-folder-stats branch December 4, 2026 12:49
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