From 03f0f9f6f8df47d54dd4d907ff63849bdeb3dee8 Mon Sep 17 00:00:00 2001 From: squid-protocol Date: Fri, 11 Sep 2026 10:29:12 -0400 Subject: [PATCH] test(aperture): don't write a quote-named file to disk on Windows test_malformed_extension_not_leaked_into_reason created a real file named `naive.txt"`. `"` is a legal filename char on POSIX (where a git quotepath artifact can actually produce this name) but illegal on Windows, so write_text raised `OSError: [Errno 22]` on the Windows Full Suite Gate legs (3.9 and 3.12) before any assertion ran. evaluate_path_integrity is "Gate 1: Zero-I/O Path Evaluation": the malformed- extension sanitization is pure string analysis of the path and size_bytes falls back to 0 when the file is absent, so evaluating the constructed Path alone keeps the test meaningful -- and now cross-platform -- without touching the filesystem. Closes #2961 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014rUcYDAzYYCgrLdHyKBT9G --- tests/core_engine/test_lang_classification_2555.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/core_engine/test_lang_classification_2555.py b/tests/core_engine/test_lang_classification_2555.py index 09836542..dfcbe734 100644 --- a/tests/core_engine/test_lang_classification_2555.py +++ b/tests/core_engine/test_lang_classification_2555.py @@ -154,8 +154,15 @@ def test_project_scope_stands_down_infra_shield_but_keeps_ignored_dirs(filter_en def test_malformed_extension_not_leaked_into_reason(filter_engine, tmp_path): """A path carrying a stray quote (quotepath artifact) must not surface a malformed extension like `.txt"` in the human-readable exclusion reason.""" + # #2961: do NOT create the file on disk -- `"` is a legal filename char on + # POSIX (where a git quotepath artifact can actually produce this name) but + # illegal on Windows, so `write_text` raised OSError: [Errno 22] on the + # Windows CI legs before any assertion ran. evaluate_path_integrity is + # "Gate 1: Zero-I/O Path Evaluation" -- the malformed-extension sanitization + # is pure string analysis of the path and size_bytes falls back to 0 when the + # file is absent, so evaluating the constructed Path alone keeps this test + # meaningful (and cross-platform) without touching the filesystem. bad = tmp_path / 'naive.txt"' - bad.write_text("data", encoding="utf-8") is_valid, _, reason = filter_engine.evaluate_path_integrity(bad, has_intent=False) assert is_valid is False