Skip to content

lang validation and phase enums#28

Merged
wpak-ai merged 6 commits into
cppalliance:masterfrom
whisper67265:feature/lang-validation-phase-enums
Jun 23, 2026
Merged

lang validation and phase enums#28
wpak-ai merged 6 commits into
cppalliance:masterfrom
whisper67265:feature/lang-validation-phase-enums

Conversation

@whisper67265

@whisper67265 whisper67265 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Close #25, close #26.

Summary by CodeRabbit

Release Notes

  • Refactor / Chores
    • Added consistent phase tracking with grouped logs and phase-prefixed errors across the workflows.
    • Made shared workflow environment idempotent when sourced multiple times.
    • Centralized language-code parsing/validation and standardized repository_dispatch event_type handling with upfront validation.
  • Bug Fixes
    • Improved early-exit behavior and diagnostics for missing/invalid language-code inputs and missing/failing submodules.
    • Enhanced Weblate trigger/sync/mirror failure handling with clearer error reporting.
  • Tests
    • Added Bats coverage for phase/event/secret helpers and language-code parsing.
  • Documentation
    • Updated architecture notes for the revised language-code validation flow.

@coderabbitai

coderabbitai Bot commented Jun 23, 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: 1e61026d-9fa1-481a-8b2c-6d4cfd12babb

📥 Commits

Reviewing files that changed from the base of the PR and between 40d4a7a and 94dd913.

📒 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

Introduces phase-tracking constants (PHASE_*, START_PHASE_*, EVENT_*) in env.sh and phase/event helper functions (begin_phase, end_phase, phase_err, validate_event_type, parse_and_validate_lang_codes) in lib.sh. These are then threaded through all three translation workflows, both trigger scripts, and translation.sh, replacing hardcoded strings, inline validation, and plain echo+exit error paths throughout.

Changes

Phase instrumentation infrastructure and rollout

Layer / File(s) Summary
env.sh idempotency guard and shared constants
.github/workflows/assets/env.sh
env.sh wraps constant definitions in a _ENV_SH_LOADED sentinel to prevent redefinition when sourced multiple times, and defines readonly PHASE_*, START_PHASE_*, EVENT_* constants plus VALID_EVENT_TYPES array.
Phase tracking and error reporting in lib.sh
.github/workflows/assets/lib.sh
lib.sh introduces CURRENT_PHASE global state variable and begin_phase, end_phase, and phase_err helper functions for structured phase-aware error reporting with GitHub Actions group markers and error prefix labels.
Event type validation helpers
.github/workflows/assets/lib.sh
lib.sh adds is_valid_event_type and validate_event_type functions to check repository_dispatch event types against VALID_EVENT_TYPES, using phase_err for contextual error reporting.
Language code parsing and validation refactor
.github/workflows/assets/lib.sh
lib.sh introduces parse_and_validate_lang_codes (requiring LANG_CODES, parsing into lang_codes_arr, rejecting empty results, validating each code), updates _require_nonempty to use phase_err and end_phase for error termination, and modifies validate_secrets to conditionally check LANG_CODE when set or require LANG_CODES otherwise.
translation.sh phase constant substitution
.github/workflows/assets/translation.sh
translation.sh replaces hardcoded "mirrors"/"local" string literals in process_one_submodule with START_PHASE_MIRRORS and START_PHASE_LOCAL constant comparisons, and updates the phase-validation error message.
add-submodules.yml phase instrumentation
.github/workflows/add-submodules.yml
Removes inline "Validate language codes" step and replaces it with begin_phase/validate_secrets/parse_and_validate_lang_codes flow; wraps ensure-branches and finalization in begin_phase/end_phase blocks; converts all error exits to phase_err + end_phase + exit 1.
start-translation.yml phase instrumentation
.github/workflows/start-translation.yml
Replaces inline matrix-validation step with phase-wrapped parse_and_validate_lang_codes call; refactors sync-mirrors and start-local jobs to source shared assets and use phase_err/end_phase for all error paths, including curl and HTTP-status failures in trigger_weblate; removes redundant per-language validate_lang_codes call.
sync-translation.yml phase instrumentation
.github/workflows/sync-translation.yml
Wraps discover job's local-branch discovery and sync-local job's pointer synchronization with begin_phase/end_phase blocks; removes redundant validate_lang_codes call from sync-local; annotates event type comments.
Trigger scripts event type sourcing and validation
scripts/trigger-add-submodules.sh, scripts/trigger-start-translation.sh
Both scripts source shared env.sh/lib.sh, replace hardcoded event_type strings with EVENT_* constants in JSON payload builders (jq and Python fallback), and call validate_event_type before dispatch.
Tests for phase helpers and documentation updates
tests/test_lib.bats, docs/ARCHITECTURE.md
test_lib.bats adds comprehensive coverage for parse_and_validate_lang_codes, phase helpers (begin_phase/end_phase/phase_err), event validation, and validate_secrets with LANG_CODE-only input. ARCHITECTURE.md documents new parse_and_validate_lang_codes call sites and clarifies sync-translation validation responsibility.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • #25: Directly implements LANG_CODES validation dedup by introducing parse_and_validate_lang_codes helper and removing redundant per-job validation calls from add-submodules, start-translation, and sync-translation.

Possibly related PRs

  • cppalliance/boost-docs-translation#6: Both PRs touch add-submodules.yml's submodule failure handling—main PR wraps the existing submodule_fatal > 0 fatal-exit path with phase_err/end_phase, directly building on the "fix silent submodule failure" error aggregation logic from the retrieved PR.
  • cppalliance/boost-docs-translation#22: Extracted validate_secrets and language-code checks into lib.sh; this PR's updated validate_secrets logic and phase-aware helpers build directly on that extraction.
  • cppalliance/boost-docs-translation#23: Added process_one_submodule START_PHASE gating using "mirrors"/"local" literals that this PR converts to START_PHASE_MIRRORS/START_PHASE_LOCAL constants.

Suggested reviewers

  • henry0816191
  • wpak-ai

🐰 Hops through phases one by one,
begin_phase called — the work's begun!
phase_err echoes when things go wrong,
end_phase closes with a satisfied song.
No more hardcoded strings in sight —
just constants dancing in the GitHub light! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 'lang validation and phase enums' directly reflects the PR's primary changes: introducing language code validation deduplication and phase/event enum constants.
Linked Issues check ✅ Passed The PR implements all acceptance criteria from issue #25: creates parse_and_validate_lang_codes helper, refactors workflows to call it once, removes redundant validation, adds Bats coverage, and updates documentation.
Out of Scope Changes check ✅ Passed The PR includes phase-wrapping and event enum additions beyond issue #25's scope, but these are complementary infrastructure changes that enable the validation dedup refactoring and are noted in PR objectives.

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

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

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

@whisper67265 whisper67265 self-assigned this Jun 23, 2026

@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 (4)
.github/workflows/assets/lib.sh (1)

307-317: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider using phase_err for consistency with the phase instrumentation pattern.

The function parse_and_validate_lang_codes uses plain echo ... >&2 for error messages (line 312), while the new validate_event_type helper uses phase_err for validation errors. Since this function is called within phase contexts (per the review stack), using phase_err would provide phase context in error messages and align with the stated pattern of "phase_err + end_phase + exit 1."

Note that the underlying helpers (require_lang_codes, validate_lang_codes) also use plain echo; those predate phase instrumentation and are more general utilities, so retrofitting them could be deferred.

♻️ Suggested enhancement
 parse_and_validate_lang_codes() {
   require_lang_codes
   mapfile -t lang_codes_arr < <(parse_list "$LANG_CODES")
   [[ ${`#lang_codes_arr`[@]} -eq 0 ]] && {
-    echo "Error: LANG_CODES parsed to empty list." >&2
+    phase_err "LANG_CODES parsed to empty list."
     exit 1
   }
   validate_lang_codes "${lang_codes_arr[@]}"
 }
