fix(ci): normalize Windows CRLF line endings in PR governance script#1012
fix(ci): normalize Windows CRLF line endings in PR governance script#1012Parideboy wants to merge 5 commits into
Conversation
PR governanceThis PR follows the template and is marked ready for human review. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Do you know why we have so many failures? Related to your fix? I dont think so - but want to check |
No idea, I will take a closer look after work. But it's mostly related to torch installation issues: Three test jobs are failing because of duplicate PyTorch CPU index URLs. The global PIP_EXTRA_INDEX_URL is already set, but individual jobs are passing --index-url again, creating duplicates. Fixes needed in .github/workflows/ci.yml: If index-url must be used, it can be replaced with --extra-index-url. Is there a reason why it was added in the first place? PyPI should handle this on it's own |
CODE_BLOCK_RE hardcodes \n (LF) after the opening fence, but PR bodies authored on Windows use \r\n (CRLF). When the regex hits \r before \n at that position the match fails silently: has_test_output() returns False and the bot reports 'Paste real command output' even when the code block is present and correct. Fix: normalize \r\n to \n at the top of validate_pull_request before any regex runs. Covers all pattern matches, not just the code-block regex, and future-proofs against similar \r\n issues.
e097a85 to
8a92754
Compare
8a92754 to
99c772d
Compare
JerrettDavis
left a comment
There was a problem hiding this comment.
Reviewed the CRLF normalization change and the added regression coverage. Focused governance tests passed locally and current checks are green.
CODE_BLOCK_RE hardcodes \n (LF) after the opening fence, but PR bodies authored on Windows use \r\n (CRLF). When the regex hits \r before \n at that position the match fails silently: has_test_output() returns False and the bot reports 'Paste real command output' even when the code block is present and correct. Fix: normalize \r\n to \n at the top of validate_pull_request before any regex runs. Covers all pattern matches, not just the code-block regex, and future-proofs against similar \r\n issues.
99c772d to
76809a1
Compare
JerrettDavis
left a comment
There was a problem hiding this comment.
This PR is not merge-ready because CI is currently red: test (3)=FAILURE, test (2)=FAILURE. Please fix or rerun the failing checks after updating from current main.
…ix/governance-crlf-code-blocks
… into fix/governance-crlf-code-blocks
Description
The
CODE_BLOCK_REregex inscripts/pr-governance.pyexpects LF after the opening fenced code block. PR bodies authored on Windows can arrive with CRLF line endings, which leaves a\rbefore the\nand preventshas_test_output()from detecting a valid Test Output block.This normalizes CRLF to LF once when loading the pull request body, before section extraction and code-block matching. A regression test now verifies that a valid PR body with CRLF line endings still passes governance.
Type of Change
Changes Made
scripts/pr-governance.pybefore regex-based validation runs.test_validate_pull_request_accepts_crlf_test_output_code_blockto prevent regressions.Testing
pytest)ruff check)ruff format --check)Test Output
Real Behavior Proof
validate_pull_requestin the new regression test.Review Readiness