fix(bundles): reject non-ASCII digits in SemVer identifiers - #4835
Merged
Merged
Conversation
Restrict the SemVer regex to ASCII so Unicode decimal digits are rejected in bundle and component versions. Cover valid ASCII and invalid Unicode versions in both the version helper and the validate command. Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The targeted fix is correct and includes positive, negative, helper, and CLI regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes SemVer validation to reject Unicode digits while preserving accepted ASCII versions.
Changes:
- Compiles the SemVer regex with
re.ASCII. - Adds helper and CLI regression coverage for valid and invalid versions.
| File | Description |
|---|---|
src/specify_cli/bundles/versioning.py |
Restricts regex digit matching to ASCII. |
tests/specify_cli/bundles/test_versioning.py |
Adds focused SemVer cases. |
tests/specify_cli/bundles/test_command_validate.py |
Adds end-to-end manifest validation cases. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
Thank you! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Bundle validation currently accepts non-ASCII decimal digits in version identifiers. For example,
is_semver("1.2.3-٢alpha")returnsTrue, andspecify bundle validate --offline --path bundle.ymlreports a manifest with that version as valid (exit 0).Python's
\dmatches Unicode decimal digits by default. SemVer 2.0.0 requires ASCII digits in its numeric identifiers and ASCII characters in prerelease identifiers. Compile the existing expression withre.ASCIIso malformed bundle and component versions fail validation (exit 1). Add helper and CLI regressions for core, numeric prerelease, and alphanumeric prerelease identifiers, plus positive coverage for valid ASCII versions and the existing uppercaseVprefix.This is one validation bug fix: no new dependencies or changes to version comparison, command interfaces, or templates.
Testing
All verification below was performed by the disclosed agent on macOS with Python 3.14.8, using this checkout's own editable installation.
1.2.3-٢alphachanged from valid/exit 0 to invalid/exit 1.1.20.30-12alpha.1+build.01remains valid/exit 0.PATH="$PWD/.venv/bin:$PATH" .venv/bin/python -m pytest tests -q→ 9316 passed, 264 skipped, with network access for catalog tests. Initial invocation without the venv on PATH and without catalog connectivity had 13 failures; correcting those environment conditions cleared all failures. Skipped tests follow the suite's platform/tool requirements..venv/bin/ruff check src testswith Ruff 0.15.0 → all checks passed..venv/bin/specify --helpandgit diff --checkpassed.AI Disclosure
Contribution submitted by @mustafacicek-eee using OpenAI Codex. The contributor requested this contribution and authorized Codex to perform the technical work and submit the PR on their behalf. Codex used GPT-6 in autonomous mode; the exact model variant and reasoning-effort setting are not exposed to the agent. Codex researched the bug and existing contributions, authored the implementation and tests, ran and inspected the verification. @mustafacicek-eee initiated this work, chose to proceed with the Spec Kit contribution, and directed its submission.