Problem
Validated from Claude third-pass finding [87].
lib/python/base_cli/testing.py::invoke() changes process-global working directory with os.chdir(cwd_path), calls CliRunner.invoke(...), and then changes back in a finally block. This works for serial tests, but os.chdir() is process-global and can race when helper invocations run concurrently in the same Python process, such as with pytest-xdist style patterns or future threaded test harnesses.
Desired outcome
Make base_cli.testing.invoke() avoid process-global cwd mutation while preserving its current test ergonomics.
Scope
- Prefer a Click-supported isolated cwd mechanism or another local-only strategy.
- Preserve support for writing a
base_manifest.yaml fixture when manifest= is supplied.
- Keep stdout/stderr separation behavior intact.
- Add a regression test for cwd isolation.
Acceptance criteria
invoke(..., cwd=...) no longer calls os.chdir() around the invocation, or the remaining use is isolated and safe for concurrent calls.
- Existing
base_cli testing helpers continue to work.
- Tests cover cwd behavior without relying on global process state.
Classification
Review finding taxonomy: test helper robustness.
Problem
Validated from Claude third-pass finding
[87].lib/python/base_cli/testing.py::invoke()changes process-global working directory withos.chdir(cwd_path), callsCliRunner.invoke(...), and then changes back in afinallyblock. This works for serial tests, butos.chdir()is process-global and can race when helper invocations run concurrently in the same Python process, such as with pytest-xdist style patterns or future threaded test harnesses.Desired outcome
Make
base_cli.testing.invoke()avoid process-global cwd mutation while preserving its current test ergonomics.Scope
base_manifest.yamlfixture whenmanifest=is supplied.Acceptance criteria
invoke(..., cwd=...)no longer callsos.chdir()around the invocation, or the remaining use is isolated and safe for concurrent calls.base_clitesting helpers continue to work.Classification
Review finding taxonomy: test helper robustness.