Skip to content

Check Ukrainian code blocks like the other locales - #624

Merged
rmcdaniel merged 2 commits into
mainfrom
general/uk-code-block-check
Nov 26, 2026
Merged

rmcdaniel merged 2 commits into
mainfrom
general/uk-code-block-check

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Problem

scripts/check-doc-translations.js compared each translation's code blocks with English using its own six-locale map, which left out uk. Ukrainian examples could drift from English without failing the build.

Change

  • The code block comparison moves into checkCodeBlocks(root, languages = locales) in scripts/check-doc-translation-updates.js, using the same seven-locale list as the presence and review-hash checks (now with a label map that includes Ukrainian).
  • check-doc-translations.js calls it for every locale and keeps its review-hash warning and --record-review behavior.
  • New test in check-doc-translation-updates.test.js: the default run covers all seven locales, and a Ukrainian code block that differs from English fails with Ukrainian executable examples differ from English.
  • Checking uk found one drifted example: i18n/uk/.../waterline-operator-api.md set WATERLINE_LOCALE=uk where English and the six other locales show WATERLINE_LOCALE=es. It now matches English. The English guide is unchanged, so no source-hashes.json entry changes.

Local: node --test scripts/check-doc-translation-updates.test.js (7 pass) and node scripts/check-doc-translations.js (all seven locales match in 112 guides).

🤖 Generated with Claude Code

check-doc-translations.js compared code blocks only for six locales and
skipped uk. Move the code block check into check-doc-translation-updates.js
over the shared locale list, test that it covers every offered locale, and
restore the one Ukrainian example that drifted from English
(waterline-operator-api.md: WATERLINE_LOCALE=es).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rmcdaniel rmcdaniel added the agent:general Pull request opened by General agent label Nov 26, 2026
@rmcdaniel

Copy link
Copy Markdown
Member Author

Independent review: PASS at head 89391b3

What I verified (fresh clone, gh pr checkout 624, Node v22.22.1)

  • node --test scripts/check-doc-translation-updates.test.js: 7/7 pass.
  • node scripts/check-doc-translations.js: exit 0. All seven locales report "code blocks match English in 112 guides", Ukrainian included. No review-needed warnings.
  • uk is now checked exactly like the others. checkCodeBlocks(root, languages = locales) (scripts/check-doc-translation-updates.js:103) uses the same locales list that the presence and review-hash checks use, and that list is derived from localeLabels, so the per-script six-locale map can't fall out of step again. scripts/check-doc-translations.js:16 calls it with the default.
  • Regression detection (mutations applied locally and then reverted):
    • Putting back the pre-PR uk file (WATERLINE_LOCALE=uk) makes the CLI fail with exit 1 and Ukrainian executable examples differ from English: waterline-operator-api.md.
    • Changing the default to locales.filter(l => l !== 'uk') fails the new test (6 pass / 1 fail).
    • Removing uk from localeLabels fails 2 tests.
  • --record-review still works. On the PR head it writes all seven source-hashes.json files with the same keys and hashes. The only diff is the position of one key (features/compensation-scopes.md, which follows readdir order). origin/main's script produces that identical diff for the six locales it covered, so this predates the PR. uk is now recorded the same way. I reverted all of this afterwards.
  • Warnings and exit status are the same: the review-hash console.warn path is unchanged (check-doc-translations.js:21-28), a code-block mismatch still throws an AssertionError (exit 1), and the per-locale summary line still prints.
  • Wiring is unchanged: the PR doesn't touch package.json or .github. The build script still runs the test followed by check-doc-translations.js, and deploy.yml and qualification.yml still go through that build. Every PR check is green.
  • uk content: English docs/waterline-operator-api.md:68 and all six other locales use WATERLINE_LOCALE=es. The uk file now does too, and its prose and setting table (which already lists uk) are correct. English is unchanged, so no locale needs a translation update or a source-hashes.json change under the 7-locale rule.

Findings

  • BLOCKING: none.
  • Non-blocking: README.md:106-107 still says "The build checks this for Spanish, Brazilian Portuguese, Simplified Chinese, Japanese, French and German." It should now include Ukrainian (or say "all seven translated locales"). README isn't under docs/, so the translation rule doesn't apply to it.
  • Non-blocking: the code-block comparison now runs for every locale before any --record-review write. Before, earlier locales could be written before a later locale failed. This is an improvement in behavior, noted here only for the record.
  • Non-blocking: the order of locales in the output changed (de, es, fr, pt-BR, uk, ja, zh-Hans). Checker scan now skips symlinked .md files (entry.isFile(), check-doc-translation-updates.js:115), same as the existing inventory scan at :68. Neither has any effect today.
  • Non-blocking: the test covers checkCodeBlocks but not the CLI's per-locale loop. That loop would throw on Object.keys(undefined) if a locale were left out of the hashes, so nothing would pass silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rmcdaniel

Copy link
Copy Markdown
Member Author

Independent review: PASS at head e8d4784

Delta review of 89391b3...e8d4784. That range is one commit, ahead by 1 and behind by 0, and it touches only README.md.

  • At README.md:106-107 the code-block sentence now lists German, Spanish, French, Brazilian Portuguese, Ukrainian, Japanese and Simplified Chinese. That matches localeLabels in scripts/check-doc-translation-updates.js and its order, so the non-blocking finding from my previous review is resolved.
  • No script, test, i18n or workflow file changed. My earlier verification at 89391b3 still holds (tests 7/7, checker exit 0, uk checked like the other six).
  • README is not under docs/, so the 7-locale translation rule does not apply.
  • Findings: none. PR checks for the new head were still pending when I posted this.

@rmcdaniel
rmcdaniel enabled auto-merge (squash) November 26, 2026 14:59
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel merged commit ebb2800 into main Nov 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:general Pull request opened by General agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant