Repository navigation
fix(ci-gate): strip 4-byte UTF-8 from status descriptions before truncating (stacked on #141) - #146
hyperpolymath wants to merge 2 commits into
Conversation
…cating "not green: $bad" carries check and workflow names, which hold emoji; the statuses API rejects a codepoint above U+FFFF (HTTP 422), so the publish failed and the failure handler posted a false red. publish() is the one verdict write site: it now strips U+10000..U+10FFFF first, then cuts to 140 characters. Adds tests/ci-gate.sh (extracts publish(), fake gh refusing 4-byte text) and wires it into code-hygiene-self-test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4QvDiRggj6apeRQKPpAVR
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Replace the gsub("[\\x{10000}-\\x{10FFFF}]"; "") strip with the canonical
expression shipped in #144, explode | map(select(. <= 65535)) | implode. It is
applied before the 140-character cap, exactly as before.
There is no behaviour change: both forms drop every codepoint above U+FFFF, and
they were tested equal on jq 1.6, 1.7, 1.7.1, 1.8.0 and 1.8.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDiRggj6apeRQKPpAVR
|



Bug
The reusable
ci-gate.ymlposts commit statusCI/gate. GitHub's statuses API rejects anydescriptioncontaining a codepoint above U+FFFF (HTTP 422 "Description doesn't accept 4-byte Unicode"). In this branch the verdict step buildsnot green: $badfrom check-run and workflow-run names (ci-gate.ymlline 165 before the fix), and those names carry emoji. The POST fails, the step exits 1, and the failure handler postsCI/gate = failure: a false red.Audit of every description write in this branch: lines 113, 163, 167, 171 and 186 are static text; line 127/129 is
publish(); only line 165 (not green: $bad) carries untrusted names, and it goes throughpublish().Fix and chokepoint
publish()is the one verdict write site. It now strips every codepoint above U+FFFF with the regex-freeexplode | map(select(. <= 65535)) | implode(the same expression as #144) BEFORE cutting to 140 characters (character-based, locale independent; the old bash${d:0:139}was locale dependent).The earlier revision of this PR used the equivalent
gsub("[\\x{10000}-\\x{10FFFF}]"; ""). It was replaced to align with #144; there is no behaviour change, and both forms were tested equal on jq 1.6, 1.7, 1.7.1, 1.8.0 and 1.8.1.jq versions verified
tests/ci-gate.shpasses (19 passed, 0 failed) under each of jq 1.6, 1.7, 1.7.1, 1.8.0 and 1.8.1, and under the system jq (1.7).Test evidence
This branch had no ci-gate test, so
tests/ci-gate.shis new, in the style of the othertests/*.sh, and is wired intocode-hygiene-self-test.yml(plusci-gate.ymlin its path filters).publish()from the workflow and runs it against a fakeghthat refuses a 4-byte description like the real API: a name with the two emoji, emoji straddling the 140 boundary, a 160-character name, no byte >= 0xF0, at most 140 codepoints, BMP text and state preserved, plain descriptions unchanged, plus a static guard that no description is built from a variable outsidepublish(), that theBMP_ONLYexpression appears exactly once in the workflow, and that nogsubrange strip remains.ghrefuses 4-byte text. The control still uses the original pre-fix expression.bash -n.lock-transitive-closure(23/5),lock-pin-contract,lock-self-source-controls,workflow-lock-scope(needs mikefarah yq) andgate-action-ownersfail identically at the unmodified base in this sandbox, so they are not caused by this change.Supersession
The canonical fix lands on #139's stack. #139 already contains #142's commits, so #142 may be superseded, and this PR on #141's stack is a stopgap with the same intent.
Gate-file change
This changes
.github/workflows/ci-gate.yml(andcode-hygiene-self-test.yml); an admin may need to apply thegate-change-approvedlabel. Agents do not apply it.What is NOT proven
gh.%G?) could not be confirmed locally (no allowed-signers file in the sandbox).🤖 Generated with Claude Code
https://claude.ai/code/session_01J4QvDiRggj6apeRQKPpAVR