Skip to content

fix(ci): stop ci scopes panicking on a non-ASCII base or head ref - #1882

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/sileht/mrgfy-8855-scopes-ref-panic/stop-ci-scopes-panicking-non-ascii-base-head-ref--6106bddd
Oct 5, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
devs/sileht/mrgfy-8855-scopes-ref-panic/stop-ci-scopes-panicking-non-ascii-base-head-ref--6106bddd

Conversation

@sileht

@sileht sileht commented Oct 5, 2026

Copy link
Copy Markdown
Member

The step summary truncated each ref to 7 bytes, not 7 chars. A branch
name whose 7th byte falls inside a multi-byte char (releasé-2026)
panicked with "byte index 7 is not a char boundary" and exit 101.
It runs on every GitHub Actions run ($GITHUB_STEP_SUMMARY) and on
Buildkite, with the base taken from --base, the event's default
branch, or BUILDKITE_PULL_REQUEST_BASE_BRANCH.

Truncate by chars. While here, escape the ref range like scope names
already are: a ref with a backtick or a newline could close the code
span and write its own heading into the summary.

A ref that is not valid UTF-8 never reaches this code: clap rejects
it for --base, env reads treat it as unset, and the event JSON is
UTF-8.

Fixes MRGFY-8855

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Copilot AI balanced review requested due to automatic review settings October 5, 2026 14:21
@mergify

mergify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 6 merge protections satisfied — ready to merge.

Show 6 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections October 5, 2026 14:21 Failure
@sileht
sileht deployed to func-tests-live October 5, 2026 14:22 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Consecutive backticks can still break out of the generated code span.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes Unicode ref truncation and hardens CI summary rendering.

Changes:

  • Truncates refs by characters instead of bytes.
  • Escapes ref ranges in Markdown.
  • Adds regression tests.
File Description
crates/​mergify-ci/​src/​scopes_detect/​outputs.rs Updates summary rendering and tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The step summary truncated each ref to 7 bytes, not 7 chars. A branch
name whose 7th byte falls inside a multi-byte char (`releasé-2026`)
panicked with "byte index 7 is not a char boundary" and exit 101.
It runs on every GitHub Actions run (`$GITHUB_STEP_SUMMARY`) and on
Buildkite, with the base taken from `--base`, the event's default
branch, or BUILDKITE_PULL_REQUEST_BASE_BRANCH.

Truncate by chars. While here, escape the ref range like scope names
already are: a ref with a backtick or a newline could close the code
span and write its own heading into the summary.

A ref that is not valid UTF-8 never reaches this code: clap rejects
it for `--base`, env reads treat it as unset, and the event JSON is
UTF-8.

Fixes MRGFY-8855

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I6106bdddb1d2bb288d4bebd4e23d8b8ad6279f63
@sileht

sileht commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Revision history

# Type Changes Reason Date
1 initial 0745cf4 2026-10-05 14:28 UTC
2 content 0745cf4 → e143557 2026-10-05 14:28 UTC

@sileht
sileht force-pushed the devs/sileht/mrgfy-8855-scopes-ref-panic/stop-ci-scopes-panicking-non-ascii-base-head-ref--6106bddd branch from 0745cf4 to e143557 Compare October 5, 2026 14:28
@sileht
sileht deployed to func-tests-live October 5, 2026 14:28 — with GitHub Actions Active
@mergify
mergify Bot deployed to Mergify Merge Protections October 5, 2026 14:28 Active
@mergify
mergify Bot requested a review from a team October 5, 2026 14:35
@sileht
sileht marked this pull request as ready for review October 5, 2026 14:53
@mergify
mergify Bot requested a review from a team October 5, 2026 14:58
@mergify

mergify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-05 15:01 UTC · Rule: default · triggered by merge protections
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-05 15:01 UTC · at e265eb5196c565383e63c67a54f76ff4474337ad · squash

This pull request spent 40 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Oct 5, 2026
@mergify
mergify Bot merged commit e265eb5 into main Oct 5, 2026
@mergify
mergify Bot deleted the devs/sileht/mrgfy-8855-scopes-ref-panic/stop-ci-scopes-panicking-non-ascii-base-head-ref--6106bddd branch October 5, 2026 15:01
@mergify mergify Bot removed the queued label Oct 5, 2026

This branch was successfully deployed

2 active deployments
Mergify Merge Protections — e1435578 Deployed Oct 5, 2026 by mergify[bot]
func-tests-live — e1435578 Deployed Oct 5, 2026 by sileht
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants