Skip to content

fix(ci-gate): strip 4-byte UTF-8 from status descriptions before truncating (stacked on #142) - #145

Closed
hyperpolymath wants to merge 2 commits into
claude/ci-gate-pr-startfrom
claude/intelligent-johnson-i64bfk-pr142
Closed

hyperpolymath wants to merge 2 commits into
claude/ci-gate-pr-startfrom
claude/intelligent-johnson-i64bfk-pr142

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Bug

The reusable ci-gate.yml posts commit status CI/gate. GitHub's statuses API rejects any description containing a codepoint above U+FFFF (HTTP 422 "Description doesn't accept 4-byte Unicode"). Consumer workflow, job and check names carry emoji (for example a name starting with a red circle or a yellow circle), and those names reach the description (failed: ..., waiting for ..., re-run started: <run name>). The POST fails, the step exits 1, and the failure handler posts CI/gate = failure: a false red.

Fix and chokepoint

Strip every codepoint above U+FFFF with the regex-free explode | map(select(. <= 65535)) | implode (the same expression as #144, defined once as BMP_ONLY in the publisher) BEFORE truncating to 140 characters.

  • clip() in scripts/ci-gate-publish.sh: the single write site for verdicts (post(), so die() too). The verdict script's descriptions all reach GitHub only through it.
  • The early "re-run started" pending line in .github/workflows/ci-gate.yml: a second write site that runs before any suite file can be read, so it carries the same expression inline. tests/ci-gate.sh asserts that this inline copy contains the publisher's BMP_ONLY text exactly.

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.sh passes in full (512 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). The negative control still uses the original pre-fix expression, which keeps the emoji.

Test evidence (tests/ci-gate.sh)

  • Before: 479 passed, 0 failed (unchanged tests).
  • New assertions run the extracted code, not a retyped copy: a name with the two emoji, names with emoji straddling the 140 boundary (one tuned per site, since the early line has a 16-character prefix), no byte >= 0xF0, at most 140 codepoints, BMP text kept, ellipsis on cut. Also an end-to-end run of the real publisher against a fake gh that refuses 4-byte descriptions like the real API.
  • Fail-before: the new tests against the unfixed code: 500 passed, 10 failed (measured on the earlier revision of this PR).
  • Negative control: the old expression keeps the emoji, so the 4-byte detector demonstrably fires.
  • shellcheck (warning level) and actionlint: no new findings against base on the earlier revision; neither tool was available when this refactor was made, so the refactor itself was not linted beyond bash -n. Other lock/contract tests were run: lock-transitive-closure (23/5), lock-pin-contract, lock-self-source-controls, workflow-lock-scope (needs mikefarah yq) and gate-action-owners fail identically at the unmodified base in this sandbox, so they are not caused by this change. ci-gate-tamper-guard 73/0, composite-shell-contract 28/0.

Supersession

The canonical fix lands on #139's stack. #139 already contains #142's commits, so #142 may be superseded; this PR only exists so #142's head is not left with the bug if it merges first.

Gate-file change

This changes ci-gate.yml and ci-gate-publish.sh; an admin may need to apply the gate-change-approved label. Agents do not apply it.

What is NOT proven

  • Not exercised against the live GitHub statuses API; the 4-byte rule is modelled by a fake gh.
  • Signature verification (%G?) could not be confirmed locally (no allowed-signers file in the sandbox).
  • No change to other characters the API may reject; only codepoints above U+FFFF are handled.
  • The pre-existing sandbox failures listed above were not investigated.

Generated by Claude Code

…cating

The statuses API rejects a description with a codepoint above U+FFFF (HTTP 422),
and consumer check and workflow names carry emoji, so the POST failed and the
failure handler posted a false red. clip() in ci-gate-publish.sh (the one write
site for verdicts, die() included) and the early re-run pending line now strip
U+10000..U+10FFFF first, then cut to 140 characters. Tests run the extracted
expressions, plus an end-to-end publisher run against a fake gh that refuses
4-byte descriptions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDiRggj6apeRQKPpAVR
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0bcdfc6e-0776-4cb0-8d29-929ce6ef3a17

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

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
@sonarqubecloud

Copy link
Copy Markdown

Copy link
Copy Markdown
Owner Author

CI / gate failed on aca8fc9 with "never reported: main-estate-audit.yml:governance, …:hygiene, …:languages, …". As on #144, this comes from where the PR is stacked, not from the change.

main-estate-audit.yml runs on pull_request only for branches: [ "main" ], and the suite profile requires its jobs. This PR targets claude/ci-gate-pr-start (#142), so those jobs never start. Details are in the #144 comment.

Locally, tests/ci-gate.sh passes 512 of 512 at aca8fc9, which now uses the same regex-free BMP_ONLY sanitiser as #144. #139 already contains all of #142's commits, so the canonical fix is #144. This PR will be closed once #144 lands.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Closing on the owner's decision. #139 merged with all of #142's commits, and the 4-byte sanitiser now lands through #148, which supersedes #144 as well. Nothing here needs to be kept.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants