Skip to content

fix: skip locale commit when source.json is missing - #165

Merged
steipete merged 1 commit into
openclaw:mainfrom
SebTardif:fix/empty-source-json-stale
Sep 5, 2026
Merged

fix: skip locale commit when source.json is missing#165
steipete merged 1 commit into
openclaw:mainfrom
SebTardif:fix/empty-source-json-stale

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where a locale translation commit could still push to main when origin/main had no readable .openclaw-sync/source.json. remote_source_sha() returns an empty string on git show failure, invalid JSON, or a missing sha field. ensure_base_current only skipped when that SHA was non-empty and different, so a missing or broken metadata file failed open.

Why This Change Was Made

Empty remote source SHA is now treated as stale, the same way the aggregate finalizer already skips when source metadata is unreadable. The locale commit writes committed=false and does not push. A matching readable SHA still publishes. Sibling R2 work in #161, #163, and #164 is unchanged.

User Impact

A translation worker no longer publishes locale pages against an unknown or missing source snapshot. Operators see a skip (Source metadata missing or unreadable) instead of a successful push that can land translations for the wrong docs tree. The existing Fail uncommitted locale refresh step still fails the job so the run is not reported as published.

Evidence

terminal output from live python3 against the production commit_locale_artifact.py path.

The old guard lets an empty SHA through:

$ python3 -c "current=''; base='source-a'; print('old_skip', bool(current and current != base)); print('new_skip', bool(not current or current != base))"
old_skip False
new_skip True

Before the patch, commit_locale pushed docs/hi/index.md to origin/main when source.json was missing, invalid, empty-sha, or missing the sha field. The control-plane suite on that unfixed script reported AssertionError: True is not false for committed in all four cases.

After the patch, the same live driver imports the production script and runs commit_locale against a real git origin:

$ python3 C:\Users\sebta\AppData\Local\Temp\docs-f005-live-proof.py C:\Users\sebta\.grok\tmp\pr-gate-batch\docs-f005
script=C:\Users\sebta\.grok\tmp\pr-gate-batch\docs-f005\.github\scripts\i18n\commit_locale_artifact.py
CASE missing
  remote_source_sha=''
  ensure_base_current=False
  commit_locale=False
  origin_has_locale=False
CASE invalid
  remote_source_sha=''
  ensure_base_current=False
  commit_locale=False
  origin_has_locale=False
CASE empty_sha
  remote_source_sha=''
  ensure_base_current=False
  commit_locale=False
  origin_has_locale=False
CASE valid
  remote_source_sha='source-a'
  ensure_base_current=True
  commit_locale=True
  origin_has_locale=True

This empty-SHA fail-open has been present since #63 (2026-06-26). The aggregate finalizer already skips unreadable source metadata in translate-finalize-reusable.yml. Related i18n commit control: #62 , #68 .

Real behavior proof

  • Behavior or issue addressed: A missing or invalid origin/main .openclaw-sync/source.json still allowed the locale worker to push translation files to main.
  • Real environment tested: Windows 11, Python 3.13.15, repo checkout at C:\Users\sebta.grok\tmp\pr-gate-batch\docs-f005 on branch fix/empty-source-json-stale. The driver creates a bare origin plus a working clone and calls the production script.
  • Exact steps or command run after this patch: python3 C:\Users\sebta\AppData\Local\Temp\docs-f005-live-proof.py C:\Users\sebta.grok\tmp\pr-gate-batch\docs-f005
  • Evidence after fix: terminal output above. missing, invalid, and empty_sha cases print commit_locale=False and origin_has_locale=False. The valid matching SHA still prints commit_locale=True and origin_has_locale=True.
  • Observed result after fix: Locale push is skipped when remote source metadata cannot be read. A readable matching SHA still publishes. The worker writes committed=false so the existing uncommitted-refresh step can fail the job.
  • What was not tested: A live GitHub Actions translation run against openclaw/docs main. This change only affects the empty/unreadable SHA path; a later source SHA move still uses the existing skip message.

Treat an empty origin/main source SHA as stale so a missing or
invalid .openclaw-sync/source.json cannot fail open into a locale
push. Matches the aggregate finalizer skip for unreadable metadata.

Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Verified head 0e757dc36b4ab194775011e7f1c6ca40120d9592.

Ran the production python3 .github/scripts/i18n/commit_locale_artifact.py --locale hi --base-source-sha source-a --attempts 1 against isolated working repositories and real local bare Git origins. The main baseline published the locale with source.json missing. This PR reports committed=false and leaves the remote ref unchanged for missing metadata, invalid JSON, an empty SHA, a missing SHA field, and a changed SHA. Matching metadata reports committed=true and publishes the locale successfully.

All 117 control-plane tests passed, including their Node MDX integrations. Workflow shell syntax and budget checks passed. The first local suite attempt lacked tsx/esm; installing the workflow's exact @mdx-js/mdx@3.1.1 tsx@4.23.12 tooling resolved those setup failures. No manifest or lockfile was changed.

Branch autoreview against origin/main, through P2, returned scoped-clean. Exact-head CI succeeded:

Ready for the orchestrator's squash merge. The shared changelog update will be in #167.

@steipete
steipete merged commit cbbd2e6 into openclaw:main Sep 5, 2026
5 checks passed
steipete pushed a commit that referenced this pull request Sep 5, 2026
Apply configurable request deadlines to hostname cutover API calls and reject malformed or overflowing budgets before requests begin.

Document both request-timeout controls and consolidate the prepared dependency and publishing changelog entries. Land after PRs #132, #152, #161, #163, #164, #165, and #166.

Co-authored-by: Sebastien Tardif <SebTardif@ncf.ca>
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.

2 participants