Skip to content

test: end-to-end partial-batch failure recovers on re-run (#61) - #62

Merged
wpak-ai merged 3 commits into
cppalliance:masterfrom
timon0305:test/partial-batch-recovery-61
Jul 28, 2026
Merged

test: end-to-end partial-batch failure recovers on re-run (#61)#62
wpak-ai merged 3 commits into
cppalliance:masterfrom
timon0305:test/partial-batch-recovery-61

Conversation

@timon0305

@timon0305 timon0305 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Closes #61.

process_submodule_list already continues past a failed submodule (#32) and sync_repo_master is already idempotent, but nothing proved end to end that a re-run after a partial failure recovers the failed submodule without re-touching the others. This adds that guard.

Test

Drives process_submodule_list over three real git-fixture submodules:

  • Run 1: one submodule's remote is moved offline, so it fails (recorded fatal) while the other two are committed and pushed, and the processing summary counts it as a failure.
  • Run 2: the remote is restored and the batch re-runs. The previously-failed submodule completes, and the two already-synced submodules produce no new commit (idempotent).

Test-only, no source changes. make test passes 131/131 and make lint is clean.

Summary by CodeRabbit

  • Tests
    • Added a new end-to-end Bats test using real git fixtures to verify recovery from a partial batch failure when one submodule remote is temporarily unavailable.
    • Confirmed the overall run completes successfully, only the affected submodule is marked as fatal, and the processing summary reports two successes and one processing error.
    • Verified that rerunning after restoring the remote recovers the failed submodule, advances only its remote head, and preserves idempotency for other submodules.

… on re-run

Drive process_submodule_list over real git fixtures with one submodule's
remote transiently offline, so it fails while the others succeed. The
re-run, with the remote restored, completes the previously-failed
submodule and leaves the already-synced ones untouched (no new commit).

Closes cppalliance#61.
@coderabbitai

coderabbitai Bot commented Jul 28, 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: 0dd5dd3f-4699-4fef-946e-034acf952d56

📥 Commits

Reviewing files that changed from the base of the PR and between 1e6730b and 22b3f99.

📒 Files selected for processing (1)
  • tests/test_partial_batch_recovery.bats
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_partial_batch_recovery.bats

📝 Walkthrough

Walkthrough

Adds a Bats end-to-end test that simulates one failed submodule during a batch, verifies successful processing of the others, then confirms recovery and idempotency on a second run.

Changes

Partial batch recovery test

Layer / File(s) Summary
Recovery fixture setup
tests/test_partial_batch_recovery.bats
Initializes shared state, creates repository fixtures, defines the recovery processor, and provides remote-head helpers.
Two-run recovery scenario
tests/test_partial_batch_recovery.bats
Simulates a missing json remote, validates fatal and summary results, restores the remote, verifies recovery, and confirms unchanged heads for already-synchronized submodules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: a recovery-focused end-to-end test for partial batch failures.
Linked Issues check ✅ Passed The new Bats test matches issue #61 by exercising failure, recovery, summary accounting, and idempotent rerun behavior.
Out of Scope Changes check ✅ Passed The changes appear scoped to the requested test coverage, with no unrelated functional or public API modifications.
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.

@whisper67265
whisper67265 self-requested a review July 28, 2026 06:12
@whisper67265

Copy link
Copy Markdown
Collaborator

@coderabbitai, full review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

@whisper67265, I’ll perform a full review of all changes in this PR.

✅ Action performed

Full review finished.

@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: 1

🤖 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 `@tests/test_partial_batch_recovery.bats`:
- Around line 82-85: Before restoring the json remote and starting Run 2 in the
partial-batch recovery test, assert that the remote repository’s current
revision still matches json_start. Add the check immediately after the failed
Run 1 and before moving json.git.offline back to json.git, using the existing
fixture and revision-validation helpers.
🪄 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: 62b90373-c92f-4e71-9643-42756c030c19

📥 Commits

Reviewing files that changed from the base of the PR and between 19cf076 and 8253552.

📒 Files selected for processing (1)
  • tests/test_partial_batch_recovery.bats

Comment thread tests/test_partial_batch_recovery.bats
Before Run 2, verify the restored json remote still points at json_start,
confirming the failed push committed locally but never reached the remote.
@whisper67265
whisper67265 requested a review from wpak-ai July 28, 2026 14:12

@wpak-ai wpak-ai 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.

tests/test_partial_batch_recovery.bats:82-99, tests/test_partial_batch_recovery.bats:27-33, .github/workflows/assets/translation.sh:17-27, .github/workflows/assets/translation.sh:112-120: delete and re-clone each submodule's destination directory from its bare remote after the remote is restored and before the second batch, mirroring the per-run fresh clone sync_one_submodule performs, so the recovering submodule is proven to re-commit and push against an unchanged remote rather than merely pushing run 1's leftover local commit (the re-run recovery invariant is held jointly by sync_repo_master's commit-before-push ordering and by the caller's workspace lifecycle, and production's caller clones the destination fresh into a mktemp -d workspace trapped for deletion, so the pending-commit state that makes run 2 pass in this fixture never exists in a real re-run)

@timon0305

Copy link
Copy Markdown
Contributor Author

tests/test_partial_batch_recovery.bats:82-99, tests/test_partial_batch_recovery.bats:27-33, .github/workflows/assets/translation.sh:17-27, .github/workflows/assets/translation.sh:112-120: delete and re-clone each submodule's destination directory from its bare remote after the remote is restored and before the second batch, mirroring the per-run fresh clone sync_one_submodule performs, so the recovering submodule is proven to re-commit and push against an unchanged remote rather than merely pushing run 1's leftover local commit (the re-run recovery invariant is held jointly by sync_repo_master's commit-before-push ordering and by the caller's workspace lifecycle, and production's caller clones the destination fresh into a mktemp -d workspace trapped for deletion, so the pending-commit state that makes run 2 pass in this fixture never exists in a real re-run)

Done. Run 2 now re-clones each destination fresh from its bare remote before the second batch, matching sync_one_submodule's per-run mktemp -d workspace. It first asserts json's remote is still at json_start, then recovery re-commits and pushes against that unchanged remote; algorithm/system re-clone and produce no new commit.

Match sync_one_submodule's per-run mktemp workspace: delete and re-clone
each destination from its bare remote before run 2. This proves the
recovering submodule re-commits and pushes against the unchanged remote
rather than pushing run 1's leftover local commit.
@timon0305
timon0305 requested a review from wpak-ai July 28, 2026 15:14
@wpak-ai
wpak-ai merged commit 76e6aab into cppalliance:master Jul 28, 2026
4 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.

Add an end-to-end test that a partial batch failure recovers on re-run

3 participants