🤖 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 307 - 317, The function
parse_and_validate_lang_codes uses plain echo with stderr redirection for error
logging instead of the phase_err utility function for consistency with phase
instrumentation. Replace the plain echo error message on line 312 with a
phase_err call to provide phase context in error messages and align with the
established pattern of using phase_err followed by end_phase and exit 1, which
is the expected behavior for functions called within phase contexts.
.github/workflows/add-submodules.yml (2)

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

Quote array expansion for defensive coding.

The array expansion ${lang_codes_arr[*]} should be quoted to handle potential edge cases safely.

🛡️ Suggested improvement
-          echo "Lang codes: ${lang_codes_arr[*]}" >&2
+          echo "Lang codes: ${lang_codes_arr[*]}" >&2

Actually, for diagnostic output to stderr where word splitting is acceptable, the current form is fine. However, if this were assigned to a variable or used in a command argument, quoting would be essential. Consider this a defensive practice suggestion.

🤖 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/add-submodules.yml at line 58, The array expansion in the
echo statement for diagnostic output to stderr is unquoted. Quote the array
expansion by wrapping `${lang_codes_arr[*]}` in double quotes to follow
defensive coding practices and ensure safe handling of array contents, even
though this is diagnostic output where word splitting would be acceptable.
Update the line containing the echo command with "Lang codes:" to include quotes
around the array expansion variable.

144-151: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Consider trap-based cleanup for phase groups.

If ensure_translations_cloned or ensure_local_branch_in_translations fail, the script will exit (due to set -euo pipefail) without calling end_phase, leaving the GitHub Actions group unclosed. This is a minor observability issue that makes logs harder to read.

Potential improvement pattern

A trap-based approach could ensure phases are always closed:

cleanup_phase() {
  [[ -n "${CURRENT_PHASE:-}" ]] && end_phase
}
trap cleanup_phase ERR EXIT

However, this would require careful coordination with explicit end_phase calls to avoid double-closing. This applies to all phase-wrapped sections in the workflow, not just this one.

🤖 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/add-submodules.yml around lines 144 - 151, The phase group
for PHASE_ENSURE_BRANCHES will not be properly closed if
ensure_translations_cloned or ensure_local_branch_in_translations fail since set
-euo pipefail will cause the script to exit before end_phase is called.
Implement a trap-based cleanup mechanism by defining a cleanup_phase function
that checks if CURRENT_PHASE is set and calls end_phase if needed, then register
this function with trap cleanup_phase ERR EXIT near the beginning of the script.
This ensures all phase groups are closed even when errors occur, improving
GitHub Actions log readability.
.github/workflows/start-translation.yml (1)

226-242: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider removing redundant validation.

The manual checks for GITHUB_TOKEN, WEBLATE_URL, and WEBLATE_TOKEN (lines 226-242) duplicate validation already performed by validate_secrets weblate at line 244. While the manual checks provide phase-aware error messages via phase_err, this duplication increases maintenance burden.

Consider either:

  1. Removing lines 226-242 and relying solely on validate_secrets
  2. Updating validate_secrets in lib.sh to use phase_err for consistency

The current approach provides defense-in-depth but at the cost of code duplication.

🤖 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 226 - 242, The manual
validation checks for GITHUB_TOKEN, WEBLATE_URL, and WEBLATE_TOKEN variables are
redundant since validate_secrets weblate already performs the same validation.
Remove the duplicate validation blocks (the three [[ -z "${...:-}" ]] checks
with corresponding phase_err calls) and rely solely on the validate_secrets
weblate function call that follows, as it will handle all three environment
variable validations. Alternatively, if you need to preserve the phase_err
messaging, update the validate_secrets function in lib.sh to use phase_err
instead of standard error handling for consistency across the codebase.
🤖 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/start-translation.yml:
- Line 303: The trigger_weblate function and other critical function calls
(finalize_translations_master, ensure_translations_cloned,
ensure_local_branch_in_translations, finalize_translations_local) trigger
phase_err on failure which causes the script to exit immediately due to set -euo
pipefail, leaving the corresponding phase (PHASE_TRIGGER_WEBLATE and others)
open without calling end_phase. Add explicit error handling around these
function calls to capture their exit status, and ensure end_phase is called to
close the phase even when errors occur, then handle the error appropriately.
Apply this pattern to the trigger_weblate call at line 397 and the other at-risk
function calls at lines 174, 354, 355, and 387.

