Five package-level sync.Once builders in cmd/bd/ called
os.MkdirTemp("", ...) with no corresponding cleanup, leaking
~179MB-1.4GB of test artifacts per run into $TMPDIR. On tmpfs
hosts (e.g. Fedora Atomic /tmp = 50% of RAM) this exhausted /tmp
after a few runs. Leaking sites:
- test_repo_beads_guard_test.go beads-bd-tests-*
- test_helpers_pure_test.go bd-init-test-*
- init_embedded_test.go bd-embedded-init-test-*
- shared_server_integration_test beads-shared-server-bd-*
- init_permissions_test.go bd-init-permissions-test-*
- explicit_db_nodb_test.go bd-testbin-*
Fix: anchor all six temp dirs under the existing TestMain tmp
parent via a new testTempDir helper. The defer in testMainInner
already calls forceRemoveAll on that parent (chmod-tolerant for
Go modcache 0444 files), so all six get cleaned in one place.
Also adds 'make clean-test-tmp' (scripts/clean-test-tmp.sh) for
sweeping orphans left by SIGKILLed test runs, and documents the
tmpfs caveat in AGENT_INSTRUCTIONS.md.
Fixesgastownhall/beads#4106 (bd-3q2u)
_amp-unknown-model-unknown-reasoning on behalf of matt wilkie_
Amp-Thread-ID: https://ampcode.com/threads/T-019e512d-edf1-72e3-a252-6328e63bff3f
Co-authored-by: Amp <amp@ampcode.com>