fix(windows): detect reserved paths before update autostash - #57212
fix(windows): detect reserved paths before update autostash#57212Pukujan wants to merge 1 commit into
Conversation
|
Thanks for the focused, non-destructive Windows recovery path. The CLI premise is still present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
|
Hi @Pukujan — after reviewing both approaches, I think your fail-fast strategy is the right call. I'm the author of #71841 and I plan to close it in favor of yours. Two things from #71841 that might be worth folding into yours:
Happy to help review or test if needed. |
Fixes #57081.
Summary
Adds a Windows preflight check before the update auto-stash step to detect reserved device-name paths such as
nul.On Windows, Git can hang or prompt interactively during
git stashwhen an untracked reserved path exists in the working tree:This caused
hermes updateto appear stuck at:Behavior after this change
Instead of invoking
git stashand potentially hanging, Hermes fails fast with a clear Windows-specific message and a safe local workaround.The fix does not automatically delete files, modify
.git/info/exclude, reset the repo, clean the repo, or restore stashes.Safety note
Manual recovery commands such as
git reset --hard,git clean -fdx, clearing stashes, or declining stash restore can discard uncommitted local changes inside the Hermes install repo. This PR intentionally avoids those destructive actions and only detects/reports the unsafe path before autostash.Follow-up idea
A future PR could add a self-updating manifest/update-state file for Hermes updates. That manifest could track installed SHA, target SHA, Python version, dependency-install status, pre-update snapshot, backup path, autostash state, process-lock detection, and recovery status.
That would make updates more resumable/idempotent and could support a future
hermes update doctororhermes repaircommand for partial updates, locked executables, failed dependency installs, and stale update stashes.Testing
python -m py_compile hermes_cli\\main.py tests\\hermes_cli\\test_update_autostash.pypython -m ruff check hermes_cli\\main.py tests\\hermes_cli\\test_update_autostash.pypython -m pytest tests\\hermes_cli\\test_update_autostash.py -k "windows_reserved_component or aborts_before_stash or stash_local_changes_if_needed"python -m pytest tests\\hermes_cli\\test_update_autostash.py; 46 passed and 4 failed on existing Windows test assumptions aroundgit -c windows.appendAtomically=falsecommand shape, outside this change.