fix: roll back step refresh when removal fails and read presence unde… · github/spec-kit@6173940 · GitHub
Skip to content

Commit 6173940

Browse files
committed
fix: roll back step refresh when removal fails and read presence under the lock
A BundlerError from _remove_step_locked was raised before the rollback handler, so the finally block deleted the backup. Since the removal drops the registry key before deleting the directory, a failed rmtree could lose a JSON null entry and the step files. The removal error now goes through the same rollback path as a failed reinstall: the snapshot is restored, or kept on disk and named in the error if the restore fails. Online refresh also no longer decides presence from the registry loaded at manager construction. Only offline refresh skips straight to install; online refresh reads the registry under _step_install_transaction, so a step added after construction is snapshotted, removed and reinstalled instead of failing check_installable(). Adds regression tests for a removal failure on a null registry entry and for a step committed after the manager was built.
1 parent bdeb125 commit 6173940

2 files changed

Lines changed: 181 additions & 13 deletions

File tree

‎src/specify_cli/bundles/primitives.py‎

Lines changed: 22 additions & 10 deletions

‎tests/specify_cli/bundles/test_primitives.py‎

Lines changed: 159 additions & 3 deletions

0 commit comments

Comments
 (0)