Avoid GDK update failures due to stashing when conflicts are present
Overview
The GDK update command executes multiple rake tasks, including update:gitlab-git-pull which updates the GitLab repository. Currently, when this task attempts to stash changes but encounters conflicts, the stashing operation fails, causing the entire GDK update process to abort.
This creates a poor developer experience as local changes or merge conflicts prevent developers from updating their GDK environment, even though these conflicts are a user-level concern rather than a system failure.
Impacted categories
The following categories relate to this issue:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Business impact
- Developer productivity: Developers lose time troubleshooting GDK update failures that could be handled more gracefully
- Onboarding friction: New team members may struggle with GDK updates, creating unnecessary barriers to contribution
- Inconsistent environments: Failed updates may lead to developers to run updates less, causing them to work with outdated GDK environments, potentially causing environment-specific issues or conflicts in their code changes
Proposal
We should improve the robustness of the update:gitlab-git-pull task by implementing one of the following approaches:
-
Enhanced stashing: Modify the stashing process to automatically stage all files before stashing, which would avoid conflicts on unstaged changes
# Before stashing, stage all files GDK::Shellout.new('git add -A').execute GDK::Shellout.new('git stash save -u').execute -
Non-fatal error handling: Change how stashing failures are handled by:
- Detecting stashing failures
- Providing a clear warning message about unresolved conflicts
- Marking this as a user-level warning rather than a fatal system error
-
Interactive resolution: Detect conflicts and prompt the user with options:
- Abort the update
- Automatically stage and stash all changes
The second approach is recommended as it maintains the integrity of the developer's work while still allowing GDK updates to proceed with appropriate warnings.