Repository navigation
fix(i18n): stop the parity check passing broken translations or stamping them current - #905
Merged
Merged
Conversation
… and a stale stamp The Desktop and Android copies of the check found seven ways it passed or wrote something it should not: - a placeholder moved from one select keyword to another passed - broken braces passed when the English was broken the same way - --stamp overwrote an inline source hash that changed after the check - --stamp marked a key current while the key still failed the check - the stamp read the file twice, so an edit between the reads got stamped - the atomic write left a stamped file at mode 0600 - a link moved out of an ICU plural failed, the same link inside passed Each has a test that fails on the old script.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
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. |
The stamp parsed the file once and wrote the stamped tree, so an edit made between that read and the write was lost. It now reads the file again just before the write and refuses when the bytes differ, so the edit stays and the run fails. The older writer test now passes the full snapshot and has an unchanged-file control.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Desktop and Android lanes copy
scripts/i18n_check.pybyte for byte, and their reviews found seven cases where the check passed a bad translation or wrote a wrong stamp. This PR fixes all seven. Each fix has a test that fails on the script in main.--stampread the file at the start and compared only its texts before it wrote. An inlinesourcehash that another edit changed in between was overwritten. The comparison now covers the hashes too.--stampand--restampgave the current hash to a key that still failed the check. Such a key now keeps its old hash, so it stays stale.mkstempcreates files with that mode. It now keeps the file's mode.Evidence
tests/test_i18n_check.py: 128 passed. The new and changed tests fail against the script at 8a9a10f (8 failed, 120 passed).ruff checkandruff format --checkpass (ruff 0.17.6).--strict: 19 targets, 835 source keys, 0 errors, 0 warnings.Desktop
Desktop and Android copy this script after it merges. Neither of them runs
--stamp, ICU messages or inline JSON in CI today.Type of Change
Checklist
ruff checkandruff format --checkpass (ruff 0.17.6)