Repository navigation
fix(test): keep the permission-contract receipt alive through fixture-cleanup failures - #881
Merged
Merged
Conversation
…-cleanup failures A cloud vitest shard lost a whole base-gate run (2026-10-29) to an unhandled ENOTEMPTY from fixture.cleanup(): the sidecar's native CLI outlived the sidecar-only SIGKILL and kept writing into the fixture while fs.rm swept it, the rejection escaped runScenario's finally, and the harness died before printing its one receipt line. Three layers: - runScenario kills the sidecar's whole process group (detached spawn) and awaits the exit before cleanup, so the CLI cannot be alive under the rm. - fixture.cleanup() retries ENOTEMPTY/EBUSY stragglers (maxRetries=10). - A cleanup failure is caught and logged; the receipt reports it as fixtureRemoved=false instead of crashing the process. The new sabotage test pins the containment: with every fixture root made unwritable after its setup, the harness still prints one parseable receipt with fixtureRemoved=false for all eight scenarios.
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.
Summary
A cloud vitest shard lost a whole base-gate run (2026-10-29) to an unhandled
ENOTEMPTYfromfixture.cleanup()in the Claude permission-contract harness:the sidecar's native CLI outlived the sidecar-only SIGKILL and kept writing
into the fixture while
fs.rmswept it, the rejection escapedrunScenario'sfinally, and the harness died before printing its one-linereceipt — so the suite failed with "expected one receipt line" and the shard
crashed out.
Three layers, test-file-only (no product code):
runScenarionow spawns the sidecar detached and, on the force path,kills its whole process group (the native CLI is the fixture's concurrent
writer), then awaits the exit before cleanup.
fixture.cleanup()retriesENOTEMPTY/EBUSYstragglers(
maxRetries: 10, retryDelay: 100) —fs.rm's defaultmaxRetries=0turns any file recreated between the unlink sweep and the final rmdir
into a rejection.
fixture.cleanup_failed); thereceipt reports it as
fixtureRemoved=falseinstead of the processcrashing and eating the receipt for every scenario at once.
Test evidence
the unwritable-fixture EACCES; then green): with every fixture root made
unwritable after its setup, the harness still prints one parseable receipt
with
fixtureRemoved=falsefor all eight scenarios and exits 1.test/integration/providers/pass(110 tests), including the real-CLI contract and sidecar-shutdown pins.
pnpm run typecheckclean. No Rust touched.References
freshell-vitest-31cb9ad69f5b-9qozeu(2026-10-29T23:05Z), shard stderr shows the unhandled
ENOTEMPTY rmdir /tmp/freshell-claude-perm-shapes-*crash.