You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(scripts): keep combining marks inside Unicode feature-name words - #5564
The core create-new-feature scripts (bash, Python, PowerShell) keep only Unicode letters (L*) and decimal digits when building a branch name. Combining marks (Mn/Mc/Me) are treated as separators, so words in scripts that write vowels and diacritics as marks are split mid-word:
Description
Before
After
नमस्ते दुनिया
001-नमस-त-द
001-नमस्ते-दुनिया
สร้างระบบล็อกอิน
001-สร-างระบบล-อกอ-น
001-สร้างระบบล็อกอิน
مَرْحَبًا بالعالم
letters split at each diacritic
001-مَرْحَبًا-بالعالم
cafe + U+0301 (decomposed)
001-cafe (accent dropped)
accent kept
The fix keeps marks inside words in all three twins: unicodedata.category(char).startswith("M") in Python and in the bash helper's embedded Python, and \p{M} (plus the surrogate-pair Mark categories) in PowerShell. ASCII and CJK behavior is unchanged. The git extension scripts are not touched, to avoid overlap with #5559.
Testing
Added test_combining_marks_stay_inside_words (bash / Python / PowerShell variants). Before the change the bash and Python variants fail on all four cases (8 failures); after, they pass.
Not run: the PowerShell variant. No Windows PowerShell 5.1 is available to me, so that test is skipped locally and the PowerShell change is unverified. It is a one-token regex change (\p{L}\p{Nd} to \p{L}\p{M}\p{Nd}) that .NET supports on 5.1; please run the PowerShell variant in CI or on Windows.
AI Disclosure
I did not use AI assistance for this contribution
I did use AI assistance (fill in the disclosure below)
AI disclosure: Claude Code (Anthropic) using Claude Sonnet 5.5, run autonomously on behalf of the contributor (JayPokale). The agent found the defect, wrote the regression test, and wrote the fix and this description. The commit carries an Assisted-by: trailer.
The core create-new-feature scripts kept only letters (L*) and decimal
digits when building branch names, so combining marks (Mn/Mc/Me) were
treated as separators. Scripts that write vowels and diacritics as marks
(Devanagari, Thai, Arabic with harakat, decomposed accents) were split
mid-word: "नमस्ते दुनिया" became "001-नमस-त-द". Keep marks in the bash,
Python and PowerShell variants.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The sanitizer regression cases prefer pwsh when both runtimes are installed, leaving the changed behavior untested on Windows PowerShell 5.1 despite the documented testing requirement.
This PR preserves combining marks in feature branch names across the three core scripts, preventing Unicode words from being split at vowels or diacritics. Git extension scripts remain out of scope, separate from #5559.
Changes:
Retain Unicode mark categories alongside letters and decimal digits.
Add regression cases for Devanagari, Thai, Arabic diacritics, and decomposed accents.
File
Description
tests/test_create_new_feature_python_parity.py
Adds combining-mark cases across all three script variants.
scripts/python/create_new_feature.py
Preserves Unicode marks during word sanitization.
scripts/powershell/create-new-feature.ps1
Preserves marks in both BMP and surrogate-pair handling.
scripts/bash/create-new-feature.sh
Updates the embedded Python sanitizer to preserve marks.
…ll 5.1
The regression test used ps_cmd, which prefers pwsh, so the PowerShell
sanitizer change was never exercised on Windows PowerShell 5.1. Run the
PowerShell cases explicitly through pwsh and WINDOWS_POWERSHELL, each
skipped when its runtime is absent.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
test_combining_marks_stay_inside_words now has separate pwsh and windows-powershell-5.1 variants. Each runs create-new-feature.ps1 through its own explicit executable and skips when that runtime is absent, so the sanitizer change is no longer exercised only through whichever runtime ps_cmd prefers.
Locally the parity file gives 110 passed and 76 skipped, and ruff check src tests passes. No PowerShell is installed on my machine, so both PowerShell variants skipped here and the 5.1 variant has not run yet. Please check it in CI or on Windows.
AI disclosure: this comment and the commit were produced by Claude Code (Anthropic, model Claude Sonnet 5.5, run autonomously) on behalf of the contributor, JayPokale. The agent wrote the test change, the commit and this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Mismatched PowerShell runtime parameters and dispatch logic cause test cases to raise KeyError before script execution, leaving the sanitizer changes untested.
…ombining-marks test
The previous commit parametrized the wrong test: test_empty_feature_name_warning
received the pwsh and windows-powershell-5.1 variants but still looks up
"powershell" in its command table, so every pwsh case raised KeyError.
Restore that test's original "powershell" variant and move the two explicit
runtimes to test_combining_marks_stay_inside_words, which already handles them.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
Cause: in a206c23 I put the new pwsh and windows-powershell-5.1 variants on test_empty_feature_name_warning instead of test_combining_marks_stay_inside_words. The first test still looks up "powershell" in its command table, so every pwsh case raised KeyError: 'pwsh' on the runners that have pwsh installed.
Change: test_empty_feature_name_warning has its original powershell variant back, and the two explicit runtimes now sit on the combining-marks test, which already handles them. Locally tests/test_create_new_feature_python_parity.py gives 110 passed, 68 skipped; the skips are the PowerShell cases, because neither pwsh nor Windows PowerShell is installed on my machine, so CI is the first place those run.
Copilot feedback: already addressed in a206c23 (separate pwsh and windows-powershell-5.1 variants, each skipped when its runtime is absent).
AI disclosure: this comment and the commit were written by Claude Code (Claude Sonnet 5.5), acting for the PR author.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The slug-generation logic retains orphan emoji variation selectors across all three implementations, producing malformed feature names and allowing emoji-only input to bypass the empty-name warning.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Prevent orphan variation selectors from affecting generated feature names
scripts/python/create_new_feature.py:184
Keeping every mark leaves an orphan U+FE0F variation selector after an emoji base is removed: Add ⚙️ user login screen settings produces 001-\uFE0F-user-login instead of 001-user-login-screen-settings, and emoji-only input bypasses the empty-name warning. Preserve marks only after a retained letter/digit within the current word, reset that state at separators, and add emoji regression cases. Apply the same correction in scripts/bash/create-new-feature.sh:209 and scripts/powershell/create-new-feature.ps1:96–100.
AI-generated review by GitHub Copilot (model: unknown; autonomous), for the requester.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
triage-must-haveVerdict: high-value, important work for Spec Kit — do first
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The core
create-new-featurescripts (bash, Python, PowerShell) keep only Unicode letters (L*) and decimal digits when building a branch name. Combining marks (Mn/Mc/Me) are treated as separators, so words in scripts that write vowels and diacritics as marks are split mid-word:नमस्ते दुनिया001-नमस-त-द001-नमस्ते-दुनियाสร้างระบบล็อกอิน001-สร-างระบบล-อกอ-น001-สร้างระบบล็อกอินمَرْحَبًا بالعالم001-مَرْحَبًا-بالعالمcafe+ U+0301 (decomposed)001-cafe(accent dropped)The fix keeps marks inside words in all three twins:
unicodedata.category(char).startswith("M")in Python and in the bash helper's embedded Python, and\p{M}(plus the surrogate-pairMarkcategories) in PowerShell. ASCII and CJK behavior is unchanged. The git extension scripts are not touched, to avoid overlap with #5559.Testing
Added
test_combining_marks_stay_inside_words(bash / Python / PowerShell variants). Before the change the bash and Python variants fail on all four cases (8 failures); after, they pass..venv/bin/specify --helppytest tests/test_create_new_feature_python_parity.py tests/test_check_prerequisites_python_parity.py(156 passed, 81 skipped) andpytest tests -k "create_new_feature or branch"(308 passed, 135 skipped);ruff check src testspasses (0.15.0)Not run: the PowerShell variant. No Windows PowerShell 5.1 is available to me, so that test is skipped locally and the PowerShell change is unverified. It is a one-token regex change (
\p{L}\p{Nd}to\p{L}\p{M}\p{Nd}) that .NET supports on 5.1; please run the PowerShell variant in CI or on Windows.AI Disclosure
AI disclosure: Claude Code (Anthropic) using Claude Sonnet 5.5, run autonomously on behalf of the contributor (JayPokale). The agent found the defect, wrote the regression test, and wrote the fix and this description. The commit carries an
Assisted-by:trailer.