Skip to content

[bug-fix] Fix non-latin-feature-names: preserve Unicode feature names - #4780

Open
github-actions[bot] wants to merge 4 commits into
mainfrom
fix/4574-non-latin-feature-names-e406e85dcd5b1c74
Open

github-actions[bot] wants to merge 4 commits into
mainfrom
fix/4574-non-latin-feature-names-e406e85dcd5b1c74

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Bug fix — non-latin-feature-names

Fixes #4574 using the UTF-8 naming policy clarified by the maintainer in the issue.

Summary

Feature descriptions and explicit short names retain Unicode letters and decimal digits across Bash, PowerShell, and Python. Non-Latin descriptions now produce readable branch and feature-directory names instead of 001-. Punctuation-only descriptions retain the existing empty-name warning. The three variants truncate UTF-8 branch names on character boundaries to meet GitHub's 244-byte limit.

Changes

  • Update scripts/bash/create-new-feature.sh, scripts/powershell/create-new-feature.ps1, and scripts/python/create_new_feature.py to share the Unicode letter/decimal-digit policy and enforce the byte limit. Bash uses a Python 3 interpreter to classify non-ASCII characters consistently across POSIX locales; ASCII names remain shell-only. Python emits UTF-8 on both stdout and stderr so Windows can report non-Latin feature names.
  • Update tests/test_create_new_feature_python_parity.py and tests/parity_helpers.py with positive and negative cases for non-Latin names, Unicode number categories, CP1252 stdout/stderr, punctuation-only warnings, unavailable UTF-8 locales, unavailable Python for Bash Unicode names, and valid UTF-8 truncation. Correct the faulty expected word identified by the bug-test report and replace pre-fix ASCII-only expectations.
  • Update docs/reference/core.md to describe UTF-8 names, decimal-digit policy, and Bash requirements for a UTF-8 locale and Python 3 when using non-ASCII names.

Verification and review

  • Regression confirmed before the change: the Chinese name test failed with actual 001-, expected 001-添加用户. Review-round tests also reproduced the Windows CP1252 UnicodeEncodeError and mismatched x² category output before their fixes.
  • On the exact PR checkout, the Bash/Python/PowerShell feature-naming and timestamp suites pass: 212 passed, 4 skipped. The previous Ubuntu CI run exposed a POSIX locale mismatch; commit f2c0f938 removes Bash's dependence on locale character classes for Unicode classification.
  • Full CI on f2c0f938 passes for Ubuntu, macOS, and Windows with Python 3.13 and 3.14, plus ruff, shellcheck, markdownlint, and other checks. Human review remains pending; reviewer conversations were left unresolved.

Existing descriptions with non-ASCII letters will now generate different names. The optional extensions/git scripts are outside this create-new-feature change.

Follow-up commits 89cee3e3, 461d1583, and f2c0f938 were authored autonomously by GitHub Copilot (GPT-6 Sol) on behalf of @mnriem. They update the original automated proposal; local test evidence is not a claim of human review. The initial proposal was generated by the bug-fix workflow below.

Generated by 🛠️ Fix Bug from Labeled Issue for #4574 · copilot · gpt52codex · 3.45 AIC · ⌖ 7.44 AIC · ⊞ 17K · ◷

Apply the remediation from the bug assessment on issue #4574.

Refs #4574

Assisted-by: GitHub Copilot (model: gpt-5.2-codex, autonomous)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automated bug-fix Trigger the bug-fix agentic workflow labels Sep 28, 2026
@mnriem mnriem added the triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate label Sep 29, 2026
Replace the initial proposed sanitizer with Unicode-aware name generation across Bash, PowerShell, and Python. Keep UTF-8 branch names within GitHub byte limits, preserve existing punctuation-only warnings, and update parity tests and documentation. Refs #4574.

