test(aperture): fix Windows-illegal quote filename in #2555 test (#2961) - #2962
Merged
Conversation
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014rUcYDAzYYCgrLdHyKBT9G
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_malformed_extension_not_leaked_into_reason(added in #2946 / #2555) failed on the Windows legs of the Full Suite Gate (Python 3.9 and 3.12) — Linux/macOS passed. It created a real file namednaive.txt";"is a legal filename char on POSIX but illegal on Windows, sowrite_textraisedOSError: [Errno 22]before any assertion ran.AperturePolicy.evaluate_path_integrityis by design "Gate 1: Zero-I/O Path Evaluation" — theno_extensionsanitization (aperture.py:235-241) is pure string analysis of the path, andsize_bytesalready falls back to0when the file is absent (the.exists()/.stat()pair is wrapped intry/except OSError). So the test never needed the file on disk.Fix: drop
bad.write_text(...)and evaluate the constructedPathdirectly. Keeps the assertions meaningful and restores Windows coverage (thePathstring is fine there; only filesystem ops fail).Verification
pytest tests/core_engine/test_lang_classification_2555.py→ 9 passed (existence was not load-bearing for reaching theno_extensionbranch).Separate from the #2933 slicer PR, per the one-layer-per-PR rule.
Closes #2961
🤖 Generated with Claude Code