Skip to content

refactor(core): extract upgrade code paths for improved readability/testing#60740

Draft
joshtrichards wants to merge 2 commits into
masterfrom
jtr/refactor-base-UpgradePage
Draft

refactor(core): extract upgrade code paths for improved readability/testing#60740
joshtrichards wants to merge 2 commits into
masterfrom
jtr/refactor-base-UpgradePage

Conversation

@joshtrichards

@joshtrichards joshtrichards commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

The printUpgradePage() function combined upgrade-size detection, app compatibility checks, and view rendering into a single method. This tight coupling made the function harder to understand, maintain, and test.

The function has been refactored to improve clarity and modularity:

  • Upgrade size detection:
    • Extracted logic (isInstanceTooBigForWebUpgrade() + reusable helpers for for database queries).
    • Introduced isBigInstanceOverrideRequested() to handle override logic separately.
    • Eliminates duplicate code and streamlines parent function's logic flow.
  • App compatibility checks:
    • Extracted logic (prepareUpgradeAppState() + helper to encapsulate exception handling).
    • Makes parent function logic easier to read.
  • Other improvements:
    • Replaced magic numbers/strings with named constants for better readability and maintainability.
    • Minimized inline branching and variable clutter.

In addition to clarity, should improve testability going forward.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added 2. developing Work in progress feature: install and update technical debt 🧱 🤔🚀 ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels May 26, 2026
@susnux susnux added the community pull requests from community label Jun 9, 2026
@susnux susnux added this to the Nextcloud 35 milestone Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress community pull requests from community feature: install and update ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) technical debt 🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants