borg-backup-ui icon indicating copy to clipboard operation
borg-backup-ui copied to clipboard

Reduce monolithic HTTP handler and centralize shared safety helpers

Open borg-codex-bot opened this issue 5 months ago • 0 comments

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.py smaller by moving cohesive API groups into existing api/* modules when touching those areas.
  • [ ] Avoid framework changes, database changes, or broad directory reshuffling.

Review references

  • borg_backup_ui.py central request routing, auth, restore, job, settings, and UI handling
  • runtime/lib/borg_runner.py Borg subprocess patterns
  • api/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.

borg-codex-bot avatar Jul 01 '26 13:07 borg-codex-bot