Skip to content

[PB-7100] refactor: list device folder children with folder content when deleting backups - #547

Merged
AlexisMora merged 1 commit into
mainfrom
refactor/pb-7100-delete-device-backups-folder-content
Dec 4, 2026
Merged

AlexisMora merged 1 commit into
mainfrom
refactor/pb-7100-delete-device-backups-folder-content

Conversation

@AlexisMora

@AlexisMora AlexisMora commented Dec 3, 2026 •

Copy link
Copy Markdown

What is Changed / Added


When the user deletes the backups of a device, the client trashes each backup and then trashes any other folder left under the device folder. To find those leftover folders it used to download the whole tree of the device with GET /folders/{uuid}/tree, even though it only looked at the direct children. It now gets them from GET /folders/content/{uuid}, which returns only the device folder and its direct children. The behaviour is the same as before: every folder under the device ends up in the trash, the device folder itself is kept, and if the request fails we log it and skip the cleanup.

I have also detected that the windows client does not have the same behaviour. the Windows app only trashes the backups that are currently enabled. Disabled backups, and any folder under the device that isn't in the local backup list, stay in the cloud. I will be adding a new tech deb task PB-7200 to implement it so that we keep consistency between platforms

This is the second 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. The content endpoint is already used to list the backups of a device, so this removes the second remaining use of the tree endpoint without adding a new dependency.

Summary by CodeRabbit

  • Bug Fixes
    • Device backup deletion now checks the device’s folders directly, preserving folders that contain backups and avoiding trashing folders when folder details cannot be fetched.

…ng backups

Replaces the GET /folders/{uuid}/tree call in the delete device backups flow
with GET /folders/content/{uuid}. Only the direct children of the device
folder are needed to find the folders left to trash.
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

deleteDeviceBackups now fetches the device folder and checks its children to select folders for deletion. Tests cover non-backup folders, children that all belong to backups, and fetch failures.

Changes: Device backup deletion

Layer / File(s) Summary
Fetch and filter device folder
src/backend/features/backup/delete-device-backups.ts, src/backend/features/backup/delete-device-backups.test.ts
The function fetches the device folder and filters its children instead of using a backup-tree snapshot. Tests check folder selection and confirm that a fetch error is logged without trashing folders.

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

Change: Refactor

Possibly related PRs

Suggested reviewers: egalvis27, victor-ferro

Merge Risk: Minimal · up to 66b98

Device backup deletion now fetches only the device folder and its direct children instead of the full tree. Cleanup behavior is described as unchanged, and no concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: deleting device backups now lists device folder children with the folder content endpoint instead of the tree endpoint. The raw summary and objectives confirm this swa…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: deleting device backups now lists device folder children with the folder content endpoint instead of the tree endpoint. The raw summary and objectives confirm this swap in delete-device-backups.ts and its test. The title uses the refactor prefix and a ticket ID, and it is specific enough for a teammate scanning history.

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: 5505be21-4e6a-4ad8-9be9-bfa500508af4
Commits

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

Files selected for processing: 2

  • src/backend/features/backup/delete-device-backups.test.ts
  • src/backend/features/backup/delete-device-backups.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.

@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

@AlexisMora
AlexisMora marked this pull request as ready for review December 3, 2026 14:15
@AlexisMora
AlexisMora merged commit bec7b79 into main Dec 4, 2026
16 checks passed
@AlexisMora
AlexisMora deleted the refactor/pb-7100-delete-device-backups-folder-content 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