test(issue-20): rec 4 - the in-process publish helper keeps its audit log in tmp_path

_job_for_inprocess_publish deleted DELEGATE_JOB_LOGS_DIR to fall back to the cwd, but an ambient WORKSPACE_ROOT comes first, so the audit log went to the real .mam/delegate_job_logs. It now keeps the per-test default and asserts the log is under tmp_path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sdga4A8i1iSc8DaaW9iKU2
This commit is contained in:
GodopuandClaude Opus 5 committed 2026-09-15 02:02:51 +00:00
1 parent 3433ffdc41
commit 7bd695c209
1 file changed
+8 -4
+8 -4
View File
@@ -517,15 +517,19 @@ def test_wrapper_idle_grace_never_outlives_the_wall_clock(tmp_path):
# publish_event: a heartbeat reaches events.log before the wire publish # publish_event: a heartbeat reaches events.log before the wire publish
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
def _job_for_inprocess_publish(tmp_path, monkeypatch): def _job_for_inprocess_publish(tmp_path, monkeypatch):
"""A registered job in a private registry. The audit log resolves against """A registered job in a private registry. Its audit log goes to the
the cwd, so it lands under tmp_path too, and no real .mam.env is read.""" per-test default under tmp_path (conftest, Issue #20): deleting
from lib_py.delegation import registry DELEGATE_JOB_LOGS_DIR here, to fall back to the cwd, fell through to an
ambient WORKSPACE_ROOT instead - the real .mam/delegate_job_logs (PR #22
rec 4). No real .mam.env is read."""
from lib_py.delegation import mqtt_common, registry
monkeypatch.chdir(tmp_path) monkeypatch.chdir(tmp_path)
monkeypatch.delenv("DELEGATE_JOB_LOGS_DIR", raising=False)
monkeypatch.setenv("MAM_ENV_FILE", str(tmp_path / ".mam.env.absent")) monkeypatch.setenv("MAM_ENV_FILE", str(tmp_path / ".mam.env.absent"))
reg_dir = tmp_path / "jobs" reg_dir = tmp_path / "jobs"
jid = registry.register_job("issue 14 heartbeat order", registry_dir=str(reg_dir)) jid = registry.register_job("issue 14 heartbeat order", registry_dir=str(reg_dir))
logs = Path(mqtt_common.get_logs_dir())
assert tmp_path in logs.parents and (logs / jid).is_dir(), logs
return reg_dir, jid return reg_dir, jid