sadpandajoe opened a new pull request, #44584:
URL: https://github.com/apache/superset/pull/44584

   ### SUMMARY
   `Python-Unit` has been red on master because the `unit-tests (next)` leg 
(Python 3.12, push-only) fails 
`check_pot_drift_test.py::test_committed_template_matches_a_fresh_extraction`:
   
   ```
   AssertionError: 1 string(s) in source missing from messages.pot
   assert not {'valuename'}
   ```
   
   **Root cause:** `QueryContextProcessor.get_viz_annotation_data` passed two 
f-strings to `_()`. On Python 3.11 babel's extractor drops an f-string 
entirely. Under Python 3.12 (PEP 701) f-strings are tokenized into parts, and 
babel collects the dict-key literals inside the replacement fields 
(`annotation_layer["value"]`, `annotation_layer["name"]`) and concatenates them 
into the msgid `"valuename"` (the second site yields `"name"`, which is hidden 
because that msgid already exists). `messages.pot` is generated on 3.11, so the 
drift check only disagrees on 3.12. PR CI only runs the `current` Python leg, 
so this slipped through when the drift test was added in #44467.
   
   **Fix:** use parameterized gettext (`%(chart_id)s`, `%(layer_name)s`) at 
both sites, which also makes these messages translatable for the first time (an 
f-string msgid can never match a catalog entry), and regenerate `messages.pot`. 
These were the only `_(f"...")` calls in `superset/`. The `.po` catalogs are 
left to the regular translation sync to keep this diff minimal.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A
   
   ### TESTING INSTRUCTIONS
   PR CI only runs Python 3.11, so it will not exercise the failing leg. 
Verified locally:
   - Python 3.11.9: `python scripts/translations/check_pot_drift.py` reports 
the template matches a fresh extraction, and `pytest 
tests/unit_tests/scripts/translations/check_pot_drift_test.py` passes (7 passed)
   - Python 3.12.13 (babel 2.17.0): `check_pot_drift.diff()` returns 
`missing=set(), stale=set()`. Before the fix it returned `missing={'valuename'}`
   - New unit tests in 
`tests/unit_tests/common/test_query_context_processor.py` assert the rendered 
text of both error messages
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] 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
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to