---

Nitpick comments:
In @.github/workflows/add-submodules.yml:
- Line 58: The array expansion in the echo statement for diagnostic output to
stderr is unquoted. Quote the array expansion by wrapping `${lang_codes_arr[*]}`
in double quotes to follow defensive coding practices and ensure safe handling
of array contents, even though this is diagnostic output where word splitting
would be acceptable. Update the line containing the echo command with "Lang
codes:" to include quotes around the array expansion variable.
- Around line 144-151: The phase group for PHASE_ENSURE_BRANCHES will not be
properly closed if ensure_translations_cloned or
ensure_local_branch_in_translations fail since set -euo pipefail will cause the
script to exit before end_phase is called. Implement a trap-based cleanup
mechanism by defining a cleanup_phase function that checks if CURRENT_PHASE is
set and calls end_phase if needed, then register this function with trap
cleanup_phase ERR EXIT near the beginning of the script. This ensures all phase
groups are closed even when errors occur, improving GitHub Actions log
readability.

In @.github/workflows/assets/lib.sh:
- Around line 307-317: The function parse_and_validate_lang_codes uses plain
echo with stderr redirection for error logging instead of the phase_err utility
function for consistency with phase instrumentation. Replace the plain echo
error message on line 312 with a phase_err call to provide phase context in
error messages and align with the established pattern of using phase_err
followed by end_phase and exit 1, which is the expected behavior for functions
called within phase contexts.

In @.github/workflows/start-translation.yml:
- Around line 226-242: The manual validation checks for GITHUB_TOKEN,
WEBLATE_URL, and WEBLATE_TOKEN variables are redundant since validate_secrets
weblate already performs the same validation. Remove the duplicate validation
blocks (the three [[ -z "${...:-}" ]] checks with corresponding phase_err calls)
and rely solely on the validate_secrets weblate function call that follows, as
it will handle all three environment variable validations. Alternatively, if you
need to preserve the phase_err messaging, update the validate_secrets function
in lib.sh to use phase_err instead of standard error handling for consistency
across the codebase.
🪄 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: dc6cd5d6-27d6-4ad5-b01c-3d6acb10f3b2

📥 Commits

Reviewing files that changed from the base of the PR and between dccd640 and ef668de.

📒 Files selected for processing (10)
  • .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
  • .github/workflows/sync-translation.yml
  • docs/ARCHITECTURE.md
  • scripts/trigger-add-submodules.sh
  • scripts/trigger-start-translation.sh
  • tests/test_lib.bats

Comment thread .github/workflows/start-translation.yml
@whisper67265

Copy link
Copy Markdown
Collaborator Author

@coderabbitai, review

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== env.sh ==="
cat -n .github/workflows/assets/env.sh

echo ""
echo "=== lib.sh ==="
cat -n .github/workflows/assets/lib.sh

echo ""
echo "=== translation.sh ==="
cat -n .github/workflows/assets/translation.sh

echo ""
echo "=== add-submodules.yml ==="
cat -n .github/workflows/add-submodules.yml

echo ""
echo "=== start-translation.yml ==="
cat -n .github/workflows/start-translation.yml

echo ""
echo "=== sync-translation.yml ==="
cat -n .github/workflows/sync-translation.yml

echo ""
echo "=== trigger-add-submodules.sh ==="
cat -n scripts/trigger-add-submodules.sh

echo ""
echo "=== trigger-start-translation.sh ==="
cat -n scripts/trigger-start-translation.sh

echo ""
echo "=== test_lib.bats ==="
cat -n tests/test_lib.bats

echo ""
echo "=== ARCHITECTURE.md ==="
cat -n docs/ARCHITECTURE.md

Length of output: 96313



@whisper67265 Here is the review of PR #28.


Review Summary

