codeant-ai-for-open-source[bot] commented on code in PR #41648:
URL: https://github.com/apache/superset/pull/41648#discussion_r3509723903
##########
Dockerfile:
##########
@@ -141,7 +141,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
COPY superset/translations/ /app/translations_mo/
RUN if [ "${BUILD_TRANSLATIONS}" = "true" ]; then \
- pybabel compile -d /app/translations_mo | true; \
+ pybabel compile --use-fuzzy -d /app/translations_mo | true; \
Review Comment:
**Suggestion:** Using a pipe to `true` is a shell logic bug: it masks
`pybabel compile` failures and can also trigger a broken-pipe termination if
`pybabel` writes output, leading to silently missing or incomplete `.mo` files
while the Docker build still succeeds. Replace the pipeline with proper error
handling (or explicit `|| true` only if failure is truly acceptable) so compile
errors are not hidden by accident. [logic error]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Docker image may ship without updated translation `.mo` files.
- ⚠️ Translation compilation failures are hidden during Docker build.
- ⚠️ Debugging broken translations harder due to masked errors.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. In `/workspace/superset/docker-compose.yml` set `BUILD_TRANSLATIONS=true`
(env entries
at lines 46 and 197 from Grep) and build the Superset image using
`/workspace/superset/Dockerfile`, which defines the
`python-translation-compiler` stage at
lines 13–27 with `ARG BUILD_TRANSLATIONS` (line 15) and the RUN block at
lines 24–27.
2. Introduce an invalid or malformed `.po` file under
`superset/translations/` (copied
into the image by `COPY superset/translations/ /app/translations_mo/` at
`Dockerfile` line
23) so that `pybabel compile --use-fuzzy -d /app/translations_mo` would
normally exit with
a non-zero status.
3. Run `docker build` (or `docker compose build`) so the RUN command at
`Dockerfile` lines
24–27 executes: `if [ "${BUILD_TRANSLATIONS}" = "true" ]; then pybabel
compile --use-fuzzy
-d /app/translations_mo | true; fi; rm -f
/app/translations_mo/*/*/*.[po,json]`. Because
of the pipeline, the shell returns the exit status of `true` (always 0),
masking any
`pybabel compile` failure, and the Docker build layer still succeeds.
4. Start a container from the built image and access any backend-rendered
page that relies
on compiled translations; observe missing or English-fallback strings due to
failed `.mo`
compilation, while the earlier Docker build reported success, demonstrating
that piping
`pybabel compile` into `true` silently hides translation compilation errors.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=40cc8e71e11a444abfb678e743f8d281&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=40cc8e71e11a444abfb678e743f8d281&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** Dockerfile
**Line:** 144:144
**Comment:**
*Logic Error: Using a pipe to `true` is a shell logic bug: it masks
`pybabel compile` failures and can also trigger a broken-pipe termination if
`pybabel` writes output, leading to silently missing or incomplete `.mo` files
while the Docker build still succeeds. Replace the pipeline with proper error
handling (or explicit `|| true` only if failure is truly acceptable) so compile
errors are not hidden by accident.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41648&comment_hash=970198cd82af1efdfe7a8935c399b6613b04d315dcb06f086c7a0955b62137e4&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41648&comment_hash=970198cd82af1efdfe7a8935c399b6613b04d315dcb06f086c7a0955b62137e4&reaction=dislike'>👎</a>
--
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]