You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sadpandajoe (via GitHub)" <gi...@apache.org> on 2026/09/21 01:50:18 UTC
[PR] fix(i18n): guard messages.pot against source drift and regenerate it [superset]
sadpandajoe opened a new pull request, #44467:
URL: https://github.com/apache/superset/pull/44467
### SUMMARY
`superset/translations/messages.pot` is the extraction template every language
catalog is generated from, but nothing in CI ever compared the committed
template against a fresh extraction. The `babel-extract` job regenerates
`messages.pot` from scratch in throwaway worktrees before comparing
translated/fuzzy counts — a check scoped to catching a reworded source string
invalidating an existing translation, not template/source parity. The template
had drifted 432 strings behind source and carried 109 stale entries, so those
432 strings could not reach any of the 30 `.po` catalogs and were untranslatable
in every language.
This PR does three things.
**1. Adds a drift guard.** `scripts/translations/check_pot_drift.py` re-extracts
from source with the same `pybabel extract` invocation as `babel_update.sh` and
fails when the committed template's msgid set differs from a fresh extraction.
It is wired into the `babel-extract` job as a hard gate, placed before
`babel_update.sh` overwrites the workspace template. Comparison is on msgid sets
only, so it is insensitive to `POT-Creation-Date` churn and to the
do-not-translate / `python-format` post-processing steps. Line wrapping is
deliberately *not* normalized away: gettext continuation lines concatenate back
to the exact original, so any whitespace difference that survives parsing is a
real source reword that gettext's exact-match lookup would miss.
**2. Unbreaks extraction of the explore additional-actions menu.**
`useExploreAdditionalActionsMenu/index.tsx` was almost entirely invisible to
`pybabel extract`: `return /[",\r\n]/.test(s) ? ... : s;` puts a regex literal
directly after `return`, and babel's JavaScript lexer reads that `/` as
division, so the `"` inside the character class opens a phantom string literal
that swallows the next ~290 lines. Only 3 of the module's 34 translatable
strings survived extraction. The stale template still carried the other 31 only
because it predated the file's current shape — so regenerating it would have
deleted 10 still-live, already-translated strings ("Export All Data", "Export
Current View", "New chart", "Superset Chart", …) from all 30 catalogs. Hoisting
the regex into a module constant fixes extraction with no behavior change.
**3. Regenerates the template and all 30 catalogs** via `babel_update.sh`'s own
sequence, so the new guard starts green. Adding the guard without regenerating
would fail CI immediately against the already-stale template.
Regeneration changes **zero existing translation values** (verified by parsing
both revisions with `babel.messages.pofile.read_po` for all 30 catalogs, and
independently re-verified in review): the diff is additions plus the removal of
100 msgids that no longer exist in source, none of which still appear inside a
`t()`/`_()`/`__()`/`tct()` call. The `it/messages.po` catalog's diff looks large
because `babel_update.sh` also normalizes it from CRLF to LF line endings
(master's copy was the only CRLF-encoded catalog) — that's a whitespace-only
normalization, not a retranslation; the zero-changed-values check above covers
it.
Note: `babel_update.sh`'s `msgcat --sort-by-msgid --no-wrap` step is a no-op in
CI today — `--sort-by-msgid` is not an msgcat option, the script has no
`set -e`, so msgcat exits without writing. This PR reproduces current CI output
rather than introducing a new convention; the flag itself is addressed
separately in #44395. Its other two effects are redundant, since `--sort-output`
and `--no-location` are already on the `pybabel extract` call.
Out of scope, left untouched (separate, pre-existing issues): `flask_babel.lazy_gettext` call sites (e.g. `superset/views/filters.py:330`) are not reachable by `pybabel extract` at all, since neither babel's default keywords nor this project's `-k` list include `lazy_gettext` — worth its own follow-up issue.
Fixes #44403
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
### TESTING INSTRUCTIONS
Guard passes on this branch:
python scripts/translations/check_pot_drift.py
# superset/translations/messages.pot matches a fresh extraction.
Guard catches the bug it exists for — restore the pre-fix template and re-run:
git show master:superset/translations/messages.pot > superset/translations/messages.pot
python scripts/translations/check_pot_drift.py
# exits 1: strings missing/stale
git checkout -- superset/translations/messages.pot
Unit tests (mocked cases plus a real end-to-end extraction against this
checkout):
pytest tests/unit_tests/scripts/translations/
Frontend behavior of the hoisted regex is unchanged:
cd superset-frontend
npm run test -- src/explore/components/useExploreAdditionalActionsMenu
Regeneration is idempotent — re-running `./scripts/translations/babel_update.sh`
produces no diff beyond `POT-Creation-Date`.
### ADDITIONAL INFORMATION
- [x] Has associated issue: #44403
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(i18n): guard messages.pot against source drift and regenerate it [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #44467:
URL: https://github.com/apache/superset/pull/44467#issuecomment-5754410769
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/44467?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 57.34%. Comparing base ([`c9fd9bf`](https://app.codecov.io/gh/apache/superset/commit/c9fd9bf94f45163afd24f39f5ed9eec23a999150?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`549dc5b`](https://app.codecov.io/gh/apache/superset/commit/549dc5bafe415f5e9dff9867bb9e7ff3f8f81bb2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
> :exclamation: There is a different number of reports uploaded between BASE (c9fd9bf) and HEAD (549dc5b). Click for more details.
>
> <details><summary>HEAD has 87 uploads less than BASE</summary>
>
>| Flag | BASE (c9fd9bf) | HEAD (549dc5b) |
>|------|------|------|
>|python|66|2|
>|presto|13|1|
>|hive|12|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #44467 +/- ##
===========================================
- Coverage 80.65% 57.34% -23.32%
===========================================
Files 2942 2942
Lines 175691 175690 -1
Branches 40788 40787 -1
===========================================
- Hits 141703 100747 -40956
- Misses 31326 73983 +42657
+ Partials 2662 960 -1702
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `37.15% <ø> (ø)` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.03% <ø> (ø)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.08% <ø> (-45.88%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/44467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/44467?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(i18n): guard messages.pot against source drift and regenerate it [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #44467:
URL: https://github.com/apache/superset/pull/44467
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(i18n): guard messages.pot against source drift and regenerate it [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44467:
URL: https://github.com/apache/superset/pull/44467#issuecomment-5754378818
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(i18n): guard messages.pot against source drift and regenerate it [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44467:
URL: https://github.com/apache/superset/pull/44467#issuecomment-5755875604
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers an incremental AI Review.
- `/review full` - Manually triggers a full AI Review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org