Enter TestClients in captured_writes audit tests
Two API tests use `captured_writes` with a TestClient that is never entered, so each request runs on a throwaway event loop torn down with the response. On a loaded host, that teardown cancels the fire-and-forget audit write (`app/user_activity.py::schedule_once`) before it starts, and the row never lands. This is the root cause Task 13208 fixed in `tests/test_operator_other_org_mutation.py`.
- `apps/api/tests/test_activity_capture_write.py::test_a_refused_mutation_is_recorded_with_its_status` (`client = _client_as(...)`, never entered): put it in `with`.
- `apps/api/tests/test_credential_owner_picker.py` `tenant` fixture: the `clients` dict is built with unentered `_client_as(...)` and driven by tests that assert `captured_writes` rows. Enter the clients, e.g. with an ExitStack.
Out of scope: production code; tests that do not read `captured_writes`.
Done means: both files pass 3x in a row under `./dc test`, and every TestClient that drives a `captured_writes` assertion is entered as a context manager.
Outcome
Entered the captured_writes-driving TestClients (with + ExitStack). Both files pass 3x under ./dc test, quick gate green, reviewer PASS. PR #7846 queued in the merge lane. Memory: used mem-25288.
Artifacts
Activity
- Created
- Run
- Runner started
- Runner ended (done)