The PR cleanly achieves its goals: centralised parse_and_validate_lang_codes, typed START_PHASE_*/EVENT_* enums, and phase-wrapped error messages. A few issues are worth addressing before merge.


🔴 Bug — env.sh sourced twice in both trigger scripts

scripts/trigger-add-submodules.sh (Lines 18–34) and scripts/trigger-start-translation.sh (Lines 21–37) each contain two separate source blocks for env.sh. The old _REPO_ROOT block was not removed when the new _ASSETS_DIR block was added.

# BLOCK 1 (old — should be removed):
_REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
...
source "$_REPO_ROOT/.github/workflows/assets/env.sh"  # <-- first source
unset _REPO_ROOT

# BLOCK 2 (new — correct one):
_ASSETS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/.github/workflows/assets"
source "$_ASSETS_DIR/env.sh"   # <-- second source (redundant)
source "$_ASSETS_DIR/lib.sh"
unset _ASSETS_DIR

The readonly declarations inside env.sh are safe thanks to the _ENV_SH_LOADED guard, but the non-guarded variables (ORG, TRANSLATIONS_REPO, BOT_NAME, …, Lines 34–53 of env.sh) are re-evaluated on every source call. The _REPO_ROOT block should simply be removed from both scripts.


🟠 sync-mirrors skips validate_secrets

The sync-mirrors job in start-translation.yml (Lines 105–133) checks only GITHUB_TOKEN inline but never calls validate_secrets. This means ORG, MODULE_ORG, BOT_NAME, BOT_EMAIL, BOOST_ORG, MASTER_BRANCH, and TRANSLATIONS_REPO go unvalidated, unlike every other job. Adding a validate_secrets call after begin_phase "$PHASE_SETUP" would make it consistent.


🟠 Redundant double-validation in start-local

start-translation.yml Lines 236–254: secrets are checked individually with phase_err first, then validate_secrets weblate is called, which checks the same variables again via _require_nonempty. Choose one approach:

  • Option A: Keep only validate_secrets weblate (using phase_err-style messages in _require_nonempty requires a small refactor).
  • Option B: Keep the explicit phase_err checks and remove the validate_secrets weblate call (but then you lose ORG/MODULE_ORG/etc. validation).

Option A is cleaner.


🟡 Missing Bats test for LANG_CODES="" (set-but-empty)

tests/test_lib.bats Lines 78–83 cover unset LANG_CODES, but there is no test for LANG_CODES="". require_lang_codes uses [[ -n "${LANG_CODES:-}" ]], which treats an empty string the same as unset — worth adding a third case to make the contract explicit:

`@test` "parse_and_validate_lang_codes: empty LANG_CODES exits 1" {
  LANG_CODES=""
  run parse_and_validate_lang_codes
  [ "$status" -eq 1 ]
  [[ "$output" == *"lang_codes not set"* ]]
}

🟡 lang_codes_arr referenced but never initialised in sync-mirrors

translation.sh's process_one_submodule references lang_codes_arr in its for lang_code in ... loop, but sync-mirrors never declares or populates lang_codes_arr. This is safe at runtime because START_PHASE==$START_PHASE_MIRRORS causes an early return 0 before the loop is reached, but it is fragile: adding a new code path in process_one_submodule that runs before that guard could silently iterate an empty array. Initialising lang_codes_arr=() in the sync-mirrors step (alongside UPDATES=(), etc.) would make the intent explicit.


✅ What looks good

Area Notes
env.sh sentinel guard _ENV_SH_LOADED correctly prevents readonly re-declaration on repeated sourcing
parse_and_validate_lang_codes Proper chain: require_lang_codesparse_list → empty-array guard → validate_lang_codes
START_PHASE_* / EVENT_* constants Clean enum pattern; usage in translation.sh and dispatch_json is consistent
Phase wrapping begin_phase/end_phase/phase_err used consistently in add-submodules.yml, start-translation.yml, sync-translation.yml
validate_secrets branching on LANG_CODE vs LANG_CODES Correct split for per-language matrix jobs
is_valid_event_type + validate_event_type Loop over VALID_EVENT_TYPES array; tested in test_lib.bats
Bats test coverage Good coverage for new helpers; begin_phase/end_phase/phase_err/is_valid_event_type/validate_event_type all tested
ARCHITECTURE.md Accurately reflects the new parse_and_validate_lang_codes call sites
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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)
.github/workflows/sync-translation.yml (1)

