Skip to content

CLI-1523 Keep Architecture commands Cloud-only - #1243

Open
madalin-antonoiu-sonarsource wants to merge 4 commits into
masterfrom
architecture-cloud-only
Open

madalin-antonoiu-sonarsource wants to merge 4 commits into
masterfrom
architecture-cloud-only

Conversation

@madalin-antonoiu-sonarsource

Copy link
Copy Markdown
Contributor

Summary

Keep Architecture commands available for SonarQube Cloud and reject SonarQube Server connections with a clear login hint. The help and Architecture skill now describe this limitation.

This removes the Server version check and upgrade hint until the released Server APIs have been verified.

Testing

  • Architecture integration tests, including Cloud access and Server rejection for every command
  • Architecture unit tests, typecheck, lint and formatting

@netlify

netlify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for sonarqube-cli canceled.

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

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Keep Architecture commands Cloud-only CLI-1523 Keep Architecture commands Cloud-only Nov 10, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

CLI-1523

Comment thread src/commands/architecture/register.ts Resolved
Comment thread src/commands/architecture/register.ts Resolved
Comment thread src/commands/architecture/register.ts Resolved
@gitar-bot

gitar-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 4 closed / 4 findings

🟡 Medium risk · Restricting architecture commands to SonarQube Cloud may prevent Server users from reading or updating architecture data through the CLI.

Keeps Architecture commands available for SonarQube Cloud and rejects SonarQube Server connections with a clear login hint, with help text and the Architecture skill updated to describe the Cloud-only limitation. Stale Server-path test assertions and the root help snapshot were updated to match, and no open issues remain.

✅ 4 closed
✅ Quality: Unreachable Server branches still assert removed Server guidance

📄 tests/integration/specs/architecture/architecture-findings.test.ts:413-425 📄 tests/integration/specs/architecture/architecture-compatibility.test.ts:274-283
The new if (!cloud) { …; return; } guards make the platform conditionals that follow them dead. In architecture-findings.test.ts, else expect(result.stderr).toContain('older Server versions') can never run. It also asserts text this PR deletes from collectionFailure. In architecture-compatibility.test.ts, if (cloud) expect(...).not.toContain('Server build') is now always true. These leftovers describe a contract that no longer exists, so they would fail or mislead if Server support came back. Remove the dead conditionals and keep only the Cloud assertions after the early return.

✅ Cross-PR: #1217's Server-path tests fail once Cloud-only gating lands

📄 src/commands/architecture/register.ts:62-71 📄 tests/integration/specs/architecture/architecture-compatibility.test.ts:274-283
Breaks when this PR and #1217 both merge into master and #1217's Server-path architecture integration tests run against the combined code. Merge order does not matter.

How

  1. requireCloud (src/commands/architecture/register.ts:62-71) runs first in every architecture action and rejects any connection that is not Cloud with 'requires a SonarQube Cloud connection'.
  2. SONARCH-3492 CLI: Report and respect a file-managed intended architecture #1217 adds compatibility tests that loop over cloud of [false, true] and expect Server-specific output. For example, tests/integration/specs/architecture/architecture-compatibility.test.ts expects toContain('Server build') when !cloud.
  3. SONARCH-3492 CLI: Report and respect a file-managed intended architecture #1217 also adds Server hints to errors.ts (collectionFailure's 'older Server versions' text) and to sonar-architecture-api.ts. This PR removes or bypasses those hints, so the errors.ts hunks conflict and the Server branches can no longer be reached from the CLI.

Fix

Compared 05caa7f with #1217 at ba16777

✅ Bug: Root help snapshot test still expects old architecture description

📄 src/commands/architecture/register.ts:77
This commit changes the architecture description to 'Read and set the architecture of a project (SonarQube Cloud only)'. Root help builds each summary from command.description() (src/core/commands/root-help.ts), so the root help output changes. tests/integration/specs/help/root-help.test.ts:60 still expects the old line, and lines 97/108/109 compare the whole output with toBe(getExpectedRootHelp()), so the sonar, sonar --help and bare root-help tests will fail. To fix it, update the expected line to the new description.

Closed: Quality: Generated docs still show the architecture description without Cloud-only

📄 src/commands/architecture/register.ts:77
docs/data/commands.json and docs/llms.txt are generated from command descriptions by build-scripts/docs/generate-docs.ts (bun run gen:docs). Both still show 'Read and set the architecture of a project' without the new '(SonarQube Cloud only)' suffix. Other Cloud-only commands (organizations, remediate, import) do show it there. The published machine-readable docs therefore don't mention the restriction this PR adds. To fix it, run bun run gen:docs and commit the regenerated files.

Verification Rules 2/2 met

Functional validation No results

Rules 2 passed 2 not applicable

✅ Internal artifact registries
✅ Repository license compliance

Auto-approval Withheld

For more verification details, comment gitar display:verbose.

Options

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

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

This branch has not been deployed

No deployments
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