Repository navigation
Strip the CR From configure.sh's Environment-Name Encoding - #2068
Conversation
check_environments() percent-encoded the environment name with a plain jq -rn, so a native Windows jq's trailing CR reached the deployment-branch-policies API path. The read now goes through jqr like the surrounding reads. A new test drives the lifted lines with a stand-in jq that appends a CR, and it fails with the fix reverted. Closes on promotion: #1882 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 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 |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
It is a minimal, low-risk one-line fix routing through an existing helper, closely mirrors prior merged CRLF fixes and the sibling test convention, and is covered by a test that fails when reverted.
Review effort: Balanced
Findings: None
What changed in this PR
This PR fixes a CRLF-exposure bug in repo-config/configure.sh. In check_environments(), the environment name was percent-encoded with a plain jq -rn before being interpolated into a gh api deployment-branch-policies URL path. On a native Windows jq, -r raw mode appends a trailing carriage return, which would corrupt the URL path segment and cause every custom-branch-policy environment to be reported as a read failure rather than as (non-)drift. The fix routes the encoding through the existing jqr() helper, which strips the trailing CR, matching the same fix applied to the surrounding reads and to prior sites in this CRLF chain. A new test lifts the actual script lines and drives them with a stand-in jq that appends a CR, verifying the CR is stripped from the encoded name.
Changes:
- Route the environment-name
@uriencoding throughjqr -ninstead ofjq -rn, and add the file's standardSC2016disable comment. - Add
tests/test_configure_envname.py, which exercises the liftedjqrand encoding lines under both CRLF and LF jq output and would fail with the fix reverted.
| File | Description |
|---|---|
repo-config/configure.sh |
Encode the environment name via jqr -n so the native-Windows jq trailing CR is stripped before it reaches the API URL path; adds the conventional SC2016 disable comment. |
tests/test_configure_envname.py |
New test lifting the real jqr and encoding lines, asserting a CRLF-emitting jq shim leaves no CR in the encoded name and that LF output encodes identically. |
I verified: jqr() at configure.sh:406 is jq -r "$@" | sed $'s/\r$//', so it strips the CR; the added SC2016 disable is consistent with the file's convention (e.g. lines 671, 700); the test structure and CRLF-shim approach mirror the established tests/test_configure_model.py; the imported lift/run_bash helpers exist in test_configure_archived.py; and the regexes in the test each match exactly one line so the fix-reverted case genuinely fails.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The existing environment-name test lifted the encoding line by its old jq -rn spelling, so the fix broke its match. It now matches the jqr form and lifts jqr beside it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2068 +/- ##
==========================================
Coverage ? 55.66%
==========================================
Files ? 16
Lines ? 7317
Branches ? 0
==========================================
Hits ? 4073
Misses ? 3244
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
It is a minimal, well-tested fix that mirrors the file's established jqr CRLF-hardening pattern, with a regression test that fails when reverted and no unfixed raw-jq sites remaining in the affected function.
Review effort: Balanced
Findings: None
…pilot Coverage at Balanced Effort (#2105) ## Summary Promotes develop to main, carrying 14 pull requests: - [#2076](#2076) Read the Guard's Token Fallback With a Bash-Aware Context Scan - [#2081](#2081) Keep the Guard's Quote Mask When an Escape Sits Outside the Loop Condition - [#2094](#2094) Reconfigure pr_review.py's Console Streams to UTF-8 - [#2088](#2088) Guard check_settings' Live Read of the Repository Response - [#2102](#2102) Skip a Blockquoted List Marker in the Prose Gate's Dash Rule - [#2104](#2104) Accept a Head Round's Exact File Table as Copilot Coverage at Balanced Effort - [#2098](#2098) Quote the Review Engine's Remaining Bare Shell Placeholders - [#2050](#2050) Hand Unstated Coverage to the Maintainer Instead of Prescribing a Re-Request - [#2046](#2046) Report a Copilot Review Request That Records Nothing Instead of Waiting It Out - [#2053](#2053) State the Python Build Profile by Its Trait, Not One of Its Forms - [#2068](#2068) Strip the CR From configure.sh's Environment-Name Encoding - [#2033](#2033) Bound the Guard's Stdin Descriptor Before int() - [#2036](#2036) Guard ruleset_id() Against Malformed Array Elements - [#2039](#2039) Strip the CR From configure.sh's Workflow-Model Read The lead change is #2104. Copilot code review's default effort moved from Lite to Balanced on 2026-09-28, and Balanced rounds write a per-file table but almost never a coverage statement. `pr_review.py` now accepts a head round's file table as coverage when it names exactly the changed files and no Copilot round on the pull request has ever stated or appeared to state partial coverage. Before this, every pull request reviewed at Balanced effort parked on a maintainer decision. The other pull requests are guard, configure, prose-gate, and review-engine fixes that were waiting on that decision or landed earlier. #2076 leaves #1910, #1958, and #1959 open, per #1960. Closes #1998 Closes #2091 Closes #1260 Closes #1190 Closes #1652 Closes #2047 Closes #1904 Closes #1947 Closes #1882 Closes #2028 Closes #1987 Closes #1881 🤖 Generated with [Claude Code](https://claude.com/claude-code)
check_environments() percent-encoded the environment name with a plain jq -rn, so a native Windows jq's trailing CR reached the deployment-branch-policies API path. The read now goes through jqr like the surrounding reads. A new test drives the lifted lines with a stand-in jq that appends a CR, and it fails with the fix reverted.
Closes on promotion: #1882
🤖 Generated with Claude Code