Repository navigation
chore(tests): escape the shell backslash in the git stub heredoc - #13720
Conversation
`_git_stub()` builds a `/bin/sh` script inside a normal (non-raw) Python
string, and its `case` pattern escapes a space for the shell:
ref:\ refs/heads/*)
`\ ` is not a Python escape sequence. Python leaves it as backslash-space,
so the stub has always been correct, but it emits
SyntaxWarning: invalid escape sequence '\ '
on every import, which shows up in the guard job logs, and invalid escape
sequences are slated to become a SyntaxError. The same string already
writes `\\n` two lines further down, so this is an inconsistency rather
than a deliberate choice.
Doubling the backslash produces the identical shell script: the rendered
stub hashes the same before and after (sha256 90fc977171af3de3), and the
six bash scenarios still pass. It is the only invalid escape sequence in
the repository's Python.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe regression test now explicitly escapes the backslash-space sequence in its embedded git stub. The generated shell script behavior remains unchanged. ChangesTest escape cleanup
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Change: Other Merge Risk: ⚪ Minimal · up to This test-only cleanup removes an import warning while preserving the generated shell stub’s behavior, so it is ready to merge. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Every guard job that imports
tests/test_issue_1138_sidebar_pr_polling.pyprints:_git_stub()builds a/bin/shscript inside a normal (non-raw) Python string, and itscasepattern escapes a space for the shell:\is not a Python escape sequence. Python leaves it as backslash-space, so the stub has always produced the right shell script — but the warning is real, and invalid escape sequences are slated to become aSyntaxError. The same string already writes\\ntwo lines further down, so this reads as an oversight rather than a deliberate choice.Verified
Doubling the backslash produces the identical shell script:
sha256 90fc977171af3de3before and afterbashscenarios pass (prompt_does_not_call_gh,merge_action,close_action_target,failed_merge_no_action,non_pr_gh_no_action,head_change_clears_pr), and the escaped-spacecasebranch is on the path the branch-reading scenarios exercisecompile()on the file reports noSyntaxWarningafterwardsI could not run the
zshhalf locally — no zsh on this machine — so that side is covered by CI. Behaviour is unchanged regardless, since the generated script is byte-identical.Sweeping every
.pyin the repository outsidenode_modules/ghostty/build, this is the only invalid escape sequence, so the log goes quiet with this one change.A guard that fails the build on any new
SyntaxWarningwould keep it that way. I left it out here because it needs atests/test-execution.tomlentry and #13710/#13712 are both editing that file right now; worth adding once one of them lands.Note on CI
guards / workflow-guard-tests / preflightis expected to fail on this PR for a reason unrelated to it: nine tests have reachedmainwithout an execution-registry entry, sovalidate_test_execution_registry.pyexits 1 on any branch based on currentmain. #13710 fixes that.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes a
SyntaxWarningon every import oftests/test_issue_1138_sidebar_pr_polling.pyby doubling a backslash in the git stub heredoc. The generated shell script is byte-identical, so behavior is unchanged.Written for commit 52ff9d4. Summary will update on new commits.
Summary by CodeRabbit