Skip to content

feat: Add automatic rollback on upgrade failure#5

Merged
psywarrior1998 merged 6 commits intomainfrom
feature/rollback-on-failure
Aug 10, 2025
Merged

feat: Add automatic rollback on upgrade failure#5
psywarrior1998 merged 6 commits intomainfrom
feature/rollback-on-failure

Conversation

@psywarrior1998
Copy link
Copy Markdown
Owner

This pull request introduces a critical safety feature to protect the user's environment. If a package upgrade fails for any reason (e.g., network error, compilation failure), the tool will now automatically attempt to revert that package to its previously installed, stable version.

This prevents a failed upgrade from leaving the environment in a broken or inconsistent state.

Technical Implementation:

  • The core upgrade_package worker function now wraps the upgrade attempt in a try...except block.
  • The package's original version is recorded before the upgrade is attempted.
  • If the upgrade fails, the except block triggers a pip install --force-reinstall <package>==<original_version> command to perform the rollback.
  • A new UpgradeStatus enum has been introduced to provide more granular results (SUCCESS, ROLLBACK_SUCCESS, ROLLBACK_FAILED).
  • The final summary report has been enhanced to clearly display the outcome of all operations, explicitly highlighting any rollbacks or critical failures.
  • A --no-rollback flag has been added for advanced users who wish to disable this functionality.

@psywarrior1998 psywarrior1998 merged commit 1cd1714 into main Aug 10, 2025
5 checks passed
@psywarrior1998 psywarrior1998 deleted the feature/rollback-on-failure branch August 31, 2025 12:19
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