Skip to content

refactor(archive): peel diff and rename into views/archive/ helpers (Phase 4 pt 2)#2525

Open
ebuzerdrmz44 wants to merge 1 commit into
borgbase:masterfrom
ebuzerdrmz44:refactor/archive-tab-split
Open

refactor(archive): peel diff and rename into views/archive/ helpers (Phase 4 pt 2)#2525
ebuzerdrmz44 wants to merge 1 commit into
borgbase:masterfrom
ebuzerdrmz44:refactor/archive-tab-split

Conversation

@ebuzerdrmz44

@ebuzerdrmz44 ebuzerdrmz44 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 4 part 2 of the Archive tab refactor. Part 1 (#2519) converted the table to QAbstractTableModel + QTableView and peeled the first two operations (mount/unmount, extract) into views/archive/ collaborator classes. This PR continues that exact pattern, peeling diff and rename off the orchestrator into focused helpers:

  • views/archive/archive_diff.pyArchiveDiff (diff_action, list_diff_result, show_diff_result)
  • views/archive/archive_rename.pyArchiveRename (cell_double_clicked, on_name_edited, _revert_name, rename_result)

ArchiveTab stays the container (populate, selection, context-menu wiring, refresh, status, prune settings). Pure structural move — no behavior change.

Helpers follow the existing ArchiveExtract / ArchiveMount convention from #2519. The context menu stays in ArchiveTab since it just dispatches to the other helpers.

delete and check/compact/prune are held back for a follow-up PR so the helper shape can be reviewed here first. Happy to redirect the decomposition — this is the cheap point to do it.

Rebased onto master. #2519 has merged, so this branch is now rebased onto it and the diff is exactly the part-2 work:

  • src/vorta/views/archive/archive_diff.py (new)
  • src/vorta/views/archive/archive_rename.py (new)
  • the src/vorta/views/archive_tab.py deltas (and the two test call-site updates)

Related Issue

Part of #2361 (Phase 4 — split large tabs into parts). Builds on #2519.

Motivation and Context

archive_tab.py was a large orchestrator mixing the table view with diff, rename, delete and repo-maintenance logic. #2361 calls for converting the table to a model (done in #2519) and then peeling the remaining operations into focused helpers, keeping ArchiveTab as the container. This PR does that for diff and rename, making each operation independently readable and shrinking the orchestrator, with no change to runtime behavior.

How Has This Been Tested?

uv run pytest tests/unit/test_archives.py tests/unit/test_diff.py — 42 passed. ruff check + ruff format --check clean. Test call-sites updated to the new entry points (tab.archive_diff.diff_action, tab.archive_rename.{cell_double_clicked,rename_result}); _resultwindow is still set on the tab so the diff tests are otherwise unchanged. CI runs the full Borg matrix via nox.

Screenshots (if appropriate):

N/A — no UI changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@ebuzerdrmz44

Copy link
Copy Markdown
Contributor Author

@m3nu No rush on this , it's stacked on #2519, so that one's the real dependency (its commits show in this diff until it merges; the new work here is just archive_diff.py,archive_rename.py, and the archive_tab.py ).

Flagging it now mainly for a shape check: it follows the ArchiveExtract/ArchiveMount collaborator pattern from #2519, and I kept the context menu in ArchiveTab since it's just glue over the other helpers. I'm holding delete + check/compact/prune for a follow- up so the pattern can be settled here first.

Follows the stateless ArchiveExtract/ArchiveMount collaborator pattern: helpers
hold only self.tab; transient state (_t, is_editing, renamed_archive_original_name)
stays on the tab. Pure structural move, no behavior change.
@ebuzerdrmz44 ebuzerdrmz44 force-pushed the refactor/archive-tab-split branch from c5ab42c to 270fa18 Compare July 8, 2026 10:55
@ebuzerdrmz44 ebuzerdrmz44 marked this pull request as ready for review July 8, 2026 10:59
@ebuzerdrmz44

Copy link
Copy Markdown
Contributor Author

Rebased onto master now that #2519 has merged, so the diff is just the part-2 work: archive_diff.py + archive_rename.py (new) and the archive_tab.py deltas. Ready for a shape check.

Follows the ArchiveExtract / ArchiveMount collaborator pattern from #2519 — each helper takes the tab and reaches back through it; the context menu stays in ArchiveTab since it just dispatches. Still holding delete + check/compact/prune for a follow-up so the helper shape can be settled here first.

@ebuzerdrmz44

Copy link
Copy Markdown
Contributor Author

question on context menu extraction (#2361) : I temporarily kept archiveitem_contextmenu in ArchiveTab. since it only builds the QMenu and dispatches actions to existing helpers, extracting it would create a redundant wrapper. Happy to adapt though . should I extract it to an ArchiveContextMenu helper for consistency, or leave it as dispatch glue?

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.

1 participant