Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

chore(ci): refuse huge-digit version components via return False in is_major_release; pin canonical spellings (#7357)

LearningCircuit5d4fc0536e4e
diff --git a/scripts/ci/check_breaking_release.py b/scripts/ci/check_breaking_release.py
index f30c4806ed..0952e6dce9 100644
--- a/scripts/ci/check_breaking_release.py
+++ b/scripts/ci/check_breaking_release.py
@@ -59,7 +59,14 @@ def is_major_release(version):
match = _VERSION_RE.fullmatch(version.strip().lower())
if not match:
return False
- major, minor, patch = (int(group) for group in match.groups())
+ try:
+ major, minor, patch = (int(group) for group in match.groups())
+ except ValueError:
+ # A ≥4301-digit component exceeds CPython's int() string
+ # conversion limit and the conversion itself raises; refuse via
+ # the documented False path instead of escaping as a traceback,
+ # so the workflow still sees the designed ::error:: annotation.
+ return False
if patch != 0:
return False
if major >= 1:
diff --git a/tests/ci/test_breaking_release_full_version.py b/tests/ci/test_breaking_release_full_version.py
index ab9915c276..d4fc42d8da 100644
--- a/tests/ci/test_breaking_release_full_version.py
+++ b/tests/ci/test_breaking_release_full_version.py
@@ -18,7 +18,9 @@ import release_package # noqa: E402
[
("2.0.0-post1", "2.0.0.post1", False),
("2.0.0-1", "2.0.0.post1", False),
+ ("2.0.0.post1", "2.0.0.post1", False),
("0.5.0.post1", "0.5.0.post1", False),
+ ("0.5.0.post2", "0.5.0.post2", False),
("2.0.0_rev_2", "2.0.0.post2", False),
("2.0.0r", "2.0.0.post0", False),
("2.0.0rc1.post2.dev3", "2.0.0rc1.post2.dev3", False),
@@ -43,6 +45,7 @@ import release_package # noqa: E402
("2.0.0pre", "2.0.0rc0", True),
("0.5.0c1", "0.5.0rc1", True),
("2.0.0-dev", "2.0.0.dev0", True),
+ ("2.0.0.dev5", "2.0.0.dev5", True),
("2.0.0rc1.dev2", "2.0.0rc1.dev2", True),
("1.11.0rc1", "1.11.0rc1", False),
("2.0.1", "2.0.1", False),
@@ -57,6 +60,23 @@ def test_major_boundary_matches_publisher_version(
assert check_breaking_release.is_major_release(version) is major
+# CPython's int() string-conversion limit: a ≥4301-digit component makes
+# the conversion itself raise ValueError instead of producing a number.
+_HUGE_DIGITS = 4301
+_HUGE_VERSION = "9" * _HUGE_DIGITS + ".0.0"
+
+
+def test_huge_digit_component_is_refused_by_returning_false() -> None:
+ """The docstring's refuse-by-False contract holds for huge digits.
+
+ ``int()`` on a ≥4301-digit string raises ``ValueError`` (CPython's
+ conversion limit), so the guard must refuse via its designed
+ ``return False`` path — not escape as a traceback. The guard stays
+ fail-closed either way, but the documented contract is return False.
+ """
+ assert check_breaking_release.is_major_release(_HUGE_VERSION) is False
+
+
@pytest.mark.parametrize(
"version",
[
@@ -132,3 +152,43 @@ def test_cli_enforces_full_version_when_breaking_changes_are_pending(
f"::error::Version {version} is not a major release,"
)
assert fragment.name in result.stdout
+
+
+def test_cli_pending_fragments_with_huge_version_fails_closed(
+ tmp_path: Path,
+) -> None:
+ """Pending fragments + a huge-digit version exit 1 via ::error::.
+
+ The version's first component exceeds CPython's ``int()`` string
+ conversion limit, so a missing ``ValueError`` guard in
+ ``is_major_release`` would surface as a traceback on stderr instead
+ of the designed ``::error::`` annotation the release workflow
+ reads.
+ """
+ fragment = tmp_path / "7332.breaking.md"
+ fragment.write_text("Breaking change\n", encoding="utf-8")
+
+ result = subprocess.run(
+ [
+ sys.executable,
+ "-I",
+ "-S",
+ str(SCRIPT),
+ "--pyproject",
+ str(ROOT / "pyproject.toml"),
+ "--changelog-dir",
+ str(tmp_path),
+ "version",
+ _HUGE_VERSION,
+ ],
+ capture_output=True,
+ text=True,
+ check=False,
+ )
+
+ assert result.returncode == 1
+ assert result.stderr == ""
+ assert result.stdout.startswith(
+ f"::error::Version {_HUGE_VERSION} is not a major release,"
+ )
+ assert fragment.name in result.stdout