Skip to content

fix: await nested test cleanup and discard package artifacts - #386

Open
tisonkun wants to merge 2 commits into
Swatinem:masterfrom
tisonkun:codex/fix-package-and-test-cleanup
Open

fix: await nested test cleanup and discard package artifacts#386
tisonkun wants to merge 2 commits into
Swatinem:masterfrom
tisonkun:codex/fix-package-and-test-cleanup

Conversation

@tisonkun

@tisonkun tisonkun commented Sep 9, 2026

Copy link
Copy Markdown

Running cargo package before saving the cache leaves unpacked sources under target/package/<crate>/tests. Cleanup currently treats these source directories as nested test build directories and attempts to open their nonexistent target and trybuild children. The two cleanup calls are not awaited, so their rejections escape the surrounding try/catch and produce unhandled ENOENT annotations. Real nested test cleanup can also outlive its caller.

Await both nested cleanup calls and discard target/package at each target-root entry point before recursively pruning build artifacts. Package archives and verification sources are excluded together, while directories named package below target roots retain the normal pruning behavior. This applies to save cleanup and restore-time timestamp pruning.

Validation:

  • npm run prepare on Node.js 24.20.0: succeeds and leaves the checked-in dist/ unchanged.
  • Created and verified a real dependency-free crate with cargo package --offline --allow-dirty --no-metadata, including tests/fixtures, and successfully cleaned the resulting target directory.
  • git diff --check: passes.

The checked-in dist/ files are regenerated with npm run prepare. The large cache-chunk diff consists of line-ending normalization and the generated cleanup import update; ignoring whitespace isolates the code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant