Skip to content

[bug-fix] Fix oversized-number-crash: bound Python --number parsing - #5200

Open
github-actions[bot] wants to merge 2 commits into
mainfrom
fix/5194-oversized-number-crash-4b620ea38b337406
Open

github-actions[bot] wants to merge 2 commits into
mainfrom
fix/5194-oversized-number-crash-4b620ea38b337406

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

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 --number against a bounded integer domain before conversion, so oversized numeric inputs fail with a clear argument error instead of crashing at int().

Changes

File Change Notes
extensions/git/scripts/python/create_new_feature_branch.py modified Added int64-style bound validation (0..2**63-1) for --number and a defensive conversion guard with user-facing error text.
tests/extensions/git/test_git_extension_python_parity.py modified Added boundary and regression tests for max, max+1, and oversized digit-only --number inputs; 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

  • Commands run: python3 extensions/git/scripts/python/create_new_feature_branch.py --json --dry-run --number 42 "some feature" → pass (exit 0)
  • Commands run: 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)
  • Commands run: 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 because pytest is unavailable in the base Python environment.

Deviations from Assessment

  • Added Python-only parity tests that explicitly codify current divergence from bash for oversized --number handling, rather than changing bash/powershell behavior in this fix-stage patch.

Risks & Review Notes

  • Bash/PowerShell extension twins currently do not enforce the same explicit upper bound for --number; this PR intentionally scopes remediation to the Python crash path identified in the assessment.

Refs #5194 · cc @soarkit

Generated by 🛠️ Fix Bug from Labeled Issue for #5194 · copilot · gpt53codex · 49.1 AIC · ⌖ 0.695 AIC · ⊞ 25.1K · ◷

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

Refs #5194

Assisted-by: GitHub Copilot (model: gpt-5.3-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 Oct 30, 2026
@mnriem mnriem added the triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate label Oct 30, 2026
@mnriem
mnriem requested an auto review from Copilot November 2, 2026 14:23
@mnriem
mnriem marked this pull request as ready for review November 2, 2026 14:23
@mnriem
mnriem self-requested a review as a code owner November 2, 2026 14:23

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.

🟡 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-1 before 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)


SCRIPT_DIR = Path(__file__).resolve().parent
MAX_BRANCH_LENGTH = 244 # GitHub enforces a 244-byte limit on branch names
MAX_FEATURE_NUMBER = 2**63 - 1

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.

Fixed in commit 7bda569: the Git extension manifest and catalog are both bumped to 1.0.2.

Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>

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.

🟢 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 open issue
1 resolved since last review

Review effort: Lite (auto)

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.

The Python branch-creation port accepts an oversized --number and crashes at int() instead of rejecting it

3 participants