Skip to content

fix(releasekit): fix git push argument order, boost test coverage to 92%, fix lint errors#4667

Merged
yesudeep merged 8 commits intomainfrom
yesudeep/fix/lethal-start
Feb 15, 2026
Merged

fix(releasekit): fix git push argument order, boost test coverage to 92%, fix lint errors#4667
yesudeep merged 8 commits intomainfrom
yesudeep/fix/lethal-start

Conversation

@yesudeep
Copy link
Contributor

@yesudeep yesudeep commented Feb 14, 2026

Problem

Run #22008381084 failed with:

RuntimeError: Failed to push release branch 'releasekit--release--py':
fatal: The current branch releasekit--release--py has no upstream branch.

The git push origin --set-upstream command has invalid argument order. Git requires --set-upstream before the remote, and the branch name must be explicitly specified as a refspec.

Additionally, test coverage was at 83% (below the 90% CI threshold) and several new test files had lint errors (D102, E501, ANN202).

Fixes

1. Git push argument order (git.py)

Changed git.py:push() from:

git push origin --set-upstream

to:

git push --set-upstream origin <branch>

The branch name is resolved via git branch --show-current.

2. Test coverage: 83% → 92%

Added 200 new tests across 10 modules covering package managers, registries, VCS, and workspace backends:

Test file Module Tests
rk_pm_cargo_test.py CargoBackend build, publish (mocked), lock, version_bump, resolve_check, smoke_test
rk_pm_maven_test.py MavenBackend Maven + Gradle paths for all 6 PM methods
rk_pm_dart_test.py DartBackend dart pub build/publish/lock/version_bump/resolve_check/smoke_test
rk_pm_go_test.py GoBackend go build/publish/lock/version_bump/resolve_check/smoke_test
rk_registry_pubdev_test.py PubDevRegistry check_published, poll_available, project_exists, latest_version, verify_checksum
rk_registry_maven_central_test.py MavenCentralRegistry all Registry protocol methods with HTTP mocking
rk_registry_goproxy_test.py GoProxyCheck all Registry protocol methods with HTTP mocking
rk_registry_crates_io_test.py CratesIoRegistry all Registry protocol methods with HTTP mocking
rk_vcs_mercurial_test.py MercurialCLIBackend is_clean, is_shallow, default_branch, commit, tag, push, checkout
rk_workspace_maven_test.py MavenWorkspace Maven/Gradle discover, version rewrite, dependency rewrite

All 2200 tests pass with 92% coverage.

3. Lint fixes (D102, E501, ANN202)

  • Created AST-based fixer script py/bin/fix_missing_test_docstrings.py to add 191 missing docstrings (D102) across all new test files
  • Fixed ANN001/ANN003/ANN202 type annotations in _fake_run_command
  • Ran ruff format on all new test files (E501 resolved)
  • ruff check --preview reports 0 errors on all new test files

4. GEMINI.md guideline: "Fixer Scripts Over Shell Eval"

Added a new guideline to all 3 Python GEMINI.md files (py/, py/tools/releasekit/, py/samples/web-endpoints-hello/) requiring:

  • Never eval/exec strings at the command line for code fixes
  • Write Python fixer scripts using ast module or libcst
  • Prefer AST-based transforms over regex for Python code
  • Use ruff check --fix before writing custom fixers
  • Fixer scripts must be idempotent and committed to the repo

Testing

  • All 2200 releasekit tests pass (92% coverage)
  • ruff check --preview reports 0 errors on all new/modified files
  • Fixer script is idempotent (re-running produces no changes)

The command was 'git push origin --set-upstream' which is invalid.
Correct syntax: 'git push --set-upstream origin <branch>'.

The --set-upstream flag must come before the remote, and the branch
name must be explicitly specified as a refspec.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yesudeep, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue in the releasekit tool where the git push --set-upstream command was failing due to an incorrect argument order. The fix reorders the arguments and ensures the current branch name is explicitly provided, resolving release failures related to upstream branch configuration.

Highlights

  • Fix Git Push Argument Order: Corrected the argument order for the git push --set-upstream command within the releasekit tool to ensure proper upstream branch setting.
  • Explicit Branch Specification: Modified the push function to explicitly include the current branch name when using --set-upstream, as required by Git.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • py/tools/releasekit/src/releasekit/backends/vcs/git.py
    • Fixed the argument order for the git push --set-upstream command.
    • Added logic to explicitly retrieve and include the current branch name when setting the upstream.
Activity
  • Identified a RuntimeError during a release run due to an invalid git push command.
  • Proposed a fix by reordering arguments for git push --set-upstream and explicitly adding the branch name.
  • Confirmed all 1301 releasekit tests pass with 83% coverage after applying the fix.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes a bug in the git push command where the arguments for --set-upstream were in the wrong order. The change correctly reorders the arguments and adds the required branch name. The fix is effective and addresses the problem described. I have one minor suggestion to improve the code's readability by restructuring how the command arguments are assembled.

1. git.py: restructure push() per review feedback; skip --set-upstream
   for tag-only pushes (--set-upstream + --tags conflict)
2. github.py: add url to list_prs --json fields; use --body-file for
   create_pr to avoid shell argument size limits
3. github_api.py: add url to list_prs results; extract html_url from
   create_pr response instead of returning raw JSON
