CLI-456 Add SCA eligibility SQ Server version check#270
CLI-456 Add SCA eligibility SQ Server version check#270georgii-borovinskikh-sonarsource wants to merge 1 commit into
Conversation
Agentic Analysis: Early ResultsAgentic Analysis and Context Augmentation are available on your project. Here are some issues that could have been prevented. Follow the links to learn how to put them into action. 1 issue(s) found across 1 file(s):
Analyzed by SonarQube Agentic Analysis in 2.8 s |
SummaryAdds a SonarQube Server version check before SCA (Software Composition Analysis) operations. The What reviewers should knowWhat changed:
Key points for reviewers:
Watch for:
|
598980c to
bf6e614
Compare
9498f09 to
4574b26
Compare
|
There was a problem hiding this comment.
Solid PR overall — the version check logic is clean and fits the existing patterns well. One genuine question needs answering before approval: the fake server returns a non-200 status code (503) with a valid JSON body for the "unreachable" test, but fetchServerVersion may or may not throw depending on how it handles non-2xx responses. The test needs to be verified to actually exercise the catch branch in assertServerSupportsSca.
| .newFakeServer() | ||
| .withAuthToken(VALID_TOKEN) | ||
| .withSystemStatusCode(503) | ||
| .start(); | ||
| harness.withAuth(server.baseUrl(), VALID_TOKEN); | ||
|
|
||
| const result = await harness.run('analyze dependency-risks --project demo'); | ||
|
|
||
| expect(result.exitCode).toBe(1); | ||
| expect(result.stdout + result.stderr).toContain('Could not determine SonarQube Server version'); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
The test name says /api/system/status is "unreachable", but .withSystemStatusCode(503) causes the fake server to return a valid HTTP response with a 503 status — the TCP connection itself succeeds. Whether this exercises the catch branch in assertServerSupportsSca depends on whether fetchServerVersion throws on non-2xx responses.
From the gathered context, fetchServerVersion calls fetch() and returns response.json() — fetch() itself does not throw on non-2xx status codes; it only throws on network errors. If fetchServerVersion doesn't explicitly check response.ok and throw, a 503 response may be parsed silently (or throw a JSON parse error that is a different exception), meaning the test might be passing for the wrong reason, or the actual user-facing path for a real unreachable server isn't covered.
Please verify fetchServerVersion in src/lib/server-info.ts throws on non-2xx, and if so, whether a descriptive error scenario (e.g., a network-level failure or AbortError from the timeout) should also be covered.
- Mark as noise



No description provided.