From 7d9adea30b9f448a4156e42fad0aedecab35006e Mon Sep 17 00:00:00 2001 From: XZH Date: Sun, 30 Aug 2026 17:02:38 -0700 Subject: [PATCH] fix(learner): preserve audit root compatibility --- deeptutor/multi_user/audit.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deeptutor/multi_user/audit.py b/deeptutor/multi_user/audit.py index a694a59cd..ccae9e02a 100644 --- a/deeptutor/multi_user/audit.py +++ b/deeptutor/multi_user/audit.py @@ -9,11 +9,17 @@ from typing import Any from . import paths from .context import get_current_user +# Keep the legacy module-level hook for callers and tests that redirect the +# audit root directly; path resolution remains dynamic per call. +SYSTEM_ROOT = paths.SYSTEM_ROOT +_DEFAULT_SYSTEM_ROOT = SYSTEM_ROOT + def _audit_file(): # Resolved per call so monkey-patched SYSTEM_ROOT (e.g. in tests) takes # effect without a module reload. - return paths.SYSTEM_ROOT / "audit" / "usage.jsonl" + root = SYSTEM_ROOT if SYSTEM_ROOT != _DEFAULT_SYSTEM_ROOT else paths.SYSTEM_ROOT + return root / "audit" / "usage.jsonl" def _write(payload: dict[str, Any]) -> None: