Skip to content

JAVA-7405 Read the SemSitter frontend flag from a SonarQube Cloud property - #6582

Open
rombirli wants to merge 2 commits into
rombirli/semsitter-cast-catch-warningsfrom
rombirli/semsitter-feature-flags
Open

rombirli wants to merge 2 commits into
rombirli/semsitter-cast-catch-warningsfrom
rombirli/semsitter-feature-flags

Conversation

@rombirli

@rombirli rombirli commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part 15 of 17 of JAVA-7392. Ticket: JAVA-7405.

$\color{red}{\textbf{CONTRACT WITH SONARQUBE CLOUD: sonar.java.internal.semsitter.enabled}}$

SonarQube Cloud must send this context property to turn the SemSitter frontend on. Its name is defined once, in SemSitterFlag.ENABLED_PROPERTY. Renaming it requires the same change in SonarQube Cloud.

Intent

The feature flag lives in SonarQube Cloud, which evaluates it and sends only a context property to the analyzer, as sonar-skunk does for Delphi (sonar.dre.internal.dogfooding.enabled). The analyzer never evaluates a flag and never calls a flag service: an absent property means the default frontend.

sequenceDiagram
  participant SQC as SonarQube Cloud
  participant S as Scanner
  participant F as SemSitterFlag
  SQC->>S: context property sonar.java.internal.semsitter.enabled
  S->>F: isEnabled(configuration)
  F-->>S: the property value, false when absent
Loading
boolean on = SemSitterFlag.isEnabled(configuration);   // reads SemSitterFlag.ENABLED_PROPERTY, false when absent

State on master

Nothing reads the property yet.

Test plan

  • SemSitterFlagTest: the property name, absent, true, false

@hashicorp-vault-sonar-prod

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

Copy link
Copy Markdown
Contributor

JAVA-7405

@rombirli
rombirli added this pull request to stack #6570 November 25, 2026 11:48
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from c240b14 to 92c8e3c Compare November 25, 2026 12:00
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch 2 times, most recently from 628923b to e540a42 Compare November 25, 2026 13:08
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch 2 times, most recently from 30beb3b to 973734e Compare November 25, 2026 14:14
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 973734e to cf3b27c Compare November 25, 2026 14:55
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from cf3b27c to 62396a7 Compare November 25, 2026 15:32
@sonarqube-next

Copy link
Copy Markdown
Contributor

@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch 2 times, most recently from 6895328 to 72774ba Compare November 25, 2026 17:16
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch 2 times, most recently from 29968e8 to ea41ce2 Compare November 25, 2026 18:39
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from ea41ce2 to ee828cc Compare November 25, 2026 20:45
@rombirli
rombirli removed this pull request from stack #6570 November 25, 2026 20:47
@rombirli
rombirli added this pull request to stack #6589 November 25, 2026 20:48
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch 2 times, most recently from 0e2f6bc to e6ea216 Compare November 30, 2026 15:47
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from e6ea216 to 92d2301 Compare November 30, 2026 15:51
@rombirli
rombirli removed this pull request from stack #6589 December 1, 2026 11:07
@rombirli
rombirli added this pull request to stack #6607 December 1, 2026 11:08
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 92d2301 to 4fbb622 Compare December 2, 2026 13:52
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 4fbb622 to 2406175 Compare December 2, 2026 14:21
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 2406175 to d42e6af Compare December 2, 2026 14:46
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from d42e6af to 1073488 Compare December 2, 2026 15:04
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 1073488 to 2ba00ae Compare December 2, 2026 15:20
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 2ba00ae to 092a912 Compare December 2, 2026 15:31
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 092a912 to a806ba1 Compare December 2, 2026 16:15
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from a806ba1 to 285c377 Compare December 2, 2026 16:42
@rombirli
rombirli force-pushed the rombirli/semsitter-feature-flags branch from 285c377 to 114710f Compare December 2, 2026 16:50
@gitar-bot

gitar-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟢 Low risk 2 closed / 2 findings

The PR only adds an unused configuration-property accessor and tests; without consumers, analysis behavior remains unchanged.

Adds a SemSitterFlag that reads the SemSitter frontend toggle from the sonar.java.internal.semsitter.enabled context property instead of calling LaunchDarkly, and the test coverage follows that change. The unclosed HttpClient from the one-shot flag fetch was resolved. Open suggestion: the PR title, description, sequence diagram, and test plan still describe the removed LaunchDarkly client and should be updated to match the property-based flag, including the new requirement that SonarQube Cloud send this property.

✅ 2 closed
✅ Quality: HttpClient is never closed after the one-shot flag fetch

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/LaunchDarklyFeatureFlags.java:75-80
The project targets JDK 21 (jdk.min.version 21 in the root pom). Since JDK 21, java.net.http.HttpClient implements AutoCloseable. fetch builds a new client on every connect and never closes it, on success, on a non-200 status, on a parse failure or on interruption. The client's selector-manager thread and its pooled connection stay alive until the client is garbage-collected, inside the analysis JVM. This repo ships a TryWithResources rule that flags exactly this Java 21 HttpClient pattern (TryWithResourcesCheck_java_21.java). Wrap the client in try-with-resources.

Closed: Quality: PR title and description still describe a LaunchDarkly client

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterFlag.java:21-35
This commit removes LaunchDarklyFeatureFlags, and no reference to LaunchDarkly is left in the repo. The flag is now read from the sonar.java.internal.semsitter.enabled context property, and the class Javadoc says the analyzer "never reaches out to a flag service". The PR title ("Read the SemSitter frontend flag from LaunchDarkly"), the sequence diagram, the LaunchDarklyFeatureFlags.connect(...) example and the test plan ("LaunchDarklyFeatureFlagsTest against a local HTTP server…") still describe the removed HTTPS client. Reviewers and the ticket history get the wrong idea of what this PR ships. They also miss the new cross-team contract that SonarQube Cloud must send this property. Update the title, description and test plan to match the property-based SemSitterFlag.

Verification Rules 3/3 met Repos 4 inspected · PRs 1 inspected

Functional validation No results

Rules 3 passed 2 not applicable

✅ Internal artifact registries
✅ Release secrets usage
✅ Repository license compliance

Broader impact Repos 4 inspected PRs 1 inspected
Cross-repo 4 repositories inspected 0 open impacts

SonarSource/sonar-iac Inspected
SonarSource/sonarlint-intellij Inspected
SonarSource/sonarlint-eclipse Inspected
SonarSource/sonarlint-vscode Inspected

Cross-PR 1 PR inspected 0 open impacts

PR 6583: JAVA-7406 Offer the SemSitter frontend behind a flag Inspected

Auto-approval Not enabled

Set up

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

@sonarqube-next

sonarqube-next Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

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.

1 participant