sync-engineering.py activate replaces cache/current and then relinks skills without removing obsolete skill links first, and it can't roll back a partial failure. If a link creation or the pointer replacement fails partway, the consumer is left with a mix of old and new links and no restored state.
Found by an automated review of a vendored copy in lemarier/kitchen (PR #55, which ships the script byte-identical to this repository at c394158).
Expected: remove obsolete skill links before replacing the current pointer, tracking each removed link and its target. If a link creation or the pointer replacement fails, remove the links this attempt created and restore the removed ones before propagating the error. Add a test that injects a failure after the first link.
sync-engineering.pyactivatereplacescache/currentand then relinks skills without removing obsolete skill links first, and it can't roll back a partial failure. If a link creation or the pointer replacement fails partway, the consumer is left with a mix of old and new links and no restored state.Found by an automated review of a vendored copy in lemarier/kitchen (PR #55, which ships the script byte-identical to this repository at c394158).
Expected: remove obsolete skill links before replacing the current pointer, tracking each removed link and its target. If a link creation or the pointer replacement fails, remove the links this attempt created and restore the removed ones before propagating the error. Add a test that injects a failure after the first link.