Repository navigation
test(cli): remove the delegation, discussion, skill and plugin test directories when each test ends - #795
Merged
Conversation
Refs #781. Adds TestDir (unique scratch directory removed on drop, also on panic, robust to read-only trees, TOLE_KEEP_TEST_DIRS=1 and keep() escape hatches) and ChildGuard (kill and reap a child before its directory goes) to tole-core and tole-cli, for integration tests and unit tests. No test is converted yet.
Refs #781. WorkDir creates <root>/w inside a TestDir, so work.with_extension("home") lands in the same removed root.
…irectories when each test ends Refs #781. Fixtures that hand a path-derived value to the code under test now own their directory (a guard field or a returned guard). The delegation tests kill the detached fake tole shells before the root goes. The data dir shared by all delegate tests is named shared-delegate-data-* and swept when older than six hours.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 15, 2026
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.
What
The
tole-cliunit tests ofdelegation/,discuss/,skill/andplugin/useTestDir(from #789) instead of leaking their directories. No production code changes.Why
Refs #781:
tole-ddecide-*,tole-dhost-*,tole-discuss-*,tole-delegate-*,tole-dapprover-*,tole-aowner-*,tole-sdeleg-*,tole-plugin-cmd-*,tole-drafts-cli-*,tole-curator-cli-*and friends.Changes
crates/tole-cli/src/{delegation,discuss,skill,plugin}. Fixtures that return a value built over a scratch directory (aDiscussionLog, aDriver, a draft store, aDelegator) now return the guard with it, or hold it in a field; a guard dropped on return would have removed the directory and the code under test recreated it, which is the leak again.delegation/approver_tests.rs: the fixture's nap hook holds a clone of the fixture (a reference cycle that never drops); the clone does not own the directory, the original does.delegation/delegate_tests.rs: the tests start detached faketoleshells. The workspace root is aRootguard that kills them (pkill -9 -f <root>) before the directory goes, and the fake script no longer recreates a removed root. The data dir shared by all tests of the process is namedshared-delegate-data-*and swept when older than six hours (a per-test guard cannot own it; it holds one small directory per recent run and is nottole-*).Testing
cargo test -p tole-cli --libwith a privateTMPDIR(564 tests): notole-*/cora-*left from these tests. The delegation tests were run three times in a row to check the child handling is stable.cargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings: clean.Refs #781