4. prepare.py: fall back to bootstrap_sha when per-package tag doesn't
   exist (bootstrapping issue on first release)
5. tags.py: make tag push failure fatal (raise RuntimeError)
6. commitback.py: make push failure fatal (raise RuntimeError)

All 1301 tests pass (83% coverage).
R1: github.py update_pr — use --body-file to avoid shell arg size limits
R2: git.py commit — fix git add -A logic (don't run add -A in dry_run)
R3: git.py delete_tag — return remote push failure instead of swallowing
R4: gitlab.py create_pr — use temp file for large MR descriptions
R5: bitbucket.py list_prs — add missing url field
R6: gitlab.py list_prs — add missing url field
R7: pnpm.py lock — don't discard check_only when upgrade_package is set

All 1301 tests pass (83% coverage).
Replace Path.unlink() with os.unlink() in async functions to avoid
blocking pathlib calls flagged by the ASYNC240 linter rule.
20 tests against real git repos (with bare remote):
- push --set-upstream on new branch
- push --tags (verifies no --set-upstream conflict)
- push set_upstream=False
- checkout_branch create/switch
- current_branch
- tag, tag_exists, list_tags, list_tags with pattern
- delete_tag local and remote (verifies remote failure propagation)
- log with since_tag, paths, max_commits
- diff_files since_tag
- commit with paths (partial stage), without paths (git add -A), dry_run
- is_shallow, default_branch

All 1321 tests pass (83% coverage).
45 integration tests exercising real CLI commands on temp repos:
- git (20): push, tags, branches, commit, log, diff, delete_tag
- uv (7): build, lock, lock --check, version_bump + dry-run variants
- pnpm (7): pack, lock, frozen-lockfile, npm version + dry-run variants
- gh (11): release create, pr create/update/merge, labels (dry-run)

Each test file uses shutil.which() skipif markers so tests warn and
skip locally when a tool is missing, but run in CI where all tools
are installed.

CI workflow (python.yml) updated to install pnpm, node, and gh CLI
in the tool-tests job.
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 2 times, most recently from ca06542 to 7d61f8c Compare February 14, 2026 03:09
@github-actions github-actions bot added the root label Feb 14, 2026
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 2 times, most recently from 09a9c1c to 963069f Compare February 14, 2026 03:35
@github-actions github-actions bot added the docs Improvements or additions to documentation label Feb 14, 2026
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 6 times, most recently from 6ab220b to d29cc74 Compare February 15, 2026 02:37
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 2 times, most recently from 83b0b6b to b80b330 Compare February 15, 2026 09:57
@yesudeep yesudeep changed the title fix(releasekit): fix git push argument order for --set-upstream fix(releasekit): fix git push argument order, boost test coverage to 92%, fix lint errors Feb 15, 2026
@yesudeep
Copy link
Contributor Author

/gemini review

@yesudeep yesudeep enabled auto-merge (squash) February 15, 2026 10:03
@yesudeep yesudeep disabled auto-merge February 15, 2026 10:03
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an extensive and high-quality pull request that significantly enhances the releasekit tool. The fix for the git push argument order is crucial, and the boost in test coverage to 92% is impressive. The addition of new backends for Go, Dart, Java/Gradle, and Rust greatly expands the tool's utility. I particularly appreciate the robust error handling improvements, such as using atomic file operations for locking and providing more informative error hints. The new guidelines in GEMINI.md on configurability, fixer scripts, and error reporting are excellent additions that will improve code quality and maintainability. The refactoring to centralize utilities and the careful handling of large command-line arguments using temporary files demonstrate thoughtful engineering. I have a couple of minor suggestions for improving the robustness of the new workspace parsing logic, but overall, this is an outstanding contribution.

@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 9 times, most recently from 50876d2 to 688084a Compare February 15, 2026 13:28
@yesudeep yesudeep marked this pull request as draft February 15, 2026 13:29
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 2 times, most recently from 6b75c65 to 1e1f7df Compare February 15, 2026 14:41
@yesudeep
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is a substantial and high-quality pull request that addresses several key areas. The fix for the git push argument order is correct and critical. The significant increase in test coverage to 92% is a fantastic achievement that will improve the long-term stability of the codebase. The introduction of an AST-based fixer script for linting is a great example of automating developer workflows effectively. Furthermore, the extensive additions to documentation and support for multiple new ecosystems are impressive and will greatly benefit the project.

My review has identified a couple of minor regressions. One is related to error handling in the commit-back feature, where a graceful failure has been replaced with one that could crash the process. The other is a change in the dry-run behavior for git add commands, which reduces visibility. I've provided detailed comments and suggestions for these points. Overall, this is an excellent contribution.

@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch from 1e1f7df to a77fc9c Compare February 15, 2026 14:48
CI runners may have 'master' as the default branch. Explicitly set
'-b main' in both bare and work repos to ensure consistent behavior.
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch from a77fc9c to b204361 Compare February 15, 2026 14:50
@yesudeep yesudeep marked this pull request as ready for review February 15, 2026 15:03
@yesudeep yesudeep merged commit 59d9dc3 into main Feb 15, 2026
26 checks passed
@yesudeep yesudeep deleted the yesudeep/fix/lethal-start branch February 15, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config docs Improvements or additions to documentation fix python Python root

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants