borg-backup-ui
borg-backup-ui copied to clipboard
Reduce monolithic HTTP handler and centralize shared safety helpers
Summary
Follow-up from the Borg Backup UI code review on 2026-07-01.
This issue tracks low-priority maintainability work. It should not become a large uncontrolled refactor; changes should be incremental and tied to concrete safety or testability improvements.
Subtasks
- [ ] Extract schedule validation helpers so UI/API and crontab generation use the same validation path.
- [ ] Extract shared secret-masking helpers and reuse them across API errors, logs, notifications, and client logs.
- [ ] Extract shared Borg subprocess execution helpers for timeouts, output streaming, and sanitization.
- [ ] Keep
borg_backup_ui.pysmaller by moving cohesive API groups into existingapi/*modules when touching those areas. - [ ] Avoid framework changes, database changes, or broad directory reshuffling.
Review references
borg_backup_ui.pycentral request routing, auth, restore, job, settings, and UI handlingruntime/lib/borg_runner.pyBorg subprocess patternsapi/restore_api.py,api/check_api.py,api/schedule_api.py
Risk
The current structure works, but repeated safety logic makes future security fixes easier to miss. Incremental extraction improves testability without changing the plugin architecture.
Acceptance criteria
- No behavioral change unless explicitly covered by a related bug/security issue.
- Shared helpers have focused unit tests.
- The existing architecture and plugin layout remain intact.