55-146: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding trap handlers to ensure phase groups close on unexpected failures.

Both the discover and sync-local jobs open phase groups with begin_phase but lack trap handlers to ensure end_phase runs if commands fail. With set -euo pipefail, failures in git ls-remote (line 57), validate_lang_codes (line 74), jq (line 76), git fetch (line 118), or any command in the sync loop (lines 123-137) will exit immediately, leaving GitHub Actions groups unclosed and degrading log readability.

🛡️ Suggested approach

Add a trap handler after each begin_phase call:

begin_phase "$PHASE_DISCOVER" "Discover local-* branches"
trap 'end_phase' EXIT ERR

Or create a wrapper function in lib.sh:

safe_begin_phase() {
  begin_phase "$@"
  trap 'end_phase' EXIT ERR
}

This pattern would apply to both jobs and should ideally be adopted consistently across all workflows that use phase instrumentation.

🤖 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/sync-translation.yml around lines 55 - 146, The discover
and sync-local jobs in the workflow both call begin_phase to start GitHub
Actions log groups but lack trap handlers to ensure end_phase runs if commands
fail unexpectedly. With set -euo pipefail enabled, any failure in git ls-remote,
validate_lang_codes, jq commands in the discover job, or git fetch and submodule
operations in the sync-local job will exit immediately without calling
end_phase, leaving log groups unclosed. Add a trap handler immediately after
each begin_phase call (around the PHASE_DISCOVER and PHASE_SYNC_POINTERS
invocations) using the pattern: trap 'end_phase' EXIT ERR to ensure the phase
group closes properly regardless of script exit.
🤖 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 @.github/workflows/sync-translation.yml:
- Around line 55-146: The discover and sync-local jobs in the workflow both call
begin_phase to start GitHub Actions log groups but lack trap handlers to ensure
end_phase runs if commands fail unexpectedly. With set -euo pipefail enabled,
any failure in git ls-remote, validate_lang_codes, jq commands in the discover
job, or git fetch and submodule operations in the sync-local job will exit
immediately without calling end_phase, leaving log groups unclosed. Add a trap
handler immediately after each begin_phase call (around the PHASE_DISCOVER and
PHASE_SYNC_POINTERS invocations) using the pattern: trap 'end_phase' EXIT ERR to
ensure the phase group closes properly regardless of script exit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7abebd1c-edc8-4304-ac56-c366c1a9f78a

📥 Commits

Reviewing files that changed from the base of the PR and between a7b4f3d and 7ce3ac0.

📒 Files selected for processing (10)
  • .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
  • .github/workflows/sync-translation.yml
  • docs/ARCHITECTURE.md
  • scripts/trigger-add-submodules.sh
  • scripts/trigger-start-translation.sh
  • tests/test_lib.bats
🚧 Files skipped from review as they are similar to previous changes (8)
  • .github/workflows/assets/env.sh
  • tests/test_lib.bats
  • scripts/trigger-start-translation.sh
  • .github/workflows/assets/translation.sh
  • scripts/trigger-add-submodules.sh
  • .github/workflows/assets/lib.sh
  • .github/workflows/start-translation.yml
  • .github/workflows/add-submodules.yml

Comment thread .github/workflows/add-submodules.yml
Comment thread .github/workflows/assets/lib.sh
@whisper67265

Copy link
Copy Markdown
Collaborator Author

@coderabbitai, resume

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

@whisper67265 Sure! Resuming automatic reviews.

✅ Action performed

Reviews resumed.

@whisper67265 whisper67265 requested a review from wpak-ai June 23, 2026 20:23
@wpak-ai wpak-ai merged commit 2938918 into cppalliance:master Jun 23, 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.

START_PHASE untyped string → typed enum LANG_CODES validation dedup across 4 sites

3 participants