Skip to content

Cover force-push-with-lease rejection path in finalize_translations_local and add concurrency group for add-submodules.yml master push#43

Merged
wpak-ai merged 3 commits into
cppalliance:masterfrom
whisper67265:fix/test-depth-and-concurrency
Jun 30, 2026
Merged

Cover force-push-with-lease rejection path in finalize_translations_local and add concurrency group for add-submodules.yml master push#43
wpak-ai merged 3 commits into
cppalliance:masterfrom
whisper67265:fix/test-depth-and-concurrency

Conversation

@whisper67265

@whisper67265 whisper67265 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Close #36, close #38.

Summary by CodeRabbit

  • Bug Fixes

    • Improved translation branch publishing when force-with-lease is rejected, including clearer stderr output that reports the remote ref/HEAD for faster diagnosis.
    • Detects whether force-with-lease is supported by the installed Git and fails early with a clear upgrade hint when it isn’t.
    • Ensures fail-fast behavior on lease rejection to avoid unnecessary retries.
  • Tests

    • Added integration coverage for stale force-with-lease rejection, no-retry fail-fast behavior, and unsupported Git push mode handling.
  • Chores

    • Added concurrency control to the submodule-add workflow to cancel older runs for the same ref.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9841426e-2518-4642-aa0d-d97ccf22493a

📥 Commits

Reviewing files that changed from the base of the PR and between 2c046ac and d019229.

📒 Files selected for processing (2)
  • .github/workflows/assets/lib.sh
  • tests/test_lib.bats
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/assets/lib.sh
  • tests/test_lib.bats

📝 Walkthrough

Walkthrough

Adds force-with-lease support detection and rejection diagnostics in the translation push flow, expands git test fixtures to simulate concurrent remote updates and unsupported Git behavior, adds three integration tests for those paths, and adds concurrency to the add-submodules workflow.

Changes

force-with-lease safety and test coverage

Layer / File(s) Summary
force-with-lease detection and push diagnostics
.github/workflows/assets/lib.sh
Adds git_push_supports_force_with_lease probing git push -h. Updates commit_and_push_translations_branch to fail fast with phase_err when unsupported, and to fetch and report remote HEAD SHA via git ls-remote on lease rejection.
Git wrapper test fixture helpers
tests/helpers/git_fixtures.bash
Adds push_commit_to_remote_branch, install_git_push_pre_hook/restore_git_push_pre_hook, install_git_without_force_with_lease, and install_git_fetch_counter to simulate concurrent pushes and absent git features via PATH-wrapped wrappers.
Integration tests for lease rejection and unsupported feature
tests/test_lib.bats
Adds teardown cleanup plus three Bats tests: stale lease rejection with remote SHA in error, fail-fast on rejection with single-fetch verification, and unsupported feature error with Git 2.8+ upgrade message.
CI concurrency policy for add-submodules
.github/workflows/add-submodules.yml
Adds a concurrency group keyed by github.ref with cancel-in-progress: true to the add-submodules workflow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

  • cppalliance/boost-docs-translation#23: Introduced the commit_and_push_translations_branch force-push path that this PR extends with force-with-lease support detection and rejection handling.

Suggested reviewers

  • henry0816191
  • wpak-ai

🐇 I hopped through a lease on the breeze,
Then checked the remote with great ease.
If Git is too old,
We say so, clear and bold,
And the workflow now rests with reprieves.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The add-submodules.yml concurrency-group change is unrelated to linked issue #36's force-with-lease test coverage. Move the concurrency-group update to a separate PR or add the corresponding linked issue so scope matches the requested work.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: lease-rejection coverage and add-submodules concurrency.
Linked Issues check ✅ Passed The PR implements #36's acceptance criteria with rejection-path tests, no-retry checks, and unsupported-Git handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/assets/lib.sh:
- Around line 215-217: The version hint in the git push capability check is
misleading: the `git_push_supports_force_with_lease` path currently reports a
minimum of 2.8+ even though `--force-with-lease` exists since 1.8.5. Update the
`phase_err` message in the `git_push_supports_force_with_lease` check to remove
the hardcoded 2.8+ floor or replace it with the actual minimum version you want
to support, keeping the guidance consistent with the feature check.
- Around line 219-224: The rejected push path in the push helper is being
short-circuited by errexit, so the diagnostics after `git push
--force-with-lease` never run. Update the push handling in `assets/lib.sh`
around the `git -C "$dir" push --force-with-lease origin "$branch"` flow to use
an `if`/`else` or temporarily disable `-e` for that command, then preserve the
existing `push_rc`, `ls-remote`, and `phase_err` reporting in the failure
branch.

In `@tests/test_lib.bats`:
- Around line 311-330: The test in finalize_translations_local leaves the git
wrapper and fixture state behind if an assertion fails, which can contaminate
later cases. Move the cleanup for restore_git_push_pre_hook and
cleanup_git_fixture_root into a teardown() helper or register a trap immediately
after install_git_push_pre_hook in the affected tests so cleanup always runs,
even on early failure. Apply the same pattern to the other
finalize_translations_local test blocks referenced in this file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7a70796b-b9d7-4cbc-adc0-356df29022b6

📥 Commits

Reviewing files that changed from the base of the PR and between a9a3f15 and 2c046ac.

📒 Files selected for processing (4)
  • .github/workflows/add-submodules.yml
  • .github/workflows/assets/lib.sh
  • tests/helpers/git_fixtures.bash
  • tests/test_lib.bats

Comment thread .github/workflows/assets/lib.sh
Comment thread .github/workflows/assets/lib.sh Outdated
Comment thread tests/test_lib.bats Outdated
@whisper67265 whisper67265 requested a review from wpak-ai June 30, 2026 20:06
@wpak-ai wpak-ai merged commit 3168b65 into cppalliance:master Jun 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concurrency group: add for add-submodules.yml master push Test depth: cover force-push-with-lease rejection path in finalize_translations_local

3 participants