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

   ### SUMMARY
   
   `po2json.sh` only runs under a Unix-like shell, so Windows contributors need 
WSL or Git Bash to regenerate frontend translation JSON. #39724 attempted a 
cross-platform Python port of the same pipeline, but spent 5 months patching a 
chronic bug class: invoking `node_modules/.bin`'s `.cmd`/`.bat` wrappers on 
Windows always routes through `cmd.exe`, regardless of `subprocess`'s 
`shell=False` — and `cmd.exe`'s own command-line parsing (operator 
metacharacters, then `%VAR%` expansion) kept reopening a new edge case each 
time one was closed, most recently an unresolved finding that literal 
`%USERNAME%`-shaped filenames still get expanded before `po2json` ever sees 
them.
   
   This sidesteps that whole bug class instead of chasing it further: each npm 
package's own `package.json` `"bin"` field is read directly, and its resolved 
entry point is invoked as `node <entry.js>` rather than through the 
platform-specific `node_modules/.bin` wrapper. `node` is a real executable on 
every platform, so this never touches `cmd.exe` (or any shell) at all — there's 
no shell-metacharacter or environment-variable-expansion surface to defend 
against, on any OS.
   
   Also drops two pieces of #39724's design that added complexity without 
matching benefit: auto-installing missing npm packages from inside the script 
(a footgun if it ever runs somewhere unexpected — flagged in review over 
there), and a `ThreadPoolExecutor` parallelizing a ~45s job that doesn't need 
it (confirmed via a real end-to-end run against all 30 locale files: 48ms for 
the `oxfmt` pass, well under a second total for conversion).
   
   `superset-frontend/package.json`'s `build-translation` now points at the new 
script; `po2json.sh` is removed rather than maintaining two translation-build 
pipelines side by side.
   
   Closes #39724.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend && npm run build-translation
   ```
   Verify `.json` files are generated/updated under 
`superset/translations/<locale>/LC_MESSAGES/`.
   
   ```bash
   pytest tests/unit_tests/scripts/translations/compile_po_test.py
   ```
   
   Manually verified end-to-end against all 30 locales in this repo 
(node-direct invocation of both `po2json` and `oxfmt`, correct per-locale 
output paths, no collisions).
   
   ### 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