v1.3.0 — Sandbox lifecycle management and signal-safe cleanup #61
ericodx
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Orphaned sandbox directories from interrupted runs are now cleaned up automatically at startup, and active sandboxes are removed on SIGINT/SIGTERM — preventing the disk leak that could accumulate hundreds of gigabytes in
$TMPDIR.What's new
Automatic orphaned sandbox cleanup
SandboxCleaner.removeOrphaned()scans$TMPDIRat startup and removes all directories prefixed withxmr-left behind by previous interrupted runsSignal-safe active sandbox cleanup
SandboxCleaner.installSignalHandlers()installsSIGINTandSIGTERMhandlers at process startupnonisolated(unsafe)C pointer at module scope — necessary because C signal handlers cannot capture Swift contextSandboxCleaner.register()/deregister()track the active sandbox throughout the execution lifecycleTestable signal handler architecture
handleSignaldelegates cleanup tocleanupActiveSandbox()and exit to a replaceable@convention(c)function pointer (sandboxCleanerExitHandler)signal(), swap the exit handler for a stub, and invoke the handler directly — achieving full coverage without subprocess tricks orfork()Architecture changes
New type:
SandboxCleaner— anenum(namespace) managing the full sandbox lifecycle:removeOrphaned(in:)xmr-*entries and removes themregister(_:)deregister()installSignalHandlers()SIGINT/SIGTERMhandlers that clean up and exitcleanupActiveSandbox()MutantExecutor integration —
register(sandbox)is called after sandbox creation;deregister()is called in both the success and error cleanup paths, ensuring the signal handler always has the correct state.Entry point —
main()callsinstallSignalHandlers()andremoveOrphaned()before any execution begins.Bug fixes
xmr-*sandbox directories in$TMPDIRindefinitely — accumulating up to hundreds of gigabytes over repeated interrupted sessionsrewriteForIncompatiblereturning nil for source files deleted between retry and rewrite — now correctly marks the mutant as.unviablewith explicit test coverageTest coverage
SandboxCleanercovering: orphan removal, nested content, mixed entries, register/deregister lifecycle,cleanupActiveSandbox, signal handler installation, and directhandleSignalinvocation with stubbed exithandleSignaltested by retrieving the installed C function pointer and invoking it with a@convention(c)exit stub — full branch coverage without process terminationMutantExecutortest forrewriteForIncompatibleline 454: newSPMRetryWithFileDeletionMockdeletes the source file during the retry build, verifying the nil-return path produces.unviableRequirements
Installation
See the Installation Guide for Homebrew, pre-built binary, and build from source instructions.
What's Changed
Full Changelog: v1.2.0...v1.3.0
This discussion was created from the release v1.3.0 — Sandbox lifecycle management and signal-safe cleanup.
All reactions