personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(makefile): stop leaking /var/tmp/solstone-pytest-* dirs

PYTEST_BASETEMP was created at parse time via $(shell mktemp -d ...), so
every make invocation — install, clean, doctor, tab completion — leaked
an empty basetemp dir. Each make test also got its own unique basetemp,
defeating pytest's built-in 3-run rotation and orphaning the contents.
1,109 dirs / 69GB had accumulated.

Move creation into the recipe shell via PYTEST_BASETEMP_INIT (mktemp +
trap) and prepend it to every recipe line that uses
PYTEST_BASETEMP_FLAG. Trap removes the basetemp on EXIT/INT/TERM, so
test runs no longer leak full dirs either.

+18 -14
+18 -14
Makefile
··· 2 2 # Python-based AI-driven desktop journaling toolkit 3 3 4 4 # Route pytest tmp dirs to /var/tmp (disk) instead of default /tmp (tmpfs/RAM). 5 - # Each top-level pytest invocation also gets a unique --basetemp so concurrent 6 - # runs in different worktrees do not share /var/tmp/pytest-of-$USER/pytest-N/. 7 - # Do not re-add --basetemp to pyproject — it would pin all runs to one path and 5 + # Each top-level pytest invocation gets its own --basetemp so concurrent runs 6 + # in different worktrees do not share /var/tmp/pytest-of-$USER/pytest-N/. The 7 + # basetemp is created at recipe runtime (not parse time) and removed via shell 8 + # trap on exit, so non-test make targets don't leak empty dirs and test runs 9 + # don't leak full ones. PYTEST_BASETEMP_INIT must be on the same recipe shell 10 + # line as PYTEST_BASETEMP_FLAG (each recipe line is its own shell). Do not 11 + # re-add --basetemp to pyproject — it would pin all runs to one path and 8 12 # pytest wipes it on startup, destroying concurrent state. 9 13 export TMPDIR := /var/tmp 10 - PYTEST_BASETEMP := $(shell mktemp -d /var/tmp/solstone-pytest-XXXXXX) 11 - PYTEST_BASETEMP_FLAG := --basetemp $(PYTEST_BASETEMP) 14 + PYTEST_BASETEMP_INIT := BASETEMP=$$(mktemp -d /var/tmp/solstone-pytest-XXXXXX); trap 'rm -rf "$$BASETEMP"' EXIT INT TERM; 15 + PYTEST_BASETEMP_FLAG := --basetemp "$$BASETEMP" 12 16 13 17 .PHONY: install uninstall test test-apps test-app test-only test-integration test-integration-only test-all format format-check install-checks ci clean clean-install coverage watch versions update update-prices pre-commit skills dev all sandbox sandbox-stop install-pinchtab install-models parakeet-helper parakeet-helper-clean verify-browser update-browser-baselines review verify verify-api update-api-baselines install-service uninstall-service service-logs check-layer-hygiene doctor FORCE 14 18 ··· 377 381 # Run core tests (excluding integration and app tests) 378 382 test: .installed format-check 379 383 @echo "Running core tests..." 380 - $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ -q --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) 384 + $(PYTEST_BASETEMP_INIT) $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ -q --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) 381 385 382 386 # Run app tests 383 387 test-apps: .installed 384 388 @echo "Running app tests..." 385 - $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ -q 389 + $(PYTEST_BASETEMP_INIT) $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ -q 386 390 387 391 # Run specific app tests 388 392 test-app: .installed ··· 391 395 echo "Example: make test-app APP=todos"; \ 392 396 exit 1; \ 393 397 fi 394 - $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/$(APP)/tests/ -v 398 + $(PYTEST_BASETEMP_INIT) $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/$(APP)/tests/ -v 395 399 396 400 # Run specific test file or pattern 397 401 test-only: .installed ··· 401 405 echo "Example: make test-only TEST=\"-k test_function_name\""; \ 402 406 exit 1; \ 403 407 fi 404 - $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) $(TEST) 408 + $(PYTEST_BASETEMP_INIT) $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) $(TEST) 405 409 406 410 # Run integration tests 407 411 test-integration: .installed 408 412 @echo "Running integration tests..." 409 - @STATUS=0; \ 413 + @$(PYTEST_BASETEMP_INIT) STATUS=0; \ 410 414 $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/integration/ tests/link/test_integration.py tests/link/test_privacy_scan.py -v --tb=short --timeout=20 || STATUS=$$?; \ 411 415 if [ "$$STATUS" -ne 0 ] && [ "$$STATUS" -ne 5 ]; then exit $$STATUS; fi 412 416 ··· 417 421 echo "Example: make test-integration-only TEST=test_api.py"; \ 418 422 exit 1; \ 419 423 fi 420 - @TARGET="$(TEST)"; \ 424 + @$(PYTEST_BASETEMP_INIT) TARGET="$(TEST)"; \ 421 425 case "$$TARGET" in \ 422 426 tests/*|-*) ;; \ 423 427 *) TARGET="tests/integration/$$TARGET" ;; \ ··· 429 433 # Run all tests (core + apps + integration) 430 434 test-all: .installed 431 435 @echo "Running all tests (core + apps + integration)..." 432 - $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ -v --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) && $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ -v --cov=. --cov-append 436 + $(PYTEST_BASETEMP_INIT) $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ -v --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) && $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ -v --cov=. --cov-append 433 437 434 438 # Auto-format and fix code, then report any remaining issues 435 439 format: .installed ··· 599 603 600 604 # Generate coverage report (core + apps, excluding core integration tests) 601 605 coverage: .installed 602 - $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ --cov=. --cov-report=html --cov-report=term --ignore=tests/integration $(LINK_LIVE_TESTS) 603 - $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ --cov=. --cov-report=html --cov-report=term --cov-append 606 + $(PYTEST_BASETEMP_INIT) $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ --cov=. --cov-report=html --cov-report=term --ignore=tests/integration $(LINK_LIVE_TESTS) 607 + $(PYTEST_BASETEMP_INIT) $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ --cov=. --cov-report=html --cov-report=term --cov-append 604 608 @echo "Coverage report generated in htmlcov/index.html" 605 609 606 610 # Update all dependencies to latest versions and refresh genai-prices