Repository navigation
[bug-fix] Fix oversized-number-crash: bound Python --number parsing - #5200
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The missing Git extension and catalog version bumps prevent existing installations from receiving the fix, while discarded normalization causes valid, heavily zero-padded branch numbers to be rejected.
2 open issues
What changed in this PR
This PR addresses #5194 by bounding explicit --number values in the Git extension’s Python branch-creation script, replacing oversized-input tracebacks with argument errors.
Changes:
- Validates explicit numbers against
0..2**63-1before conversion. - Adds defensive handling for conversion failures.
- Adds Python-only tests for the maximum, maximum plus one, and 5,000-digit inputs; Bash and PowerShell behavior remains unchanged.
| File | Description |
|---|---|
tests/extensions/git/test_git_extension_python_parity.py |
Adds boundary and oversized-input regression tests. |
extensions/git/scripts/python/create_new_feature_branch.py |
Adds bounded number validation and conversion-error handling. |
Review effort: Balanced (auto)
Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The crash path for oversized explicit feature numbers is addressed through bounded non-negative int64 parsing, defensive conversion handling, and targeted regression coverage.
1 resolved since last review
Review effort: Lite (auto)
Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because the change introduces a critical bundled-extension test failure and an unhandled extreme-input path that can still produce a traceback.
1 resolved since last review
Review effort: Lite (auto)
…mber-crash-4b620ea38b337406 # Conflicts: # extensions/catalog.json # extensions/git/extension.yml Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Merged |


Bug fix — oversized-number-crash
Proposed fix for issue #5194, applying the
remediation from the bug assessment.
Verdict: valid · Severity: low
Summary
The Python extension branch-creation script now validates
--numberagainst a bounded integer domain before conversion, so oversized numeric inputs fail with a clear argument error instead of crashing atint().Changes
extensions/git/scripts/python/create_new_feature_branch.py0..2**63-1) for--numberand a defensive conversion guard with user-facing error text.tests/extensions/git/test_git_extension_python_parity.py--numberinputs; asserts no traceback on rejection.Tests Added or Updated
tests/extensions/git/test_git_extension_python_parity.py::TestCreateFeatureBranchParity::test_explicit_number_max_int64_accepted— verifies the maximum supported explicit number is accepted.tests/extensions/git/test_git_extension_python_parity.py::TestCreateFeatureBranchParity::test_explicit_number_above_max_int64_rejected— pins rejection for max+1 with expected error message.tests/extensions/git/test_git_extension_python_parity.py::TestCreateFeatureBranchParity::test_explicit_number_oversized_digits_rejected_without_traceback— verifies long digit strings are rejected cleanly without traceback.Local Verification
python3 extensions/git/scripts/python/create_new_feature_branch.py --json --dry-run --number 42 "some feature"→ pass (exit 0)python3 extensions/git/scripts/python/create_new_feature_branch.py --json --dry-run --number 9223372036854775808 "some feature"→ expected validation failure (exit 1, bounded-range error)python3 extensions/git/scripts/python/create_new_feature_branch.py --json --dry-run --number <5000-digit number> "some feature"→ expected validation failure (exit 1, bounded-range error, no traceback)python3 -m pytest ...could not run in this runner becausepytestis unavailable in the base Python environment.Deviations from Assessment
--numberhandling, rather than changing bash/powershell behavior in this fix-stage patch.Risks & Review Notes
--number; this PR intentionally scopes remediation to the Python crash path identified in the assessment.Refs #5194 · cc
@soarkit--numberand crashes atint()instead of rejecting it #5194