Assisted-by: GitHub Copilot (model: GPT-6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mnriem
mnriem requested a balanced review from Copilot September 29, 2026 12:58
@mnriem
mnriem marked this pull request as ready for review September 29, 2026 12:58
@mnriem
mnriem self-requested a review as a code owner September 29, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Windows Unicode output currently fails, and the three backends disagree for some Unicode number categories.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Preserves Unicode feature names consistently across the core creation scripts and documents the updated naming policy.

Changes:

  • Retains Unicode letters and digits across Bash, PowerShell, and Python.
  • Enforces the 244-byte branch limit on UTF-8 boundaries.
  • Adds cross-backend regression and parity coverage.
File Description
scripts/​bash/​create-new-feature.sh Adds locale-aware Unicode naming and byte truncation.
scripts/​powershell/​create-new-feature.ps1 Preserves Unicode categories and safely truncates UTF-8.
scripts/​python/​create_new_feature.py Retains Unicode names and counts encoded bytes.
tests/​test_create_new_feature_python_parity.py Expands Unicode, locale, warning, and truncation tests.
docs/​reference/​core.md Documents Unicode naming and Bash locale requirements.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/python/create_new_feature.py Outdated

def _clean_branch_name(name: str) -> str:
cleaned = re.sub(r"[^a-z0-9]", "-", name.lower())
cleaned = re.sub(r"[^\w]|_", "-", name.translate(_ASCII_LOWER))
Comment thread scripts/bash/create-new-feature.sh Outdated
local -x LC_ALL=C
printf '%s\n' "$name" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//'
local -x LC_ALL="$UNICODE_LOCALE"
printf '%s\n' "$name" | LC_ALL=C tr '[:upper:]' '[:lower:]' | sed 's/[^[:alnum:]]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//'
Comment on lines +162 to +166
if [ -z "$UNICODE_LOCALE" ]; then
UNICODE_LOCALE=C
if printf '%s' "${SHORT_NAME:-$FEATURE_DESCRIPTION}" | LC_ALL=C grep -q '[^ -~]'; then
echo "Error: A UTF-8 locale is required to create a Unicode feature name" >&2
exit 1
mnriem and others added 2 commits September 29, 2026 08:27
Use Unicode letters and decimal digits consistently for feature names. Emit Python output as UTF-8 on Windows, decode parity subprocesses as UTF-8, and test the no-locale error and non-decimal number cases. Refs #4574.

Assisted-by: GitHub Copilot (model: GPT-6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use Python 3 for non-ASCII character classification where POSIX locale classes vary by platform. Preserve the shell-only ASCII path, report a clear error when a Unicode name lacks Python, and cover both paths. Refs #4574.

Assisted-by: GitHub Copilot (model: GPT-6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mnriem

mnriem commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Addressed this review in 461d1583 and f2c0f938 (current head). Python now writes UTF-8 in JSON and text modes, and the parity harness decodes UTF-8 explicitly. All three backends use Unicode letters and decimal digits; Bash uses Python 3 to classify non-ASCII characters because POSIX locale classes differ across platforms, while ASCII names still work without Python. Added regression coverage for CP1252 output, number categories, unavailable UTF-8 locales, and missing Python for a Unicode Bash name.

Validation: the naming/timestamp suites on the PR checkout passed (212 passed, 4 skipped), and the full pytest matrix now passes on Ubuntu, macOS, and Windows for Python 3.13 and 3.14. Ruff, shellcheck, markdownlint, and the other reported checks are green. The existing review request remains pending; I have not resolved the review threads.

AI disclosure: On behalf of @mnriem, GitHub Copilot (GPT-6 Sol; autonomous code authoring in an interactive session) authored the follow-up code, tests, documentation, PR-body update, and this comment. Local and CI validations were automated; no human line-by-line review is claimed.

This branch has not been deployed

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

Labels

automated bug-fix Trigger the bug-fix agentic workflow triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Non-Latin feature descriptions produce a nameless branch/directory (001-, 004-, ...)

2 participants