Skip to content

ci: fail the Test job when the suites leave tole-* or cora-* directories behind - #800

Merged
ajianaz merged 6 commits into
developfrom
test/testdir-ci-guard
Nov 15, 2026
Merged

ajianaz merged 6 commits into
developfrom
test/testdir-ci-guard

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

The CI Test job runs cargo test --workspace with a fresh private TMPDIR and fails when a tole-* or cora-* entry is still there afterwards. Documents TestDir in CONTRIBUTING.

Why

Closes #781. Without a guard the leak comes back with the next test written the old way.

Changes

  • .github/workflows/ci.yml, Test job (existing steps kept): a step that makes /tmp/tole-test-tmp.XXXXXX (via mktemp) and clears target/tmp; TMPDIR is set for the cargo test step only; a final step lists tole-*/cora-* entries directly under that directory and under target/tmp (where the integration tests keep theirs) and fails with the first 50 names. Fixed shared-* fixtures are not counted.
  • The directory is under /tmp, not RUNNER_TEMP: the runner temp dir sits inside $HOME (/home/runner/work/_temp), and the sandbox tests refuse a workspace under $HOME (verified locally: with TMPDIR under $HOME the sandbox unit tests fail).
  • CONTRIBUTING.md: a bullet on TestDir, ChildGuard, TOLE_KEEP_TEST_DIRS=1 and the CI check.
  • Depends on the conversion PRs (test(cli): remove the config test directories when each test ends #792 to test(core): remove the integration-test directories when each test ends #799): this check only passes once they are merged; on its own the Test job of this PR will report the leftovers.

Testing

  • Local, all conversion branches merged: cargo test --workspace with a private TMPDIR (2267 tests, 0 failures); TMPDIR holds 0 tole-*/cora-* entries (baseline before the series: 1385 entries, 148 MB, plus 1 in target/tmp); target/tmp holds only shared-* directories. The check command was also run by hand against a directory holding tole-x, other and shared-y: it reports only tole-x.
  • Added time: the guard step is one find (well under a second); test time summed over all binaries was 219 s before and 225 s after (noise level, the tests now also remove their directories). The CI run of this PR gives the real number.
  • ci.yml parses as YAML.

Closes #781

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.
…ies behind

Refs #781. Runs cargo test with a private TMPDIR and checks it, and cargo's target/tmp, for leftovers. Documents TestDir in CONTRIBUTING.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit b3e8a47 into develop Nov 15, 2026
18 checks passed
@ajianaz
ajianaz deleted the test/testdir-ci-guard branch November 20, 2026 08:40
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.

tests leak temp directories: /tmp held ~175 000 tole-* and cora-* entries (17 GB) after a day of agent work

2 participants