fix: Windows path separator leak and CRLF-inflated file sizes (#21) - #27
Merged
Merged
Conversation
Display paths (`opsward/cli.py::_relative_path`, `opsward/generate.py::_find_conftest`) now render via `PurePath.as_posix()` instead of `str(Path)`, so `misc\docs\...` no longer leaks into printed CLI output or generated doc content on Windows. `.gitattributes` gains `* text=auto eol=lf` so fixtures/templates always check out with LF, fixing reported byte sizes (a 37-byte stub was measuring 40 under a CRLF checkout). Removes the six now-stale WINDOWS_CONTENT_DIFFS entries in tests/test_cli_parity.py, which the test's own docstring flagged as the correct outcome once #21 was fixed. Closes #21 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…path form These two check target_path -- a real filesystem Path used to actually write the generated file -- via str(), which is a WindowsPath rendering backslashes on Windows (correctly; that's how the file gets written). Switch the assertion to .as_posix() so it checks the logical path instead of the OS rendering, matching what test_testing_md_includes_conftest_when_present already does for generated *content* (a real portability concern, fixed separately in this PR). Found via the hosted Windows CI run on this PR -- issue #21 had named these two tests as failing for the display-path bug, but they actually fail for this unrelated reason (a test assertion issue, not a source bug). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
thorwhalen
added a commit
that referenced
this pull request
Sep 22, 2026
#27 fixed the CRLF-inflated sizes only for opsward's own fixtures (via .gitattributes). Projects that opsward scans are still checked out with CRLF on Windows (core.autocrlf=true is the Git for Windows default), so the stub heuristics driven by DocSpec.size_bytes gave host-dependent answers. Count bytes after normalizing CRLF to LF, with a regression test. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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
opsward/cli.py::_relative_pathandopsward/generate.py::_find_conftestnow render viaPurePath.as_posix()instead ofstr(Path), somisc\docs\...no longer leaks into printed CLI output or generated doc content on Windows..gitattributesgains* text=auto eol=lfso fixtures/templates always check out with LF, fixing reported byte sizes (a 37-byte stub was measuring 40 under a CRLF checkout).WINDOWS_CONTENT_DIFFSentries intests/test_cli_parity.py— the test's own docstring says this is the correct outcome once CI: Windows tests failing (pre-existing, non-blocking) #21 is fixed ("the test fails withunexpected-match... delete the entry").Both root causes and their fixes were already precisely spec'd in #21's own comment; this PR implements exactly that spec.
Closes #21
Test plan
pytest— 134 passed, 1 skipped (local venv, Python 3.12)tests/test_cli_parity.pypasses standalone_relative_pathrenders forward slashes given a POSIXPathgh pr checks) is the real verification of the Windows-specific half; I have no Windows box to test on directly🤖 Generated with Claude Code