feat(sleep): add revert command to rollback adopted proposals - #280
RohithPariki wants to merge 3 commits into
Conversation
|
Thank you for adding an explicit undo command; safe rollback is a useful missing capability. Reviewed 312aaf7 against the current adoption machinery and the outstanding #248 review. The undo command is useful, but this implementation does not resolve that review's receipt-binding, history-ordering, and recovery requirements, and it omits adoption locking/recovery entirely. Please use validated, trusted receipt/destination bindings and a durable transaction before adding filesystem restoration or deletion. A matching content hash alone does not establish that an old night is the current adoption. Coordinate security-sensitive reproduction details privately under SECURITY.md. Two additional functional regressions are reproducible with synthetic fixtures: adopt -> revert -> adopt fails because revert clears the receipt but leaves the immutable backup, and bare revert after a newer unadopted staging night reports success without undoing the earlier adoption. The default should select the current adopted history head, and backup/receipt cleanup should be recoverable. The focused suite passes 104 tests, but these adverse paths are not covered by the two new happy-path tests. Please coordinate one coherent rollback implementation with #248 and keep #247 open until the safety contract is met. |
… stack model - Enforce adoption locking and recovery before reverting legacy or per-skill adoptions - Validate and bind receipts against trusted staging manifest targets and safe root paths - Enforce LIFO stack history ordering to prevent reverting an older night when a newer night is adopted - Clean up immutable backups upon successful reversion to enable re-adoption (adopt -> revert -> adopt) - Resolve default revert target using latest_adopted_staging to skip newer unadopted staging nights - Expand test_sleep_revert.py with 20 unit tests covering adverse, boundary, and regression cases
|
Thank you for the detailed review and guidance! I have updated the branch to address all the safety, transaction, and history-ordering requirements:
|
Resolves #247
Implements the
skillopt-sleep revertcommand to allow users to cleanly undo adopted proposals by restoring state from their immutable backups.Changes
revertsubcommand toskillopt_sleep/__main__.py, matching theadoptinterface (--staging,--skill,--all-skills,--legacy).revert_skillsandrevertinskillopt_sleep/staging.pyto restore original bytes safely.test_sleep_revert.pywith idempotent behavior validation.