From d7d410a2d7b305cafe0ce73796295918d899aa0d Mon Sep 17 00:00:00 2001 From: 0xKT <74288668+0xKT@users.noreply.github.com> Date: Thu, 13 Aug 2026 00:16:02 +0800 Subject: [PATCH] test(context_engine): skip the chmod attachment case when the runner is root The case chmods a file to 000 and expects `build_user_content` to report an unreadable attachment as a note. Root ignores the mode bits, so the read succeeds, the picture is inlined, and the assertion sees content blocks where it wanted a string. Our runner is root; GitHub's is not, which is why the case arrived green from upstream and failed here on its first run. Guarded rather than rewritten: the behaviour under test is worth pinning where permissions actually apply. Same spelling as the existing guard in tests/test_importer_hermes_skills.py. `os` moves to module scope because the decorator is evaluated there. Co-authored-by: Claude (claude-opus-5) --- tests/test_read_file_image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_read_file_image.py b/tests/test_read_file_image.py index 39b2cb03..c2dd8af0 100644 --- a/tests/test_read_file_image.py +++ b/tests/test_read_file_image.py @@ -9,6 +9,7 @@ import asyncio import base64 import json +import os import threading import time from pathlib import Path @@ -1615,14 +1616,13 @@ def test_an_attachment_that_cannot_be_prepared_is_named_not_dropped(tmp_path: Pa assert "could not be prepared" in out +@pytest.mark.skipif(os.geteuid() == 0, reason="chmod 000 does not block root") def test_an_attachment_that_cannot_be_read_costs_a_note_not_the_turn(tmp_path: Path) -> None: """Resolution only proved the path pointed at a file. Permissions can change between then and the read, and the file can be gone -- and this renderer runs deep inside turn assembly, where an ``OSError`` reaches the caller as a failed turn rather than as a message about one attachment. """ - import os - from raven.context_engine.segments import render locked = _write_image(tmp_path / "locked.png", (60, 40))