codeant-ai-for-open-source[bot] commented on code in PR #40716:
URL: https://github.com/apache/superset/pull/40716#discussion_r3350449327
##########
scripts/translations/check_translation_regression.py:
##########
@@ -169,26 +220,32 @@ def cmd_compare(
report_path: Optional[str] = None,
) -> None:
with open(before_path) as f:
- before: dict[str, int] = json.load(f)
+ before_raw: dict[str, object] = json.load(f)
+ before = {lang: _normalize(entry) for lang, entry in before_raw.items()}
after = get_counts(translations_dir)
+ # A regression is an *increase* in fuzzy entries: the PR's source diff
+ # renamed/reworded strings, leaving their committed translations stranded.
+ # A plain drop in the translated count is NOT used — deleting a string
+ # lowers it identically to a rename but is a legitimate change, and with
+ # `pybabel update --ignore-obsolete` a deletion creates no fuzzy entry.
regressions: list[tuple[str, int, int]] = []
- for lang, before_count in sorted(before.items()):
- after_count = after.get(lang, 0)
- if after_count < before_count:
- regressions.append((lang, before_count, after_count))
+ for lang, before_stats in sorted(before.items()):
+ after_stats = after.get(lang, {"translated": 0, "fuzzy": 0})
+ if after_stats["fuzzy"] > before_stats["fuzzy"]:
+ regressions.append((lang, before_stats["fuzzy"],
after_stats["fuzzy"]))
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> In translation regression checks, do not treat intentionally deleted
locale catalogs as regressions; only fail when a baseline catalog is still
present but cannot be counted (for example, msgfmt errors or malformed files).
**Applied to:**
- `scripts/translations/**`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]