Skip to content

Partial-update rollback: atomic submodule commit with failure summary.#32

Open
AuraMindNest wants to merge 3 commits into
cppalliance:masterfrom
AuraMindNest:fix/submodule-partial-update
Open

Partial-update rollback: atomic submodule commit with failure summary.#32
AuraMindNest wants to merge 3 commits into
cppalliance:masterfrom
AuraMindNest:fix/submodule-partial-update

Conversation

@AuraMindNest

@AuraMindNest AuraMindNest commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Close #30.

Summary by CodeRabbit

  • New Features
    • Added consolidated submodule processing summaries and JSON helpers for submodule name lists.
    • start-local now runs only for libs/* submodules that successfully updated during mirror synchronization.
  • Bug Fixes
    • Improved fatal submodule tracking (fatal counted without immediately aborting) and unified end-of-run exit status.
    • Translation finalization now halts after the first failure to avoid partial continuation.
    • Weblate triggering failures are now captured and included in the combined result.
  • Tests
    • Added Bats coverage for JSON helpers, fatal recording, and summary output formatting/edge cases.

@coderabbitai

coderabbitai Bot commented Jun 24, 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: a0fca36e-5e22-4cf5-94ed-d76a38b6d104

📥 Commits

Reviewing files that changed from the base of the PR and between a78d3ec and babecb3.

📒 Files selected for processing (3)
  • .github/workflows/add-submodules.yml
  • .github/workflows/assets/lib.sh
  • .github/workflows/start-translation.yml
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/add-submodules.yml
  • .github/workflows/assets/lib.sh
  • .github/workflows/start-translation.yml

📝 Walkthrough

Walkthrough

Shared shell helpers now track submodule-fatal and open-PR skip state, encode and decode submodule names as JSON, and print consolidated summaries. The translation workflows pass updated submodules from sync-mirrors to start-local, then combine finalize and Weblate exit codes.

Changes

Submodule translation workflow

Layer / File(s) Summary
Shared state and helper primitives
\.github/workflows/assets/env.sh, \.github/workflows/assets/lib.sh, tests/helpers/common.bash, tests/test_lib.bats
Repository-name parsing now uses a temporary _repo; translation state initializes SUBMODULE_FATAL and OPEN_PR_SKIP; helper functions add fatal recording and JSON name conversion/parsing; tests reset and cover the new helpers.
Git bot configuration wiring
\.github/workflows/assets/lib.sh, \.github/workflows/assets/translation.sh
set_git_bot_config is called before workflow asset commits and before repository update, branch creation, and local submodule-processing paths.
Submodule summary and exit flow
\.github/workflows/add-submodules.yml, \.github/workflows/assets/lib.sh, tests/test_lib.bats
Submodule processing now records rc==2 fatals, initializes and prints consolidated summaries, and propagates finalize failures through the calling workflow’s exit code.
Start-local downstream processing
\.github/workflows/start-translation.yml
sync-mirrors exports updated_submodules, and start-local consumes the JSON list, skips empty updates, processes only selected submodules, and combines local finalize and Weblate return codes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • henry0816191
  • wpak-ai

Poem

A bunny hopped through YAML night,
with JSON carrots tucked in sight.
I counted fatals, neat and true,
then waved at submodules passing through.
Weblate blinked; the branches sighed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.42% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 is concise and accurately reflects the main change around atomic submodule commits and failure summaries.
Linked Issues check ✅ Passed The changes satisfy #30 by deferring failure exit until after finalize, adding consolidated summaries, JSON submodule outputs, and combined exit codes.
Out of Scope Changes check ✅ Passed The updates in env.sh, translation.sh, tests, and workflow helpers are directly tied to the issue requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/start-translation.yml (1)

326-346: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Skip Weblate when local finalization fails.

Line 339 triggers Weblate even if finalize_translations_local failed and rc is non-zero, which can notify Weblate before the local branch state is safely pushed.

Proposed guard
           weblate_rc=0
-          trigger_weblate "$WEBLATE_URL" "$WEBLATE_TOKEN" "$LIBS_REF" "$exts_json" "$LANG_CODE" || weblate_rc=$?
+          if [[ $rc -eq 0 ]]; then
+            trigger_weblate "$WEBLATE_URL" "$WEBLATE_TOKEN" "$LIBS_REF" "$exts_json" "$LANG_CODE" || weblate_rc=$?
+          else
+            echo "Skipping Weblate because local branch finalization failed." >&2
+          fi
           end_phase
🤖 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 @.github/workflows/start-translation.yml around lines 326 - 346, The workflow
currently calls trigger_weblate even when finalize_translations_local fails and
rc is non-zero, so guard the Weblate phase behind a successful finalization.
Update the start-translation logic around finalize_translations_local,
trigger_weblate, and the rc/weblate_rc aggregation so Weblate is only triggered
when rc remains 0, while preserving the existing exit_rc handling for failures.
🧹 Nitpick comments (1)
.github/workflows/assets/lib.sh (1)

331-355: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Defensive-guard inconsistency for SUBMODULE_FATAL / UPDATES / OPEN_PR_SKIP.

The function guards META_MISSING, ORG_REPO_MISSING, NO_DOC_PATHS, and REPO_EXISTS_SKIP with [[ ${VAR+set} ]], but iterates/expands SUBMODULE_FATAL, UPDATES, and OPEN_PR_SKIP directly. These are only initialized via init_translation_state, so calling the summary before init under set -u (older bash) would trip an unbound-variable error for the very arrays that aren't guarded. Either guard all of them or none for consistency.

🤖 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 @.github/workflows/assets/lib.sh around lines 331 - 355, The summary function
has inconsistent defensive guards: `print_submodule_processing_summary` protects
`META_MISSING`, `ORG_REPO_MISSING`, `NO_DOC_PATHS`, and `REPO_EXISTS_SKIP`, but
reads `SUBMODULE_FATAL`, `UPDATES`, and `OPEN_PR_SKIP` directly. Update the
function to use the same `[[ ${VAR+set} ]]`-style presence checks or equivalent
safe defaults for all array references in `print_submodule_processing_summary`,
so it won’t fail under `set -u` if called before `init_translation_state`.
🤖 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/add-submodules.yml:
- Around line 210-218: Ensure finalize_translations_repo stops on the first
failure instead of continuing after a failed finalize_translations_master or
finalize_translations_local call; update that function so it returns immediately
with the failing status, and then have the caller in add-submodules.yml rely on
the returned rc rather than allowing later successful steps to overwrite it.

In @.github/workflows/start-translation.yml:
- Around line 185-198: The start-translation workflow currently writes
updated_submodules before finalize_translations_master runs, which lets
start-local act on branches even if mirror finalization fails. Move the
updated_submodules output write in the workflow step so it only happens after
finalize_translations_master succeeds, and keep the export guarded by the same
rc/exit_rc flow used in this phase. Use the updated_json, GITHUB_OUTPUT, and
finalize_translations_master step to locate the change, and ensure the output
stays empty when finalization fails.

---

Outside diff comments:
In @.github/workflows/start-translation.yml:
- Around line 326-346: The workflow currently calls trigger_weblate even when
finalize_translations_local fails and rc is non-zero, so guard the Weblate phase
behind a successful finalization. Update the start-translation logic around
finalize_translations_local, trigger_weblate, and the rc/weblate_rc aggregation
so Weblate is only triggered when rc remains 0, while preserving the existing
exit_rc handling for failures.

---

Nitpick comments:
In @.github/workflows/assets/lib.sh:
- Around line 331-355: The summary function has inconsistent defensive guards:
`print_submodule_processing_summary` protects `META_MISSING`,
`ORG_REPO_MISSING`, `NO_DOC_PATHS`, and `REPO_EXISTS_SKIP`, but reads
`SUBMODULE_FATAL`, `UPDATES`, and `OPEN_PR_SKIP` directly. Update the function
to use the same `[[ ${VAR+set} ]]`-style presence checks or equivalent safe
defaults for all array references in `print_submodule_processing_summary`, so it
won’t fail under `set -u` if called before `init_translation_state`.
🪄 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: 5e2cdf0e-57d6-4561-9c1b-012091db11f2

📥 Commits

Reviewing files that changed from the base of the PR and between 58ac086 and 6543734.

📒 Files selected for processing (7)
  • .github/workflows/add-submodules.yml
  • .github/workflows/assets/env.sh
  • .github/workflows/assets/lib.sh
  • .github/workflows/assets/translation.sh
  • .github/workflows/start-translation.yml
  • tests/helpers/common.bash
  • tests/test_lib.bats

Comment thread .github/workflows/add-submodules.yml
Comment thread .github/workflows/start-translation.yml Outdated
Comment thread .github/workflows/start-translation.yml
Comment thread .github/workflows/add-submodules.yml
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.

Partial-update rollback: atomic submodule commit with failure summary.

2 participants