Skip to content

Make start-translation fail loud instead of exiting 0 when submodule discovery finds nothing. - #69

Merged
wpak-ai merged 4 commits into
cppalliance:masterfrom
whisper67265:fix/fail-on-empty-submodules
Jul 30, 2026
Merged

Make start-translation fail loud instead of exiting 0 when submodule discovery finds nothing.#69
wpak-ai merged 4 commits into
cppalliance:masterfrom
whisper67265:fix/fail-on-empty-submodules

Conversation

@whisper67265

@whisper67265 whisper67265 commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Close #64.

Summary by CodeRabbit

  • Bug Fixes
    • Submodule syncing now errors out with “Run add-submodules first.” when no libs/ entries are present in .gitmodules.
    • Local translation processing now treats an empty handoff (no updated submodules) as a fatal failure.
    • Local processing now runs only after successful synchronization.
    • Improved reliability of local branch setup by failing on Git command errors.
  • Documentation
    • Updated architecture/workflow guidance to match the stricter gating and empty-handoff error behavior.
  • Tests
    • Added coverage for libs/ validation and for marking an update-recording failure as fatal for the affected submodule.

@coderabbitai

coderabbitai Bot commented Jul 29, 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: f452c966-daec-477e-bfc7-8f33babe1329

📥 Commits

Reviewing files that changed from the base of the PR and between 68862ff and 53616ec.

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

📝 Walkthrough

Walkthrough

The workflow validates .gitmodules for libs/ submodules, propagates update-recording failures, gates start-local on successful synchronization, and fails on empty handoffs. Branch operations now handle Git failures explicitly, with tests and documentation updated.

Changes

Submodule synchronization reliability

Layer / File(s) Summary
Submodule validation and fatal recording
.github/workflows/assets/submodule_ops.sh, tests/test_submodule_ops.bats
Validates that .gitmodules contains libs/ entries, treats update-recording failures as fatal, and covers both behaviors with Bats tests.
Synchronization and local translation gating
.github/workflows/start-translation.yml, docs/ARCHITECTURE.md
Makes missing library submodules fatal, runs start-local after successful synchronization, fails on empty handoffs, and documents the updated conditions.
Translation branch operation handling
.github/workflows/assets/lib.sh
Adds explicit success returns and early error handling for translation branch Git operations.

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

Sequence Diagram(s)

sequenceDiagram
  participant Gitmodules
  participant sync-mirrors
  participant start-local
  Gitmodules->>sync-mirrors: Validate libs/ submodule paths
  sync-mirrors->>start-local: Provide updated_submodules handoff
  start-local->>start-local: Fail if submodule_names is empty
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The lib.sh branch-handling edits are unrelated to the linked issue’s submodule-discovery and start-local failure behavior. Remove or justify the lib.sh changes in a separate PR if they are not required for #64.
✅ 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 matches the main change: making start-translation fail loudly when submodule discovery is empty.
Linked Issues check ✅ Passed The changes satisfy #64: empty .gitmodules and empty handoff now fail, tests were added, and the architecture doc was updated.
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: 1

🧹 Nitpick comments (1)
tests/test_submodule_ops.bats (1)

39-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a multi-entry pipefail regression test.

The success fixture has only one libs/ path, so it cannot catch the validator’s early-grep -q failure. Add a generated, sufficiently large set of libs/... entries and run the test with set -o pipefail.

🤖 Prompt for 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.

In `@tests/test_submodule_ops.bats` around lines 39 - 62, Expand the success test
for require_libs_submodules_in_gitmodules with a generated, sufficiently large
number of libs/... submodule entries, and enable set -o pipefail while running
the validator. Keep the existing successful status assertion so the test detects
premature grep -q pipeline failures.
🤖 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/submodule_ops.sh:
- Line 53: Update the submodule-name check around
libs_submodule_names_from_gitmodules_file to capture its complete output before
testing whether it is empty, instead of piping directly to grep -q. Preserve the
existing failure behavior for an empty result while avoiding producer SIGPIPE
under pipefail.

---

Nitpick comments:
In `@tests/test_submodule_ops.bats`:
- Around line 39-62: Expand the success test for
require_libs_submodules_in_gitmodules with a generated, sufficiently large
number of libs/... submodule entries, and enable set -o pipefail while running
the validator. Keep the existing successful status assertion so the test detects
premature grep -q pipeline failures.
🪄 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: 90868249-adc8-4348-ac36-ad5e97995ba1

📥 Commits

Reviewing files that changed from the base of the PR and between 76e6aab and 4882e2e.

📒 Files selected for processing (4)
  • .github/workflows/assets/submodule_ops.sh
  • .github/workflows/start-translation.yml
  • docs/ARCHITECTURE.md
  • tests/test_submodule_ops.bats

Comment thread .github/workflows/assets/submodule_ops.sh Outdated

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

.github/workflows/assets/lib.sh:166: make ensure_local_branch_in_translations propagate each git command's status explicitly, for example git -C "$dir" push -u origin "$branch" || return 1, and add an explicit return 0 after the trailing echo

Comment thread .github/workflows/assets/submodule_ops.sh Outdated

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

🧹 Nitpick comments (1)
tests/test_submodule_ops.bats (1)

39-72: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the truly empty/no-path .gitmodules case.

Ensure the failure fixture includes a file with no submodule.*.path entries, then assert the same non-zero status and diagnostic. This exercises the git config --get-regexp no-match status that can be exposed by pipefail.

🤖 Prompt for 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.

In `@tests/test_submodule_ops.bats` around lines 39 - 72, Update the failure test
for require_libs_submodules_in_gitmodules to use an empty or no-path .gitmodules
fixture with no submodule.*.path entries. Keep the assertion for non-zero status
and the existing “Run add-submodules first.” diagnostic so the no-match pipefail
behavior is covered.
🤖 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.

Nitpick comments:
In `@tests/test_submodule_ops.bats`:
- Around line 39-72: Update the failure test for
require_libs_submodules_in_gitmodules to use an empty or no-path .gitmodules
fixture with no submodule.*.path entries. Keep the assertion for non-zero status
and the existing “Run add-submodules first.” diagnostic so the no-match pipefail
behavior is covered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 05444b66-2d99-4d7a-9d69-75be9f0b6982

📥 Commits

Reviewing files that changed from the base of the PR and between 105526a and 68862ff.

📒 Files selected for processing (3)
  • .github/workflows/assets/lib.sh
  • .github/workflows/assets/submodule_ops.sh
  • tests/test_submodule_ops.bats

@whisper67265
whisper67265 requested a review from wpak-ai July 30, 2026 14:52
@wpak-ai
wpak-ai merged commit c098a18 into cppalliance:master Jul 30, 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.

Make start-translation fail loud instead of exiting 0 when submodule discovery finds nothing

3 participants