Repository navigation
Description
Summary
repo-config/configure.sh resolves a ruleset payload's declared name with jq -r '.name // empty' "$file", at both apply_ruleset() (line 144) and check_ruleset() (line 253). On a native Windows jq (the same WinGet jq-1.8.2 behavior #1123 and its fix in PR #1229 document: unconditional CRLF on stdout), that command substitution would carry a trailing \r into $rname the same way it did into configure.sh check's settings comparison.
$rname then feeds ruleset_id()'s lookup:
ids="$(jq -r --arg n "$1" '.[] | select(.name==$n) | .id' <<<"$out")"where $out is a gh api JSON body (never passed through a local jq -r, so it stays \r-free). A \r-suffixed $rname (e.g. "main\r") never matches a clean live .name ("main"), so ruleset_id() reports "not found" for a ruleset that exists.
Impact
checkmode:check_ruleset()reports the ruleset as missing (fail "ruleset '$rname' missing") even when it is present and correctly configured, the same class of false-drift repo-config/configure.sh check reports every setting but the last as drifted on Windows, because jq emits CRLF #1123 fixed for static settings.applymode:apply_ruleset()takes the same "not found" path as create-vs-update, sogh api --method POST "repos/$repo/rulesets"runs instead of a PUT to the existing ruleset. Run repeatedly (or with more than one ruleset payload), this could create duplicate rulesets by name rather than update the existing one, a state-changing consequence, not just a reporting artifact.
Suggested fix
Route rname="$(jq -r '.name // empty' "$file")" (both call sites) through the same CR-stripping technique #1123 uses for check_settings() (repo-config/configure.sh's jqr() helper as of PR #1229), since $file is read from a local ruleset payload, not from $out, so it is exactly the asymmetric one-side-jq-derived shape #1123 describes.
Context
Found while implementing #1194 and #1123 together in PR #1229: fixing #1123's check_settings() comparisons surfaced this sibling defect in ruleset_id()/apply_ruleset()/check_ruleset(), a different function with a wider blast radius (an apply-mode state change, not just a check-mode false report). Filed rather than folded into #1229 to keep that PR scoped to what #1194 and #1123 actually cover.
Unverified on a real Windows host, same as #1123 itself; the reasoning follows from jq's own documented native-Windows CRLF stdout behavior (unconditional unless -b/--binary is passed).
Activity
Fix configure.sh's Python Probe Order and Windows CRLF Drift-Check Bug (
Fix configure.sh's Ruleset Name Lookup CRLF Exposure (#1247)
Fix configure.sh's Ruleset Type-Loop CRLF False Pass (#1254)
Let Each Language Say What Its Hash May Follow, Since One Set Was Wro…
Route configure.sh's ruleset_id() Through jqr (#1253) (#1883)
Route ruleset_id()'s Per-Page Guard Through jqr (#1972)