Skip to content

GROW-260 Request Autoscan eligibility after sonar import provisioning#605

Open
kevinmlsilva wants to merge 1 commit into
masterfrom
kevinmlsilva/autoscan-eligibility-check
Open

GROW-260 Request Autoscan eligibility after sonar import provisioning#605
kevinmlsilva wants to merge 1 commit into
masterfrom
kevinmlsilva/autoscan-eligibility-check

Conversation

@kevinmlsilva

@kevinmlsilva kevinmlsilva commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • After each repository is successfully provisioned by sonar import, best-effort requests SonarQube Cloud Autoscan eligibility/auto-enable for the new project via GET /api/autoscan/eligibility?autoEnable=true&ignoreCache=false&projectKey=<key>.
  • Not gated on the org's connected DevOps platform — requested unconditionally for every provisioned project.
  • Never fails the import: request/parse failures are caught and debug-logged (SonarQubeClient.requestAutoscanEligibility()).

Test plan

  • bun run typecheck / bun run lint clean
  • bun test tests/integration/specs/import/import.test.ts — 60/60 pass, including new coverage for: payload shape, unconditional firing regardless of ALM, and import success despite an eligibility-request failure
  • bun run test:unit — 2100/2100 pass, no regressions
  • Manually inspected real CLI stdout via the test harness to confirm the printed project key + stringified eligibility result and the actual GET request/query params sent to the fake server

🤖 Generated with Claude Code

@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for sonarqube-cli canceled.

Name Link
🔨 Latest commit e470e62
🔍 Latest deploy log https://app.netlify.com/projects/sonarqube-cli/deploys/6a5f9dd9a31374000865306e

Comment thread CLAUDE.md Outdated
@kevinmlsilva
kevinmlsilva force-pushed the kevinmlsilva/autoscan-eligibility-check branch 2 times, most recently from 4b5192e to 92b8b59 Compare July 21, 2026 15:49
@SonarSource SonarSource deleted a comment from gitar-bot Bot Jul 21, 2026
@kevinmlsilva
kevinmlsilva force-pushed the kevinmlsilva/autoscan-eligibility-check branch from 92b8b59 to e470e62 Compare July 21, 2026 16:27
@gitar-bot

gitar-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 resolved / 2 findings

Implements automatic Autoscan eligibility checks upon successful project provisioning. Resolved documentation mismatches regarding HTTP methods and corrected the progress line output for failed eligibility checks.

✅ 2 resolved
Quality: CLAUDE.md documents POST but code uses GET for autoscan

📄 CLAUDE.md:48
The CLAUDE.md entry states the CLI does POST /api/autoscan/eligibility, but requestAutoscanEligibility() and the PR summary both use GET (this.get('/api/autoscan/eligibility', ...)). Update the doc to say GET so it matches the implementation and query-string params.

Quality: Failed eligibility prints literal 'undefined' on progress line

📄 src/commands/import/index.ts:105-106
On failure requestAutoscanEligibility() returns undefined, and JSON.stringify(undefined) yields the value undefined, so the interpolated progress detail becomes "<projectKey> undefined" shown to the user. Guard the display so failures show nothing (or a clearer message), e.g. only append the stringified result when eligibility !== undefined.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@vnaskos-sonar vnaskos-sonar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description mentions the project key and stringified eligibility response are surfaced on the per-repo progress line, but I don't see that happening — the line only shows the repo slug: ✓ vnaskos-sonar/bun-ts-sample

Is the description wrong, is this expected?

@kevinmlsilva

Copy link
Copy Markdown
Contributor Author

The description mentions the project key and stringified eligibility response are surfaced on the per-repo progress line, but I don't see that happening — the line only shows the repo slug: ✓ vnaskos-sonar/bun-ts-sample

Yes, it was during the testing, didn't change the description, will remove it

@vnaskos-sonar vnaskos-sonar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks good, there is a minor conflict to be fixed before merging!

Something to consider is the autoscan could be a flag to enable/disable, or to mention on the command's --help that this enables autoscan for the imported repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants