Skip to content

fix(ci): pin non-UTF-8 scope paths to the name GitHub reports - #1879

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/sileht/mrgfy-8289-scopes-non-utf8-paths/pin-non-utf-8-scope-paths-name-github-reports--37852b3d
Oct 5, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
devs/sileht/mrgfy-8289-scopes-non-utf8-paths/pin-non-utf-8-scope-paths-name-github-reports--37852b3d

Conversation

@sileht

@sileht sileht commented Oct 5, 2026

Copy link
Copy Markdown
Member

mergify ci scopes decodes git diff output lossily, so a Latin-1
critical/caf\xe9.txt reaches the scope globs as
critical/caf\u{FFFD}.txt. The ticket read that as corruption and
leaned toward hard-erroring like mergify_stack's run_git_capture.

It is not corruption. The engine scopes a pull request from GitHub's
files API, and that API reports the same path with the same U+FFFD
replacement (checked on a sandbox repository holding a Latin-1 and a
Shift-JIS name). The lossy decode is therefore the name the engine
matches. An error would fail CI on a pull request the engine scopes
fine, and no pattern in the UTF-8 YAML config can spell the raw bytes.

Keep the decode, say why in the doc comment that used to describe it
as a known defect, and pin both probed names in a test so a later
switch to strict decoding fails loudly. The test helpers now also drop
GIT_INDEX_FILE and friends, since the new one writes the index
directly.

What still differs on such paths, and on any non-ASCII path, is glob
semantics: globset's ? and [...] match bytes, the engine's match
characters, so caf?.txt misses caf\u{FFFD}.txt here and hits it
there. That is MRGFY-10066; matching.rs no longer claims exact parity.

Fixes MRGFY-8289

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

Copilot AI balanced review requested due to automatic review settings October 5, 2026 12:50
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections October 5, 2026 12:50 Failure
@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.

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

🟢 Approval recommended

The documented behavior and regression coverage consistently preserve engine-compatible path handling.

Review effort: Balanced
Findings: None

What changed in this PR

Clarifies intentional lossy decoding of non-UTF-8 Git paths to match GitHub’s files API behavior.

Changes:

  • Documents non-ASCII glob parity limitations.
  • Adds isolated Git helpers and regression coverage for Latin-1 and Shift-JIS paths.
  • Removes stale Python-port references.
File Description
crates/​mergify-ci/​src/​scopes_detect/​matching.rs Documents non-ASCII glob differences.
crates/​mergify-ci/​src/​scopes_detect/​changed_files.rs Explains lossy decoding and adds regression tests.

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

`mergify ci scopes` decodes `git diff` output lossily, so a Latin-1
`critical/caf\xe9.txt` reaches the scope globs as
`critical/caf\u{FFFD}.txt`. The ticket read that as corruption and
leaned toward hard-erroring like `mergify_stack`'s `run_git_capture`.

It is not corruption. The engine scopes a pull request from GitHub's
files API, and that API reports the same path with the same U+FFFD
replacement (checked on a sandbox repository holding a Latin-1 and a
Shift-JIS name). The lossy decode is therefore the name the engine
matches. An error would fail CI on a pull request the engine scopes
fine, and no pattern in the UTF-8 YAML config can spell the raw bytes.

Keep the decode, say why in the doc comment that used to describe it
as a known defect, and pin both probed names in a test so a later
switch to strict decoding fails loudly. The test helpers now also drop
GIT_INDEX_FILE and friends, since the new one writes the index
directly.

What still differs on such paths, and on any non-ASCII path, is glob
semantics: globset's `?` and `[...]` match bytes, the engine's match
characters, so `caf?.txt` misses `caf\u{FFFD}.txt` here and hits it
there. That is MRGFY-10066; matching.rs no longer claims exact parity.

Fixes MRGFY-8289

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I37852b3d50345f42b6dfe8cca6e1b36c8858a3fb
@sileht
sileht force-pushed the devs/sileht/mrgfy-8289-scopes-non-utf8-paths/pin-non-utf-8-scope-paths-name-github-reports--37852b3d branch from ce020e1 to 5183302 Compare October 5, 2026 12:53
@sileht

sileht commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Revision history

# Type Changes Reason Date
1 initial ce020e1 2026-10-05 12:53 UTC
2 content ce020e1 → 5183302 2026-10-05 12:53 UTC

@mergify
mergify Bot deployed to Mergify Merge Protections October 5, 2026 12:53 Active
@sileht
sileht deployed to func-tests-live October 5, 2026 12:53 — with GitHub Actions Active
@mergify
mergify Bot requested a review from a team October 5, 2026 13:01
@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:59
@mergify

mergify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 9 minutes 41 seconds in the queue, including 8 minutes 57 seconds running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Oct 5, 2026
@mergify
mergify Bot merged commit 9f05ccf into main Oct 5, 2026
23 checks passed
@mergify
mergify Bot deleted the devs/sileht/mrgfy-8289-scopes-non-utf8-paths/pin-non-utf-8-scope-paths-name-github-reports--37852b3d branch October 5, 2026 15:10
@mergify mergify Bot removed the queued label Oct 5, 2026

This branch was successfully deployed

2 active deployments
func-tests-live — 5183302a Deployed Oct 5, 2026 by sileht via live-tests #1970
Mergify Merge Protections — 5183302a Deployed Oct 5, 2026 by mergify[bot]
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