From c5017bf5eb4ac5bb8d63e5337ba0428fd361f66a Mon Sep 17 00:00:00 2001 From: Emi Griffith Date: Fri, 17 Jul 2026 12:44:30 -0700 Subject: [PATCH] Isolate the access log in tests so self-test traffic doesn't pollute the live monitor (#168) conftest redirected AUDIT_DIR and ERROR_DIR to a throwaway tmp dir but left ACCESS_DIR pointing at the repo's logs/access/. The request-logging middleware runs under TestClient too, so every suite run appended its deliberate error-path requests (401/404/409/422/502/503) to the live access log that the ops dashboard reads, inflating its traffic and error tallies. Point ACCESS_DIR at the tmp dir like the other two. Co-authored-by: root --- tests/conftest.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index f92a4cf..8f7ae6f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -41,6 +41,9 @@ import audit # noqa: E402 audit.AUDIT_DIR = os.path.join(_TMP, "logs", "audit") audit.ERROR_DIR = os.path.join(_TMP, "logs", "errors") +# The request-logging middleware runs under TestClient too; keep its access log +# out of the repo's logs/ so self-test traffic never pollutes the live monitor. +audit.ACCESS_DIR = os.path.join(_TMP, "logs", "access") def _years_before(d: datetime.date, years: int) -> datetime.date: