From 99671a86347769240ca6f4c17e059b7366bba64d Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 23 May 2026 02:19:01 -0700 Subject: [PATCH] test(kanban): allow tmp_path artifacts past media-delivery validator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #41d2c758c ("Fix unsafe gateway media path delivery") tightened `validate_media_delivery_path` so that artifacts emitted by the agent must live inside `MEDIA_DELIVERY_SAFE_ROOTS` (Hermes-managed cache dirs) or an operator-allowlisted root via `HERMES_MEDIA_ALLOW_DIRS`. Two kanban-notifier tests put their PDFs and PNGs under pytest's `tmp_path`, which is correctly rejected by the new validator. They started failing on main as soon as that PR landed: FAILED tests/hermes_cli/test_kanban_notify.py::test_notifier_uploads_artifacts_on_completion FAILED tests/hermes_cli/test_kanban_notify.py::test_notifier_artifact_delivery_skips_missing_files Symptom in logs: "Skipping unsafe local file path outside allowed roots". The validator is doing exactly what it should — the tests were relying on the looser pre-fix behaviour. Fix: add `HERMES_MEDIA_ALLOW_DIRS=tmp_path` to the `kanban_home` fixture so artifacts under `tmp_path` are recognised as safe. This is the same allowlist mechanism the operator-facing env var documents. --- tests/hermes_cli/test_kanban_notify.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/hermes_cli/test_kanban_notify.py b/tests/hermes_cli/test_kanban_notify.py index 1ebf92705d7..1a0388e1e65 100644 --- a/tests/hermes_cli/test_kanban_notify.py +++ b/tests/hermes_cli/test_kanban_notify.py @@ -17,6 +17,11 @@ def kanban_home(tmp_path, monkeypatch): home.mkdir() monkeypatch.setenv("HERMES_HOME", str(home)) monkeypatch.setattr(Path, "home", lambda: tmp_path) + # Allow the kanban notifier path-validator to upload artifacts the + # tests write under ``tmp_path``. Without this, every artifact-delivery + # test silently drops files because ``tmp_path`` isn't inside the + # default ``MEDIA_DELIVERY_SAFE_ROOTS`` cache dirs. + monkeypatch.setenv("HERMES_MEDIA_ALLOW_DIRS", str(tmp_path)) kb.init_db() return home