codeant-ai-for-open-source[bot] commented on code in PR #37015:
URL: https://github.com/apache/superset/pull/37015#discussion_r3415922767
##########
scripts/check-env.py:
##########
@@ -162,10 +166,12 @@ def main(docker: bool, frontend: bool, backend: bool) ->
None: # noqa: C901
),
Requirement(
"docker-compose",
+ # docker-compose output may include 'v' in the version token or
have extra text
(Version("2.28.0"), Version("999.999.999")),
(Version("1.29.0"), Version("999.999.999")),
"docker",
"docker-compose --version",
+ lambda v: v.split()[-1].lstrip("v"),
Review Comment:
**Suggestion:** The new docker-compose post-processing extracts the last
whitespace token from the full output, which is often the build hash for
classic `docker-compose --version` output (for example, `... 1.29.2, build
5becea4c`). That hash is not a semantic version, so parsing fails and valid
installations are incorrectly reported as invalid/unsupported. Extract the
version token before the comma (or with a regex) instead of taking the final
token. [logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Docker-compose v1.29.x reported Invalid Version Format incorrectly.
- ⚠️ Environment check script misleads users about docker-compose
suitability.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Use a system with classic standalone docker-compose v1.29.2 installed,
where
`docker-compose --version` prints a string like `docker-compose version
1.29.2, build
5becea4c` (standard v1 format, with version before a comma and a trailing
build hash).
2. Run `python scripts/check-env.py --docker`, which invokes the click
entrypoint `main`
at `scripts/check-env.py:134`; inside `main`, a `Requirement` for
`"docker-compose"` is
constructed at lines 168-175 with `version_post_process=lambda v:
v.split()[-1].lstrip("v")` (line 174).
3. During `Requirement.__init__` at lines 30-46, `self.get_version()` (line
45) calls
`get_version` at lines 48-56, which executes the command `"docker-compose
--version"` via
`subprocess.check_output(...)` at line 50 and obtains the full output string.
4. `get_version` then applies `version_post_process` at line 52, so
`v.split()[-1]` on
`docker-compose version 1.29.2, build 5becea4c` yields the last whitespace
token
`"5becea4c"`, `lstrip("v")` leaves `"5becea4c"`, and after the final
`output.split()` at
lines 54-55, `self.version` is still `"5becea4c"` instead of the semantic
version
`1.29.2`.
5. `check_version` at lines 59-76 attempts to construct
`Version(self.version)` at line
64; `packaging.version.Version("5becea4c")` raises `InvalidVersion`, which
is caught at
lines 63-66 and causes `check_version` to return `"❌ Invalid Version
Format"`, so the
script prints a docker-compose row with status `❌ Invalid Version Format` via
`format_result` at lines 78-81 and the loop at 210-216, even though
docker-compose 1.29.2
satisfies the supported range `(Version("1.29.0"), Version("999.999.999"))`
defined at
lines 170-171.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ba9b1906fd404687815754b9cc230d2b&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=ba9b1906fd404687815754b9cc230d2b&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:** scripts/check-env.py
**Line:** 174:174
**Comment:**
*Logic Error: The new docker-compose post-processing extracts the last
whitespace token from the full output, which is often the build hash for
classic `docker-compose --version` output (for example, `... 1.29.2, build
5becea4c`). That hash is not a semantic version, so parsing fails and valid
installations are incorrectly reported as invalid/unsupported. Extract the
version token before the comma (or with a regex) instead of taking the final
token.
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%2F37015&comment_hash=615103b93ea47c84560434a7bc513e8433e3d3b3e5381a8b9e0af139b520a65d&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37015&comment_hash=615103b93ea47c84560434a7bc513e8433e3d3b3e5381a8b9e0af139b520a65d&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]