Repository navigation
fix(watch): cancel a boot's slim when the device shuts down, add watch --json - #74
Merged
Merged
Conversation
…h --json A device shut down mid-pass and booted again kept its old after-boot pass running: forget() dropped the claim but not the pass, so its retries ran into the new boot and disabled services a wrapper had enabled after the new boot's pass finished. Each pass now has its own cancel, called on shutdown or deletion, and a superseded pass reports stopped instead of slimmed or clearing the newer boot's claim. watch --json prints one WatchEvent per line on stdout (slimming, slimmed, failed, stopped, slimmed_before_boot), a stable signal for wrappers that wait for a boot's slim before calling enable. Fixes #71
seed() marked a Shutting Down device as seeded although preslimDevice writes nothing until Shutdown, so that shutdown was never seeded and services enabled during the boot carried into the next one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #71
What
scan()calledforget(udid)on shutdown but left the running after-boot pass alone. After a quick shutdown and reboot, the old pass kept retrying into the new boot and disabled services a wrapper had turned on withenableafter the new pass loggedslimmed. Each pass now has its own cancel (slimPass), called when the device shuts down or is deleted (prune). A superseded pass reportsstopped. It no longer reportsslimmed, and a late failure no longer clears the newer boot's claim, which used to start a third pass.seed()marked a device seeded when a scan caught itShutting Down, althoughpreslimDevicewrites nothing untilShutdown. That shutdown was never seeded, so services enabled during the boot carried into the next one. A device is now seeded only once it readsShutdown.watch --json. One JSON object per line on stdout, documented as stable:{"event":"slimmed","udid":"…","set":"default"}slimming,slimmed,failed(witherror),stopped, andslimmed_before_boot(withservices). A wrapper boots the device, waits forslimmedorfailed, then callsenable. Per the--jsonconvention, stderr stays quiet.WatchWithEventsandWatchEventare new.Watchkeeps its signature.Testing
make checkpasses.TestWatchCancelsPassWhenDeviceShutsDown(the old pass is cancelled, events areslimming, stopped, slimming, slimmed) andTestWatchStalePassKeepsNewBootClaimed(a late failure from the old pass doesn't start a third pass or reportfailed).-race -count=3.TestWatchSeedsDeviceScannedMidShutdownfails without the seed fix.storeenabled live, a realsimctl shutdownwas scanned by the watcher. The old code caughtShutting Downand wrote 0 disables (0/14 store services off). The fixed code wrote all 14, and the next boot passedsimslim verify.