Repository navigation
feat(sleep): add revert command to rollback adopted proposals - #280
RohithPariki wants to merge 7 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:
|
|
Thank you for addressing locking, skipping unadopted nights, and readoption. The October 6 review of The revised PR remains unmergeable on correctness/safety grounds, however:
The shipped focused tests passed 163 tests, while independent producer-realistic checks found three blocker categories across both legacy and per-skill modes. These are not small issues we can safely defer until after merge. Please coordinate one coherent implementation with #248, covering failure recovery, authoritative state binding and actual adoption lineage. #247 remains open; the existence of a revert command alone does not satisfy that request safely. |
…dation, and adoption lineage
|
Thanks for the thorough architectural review Yifan Yang (@Yif-Yang)! We have updated the PR to address all points: 1. Whole-Set Prevalidation & Durable Rollback Transaction WAL
2. Authoritative State & Backup Binding
3. Adoption Lineage Ledger (
|
|
Re-reviewed The remaining hold is adoption lineage. After reverting the most recent genuine adoption, the next real ancestor can still be blocked by a stale active lineage entry, for both legacy and per-skill rollback. The failure is now later in the sequence than the old staging-order problem. Please ensure receipt synchronization and explicit adoption recording cannot represent one adoption twice, and demonstrate complete successive rollback, imported pre-existing receipts and crash recovery. Sensitive reproduction details remain private. #247 stays open; this is not suitable for merge-first recovery repair. |
…ve rollback - Exclude pending adoption targets during receipt synchronization to prevent double-recording adoptions - Add stack-head checks to _record_adoption_in_lineage and _record_revert_in_lineage ensuring idempotency - Introduce _sanitize_lineage_entries to automatically self-heal any existing duplicate lineage records on load - Add comprehensive regression tests demonstrating successive rollback (per-skill and legacy), pre-existing receipt import, and crash recovery
|
Thanks Yifan Yang (@Yif-Yang) for catching the duplicate entry in the lineage journal! Root CauseWhen Fix
All 31 tests in |
|
Re-reviewed Two recovery/history invariants remain unmet. First, rollback can report success after lineage publication fails, discard its recovery journal, and leave receipt state inconsistent with active lineage; an ordinary retry then cannot unwind the genuine ancestor. Receipt and lineage publication must remain durably recoverable together, including the recovery path itself. Second, importing pre-existing receipts still reconstructs history from staging creation order, which can identify the wrong current adoption when actual adoption order differs. Recover trustworthy order where possible and explicitly refuse an ambiguous migration rather than inventing an order. Four independent cases reproduce these two failures across both modes. This remains on hold; #247 should stay open until the complete recoverability and history contract is demonstrated. #248 remains an overlapping alternative rather than a second implementation to merge. Review baseline: |
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.