Skip to content

SONARJAVA-7339 Add the SemSitter front-end module with its protobuf data model - #6541

Draft
rombirli wants to merge 5 commits into
masterfrom
rombirli/semsitter-frontend-data-model
Draft

rombirli wants to merge 5 commits into
masterfrom
rombirli/semsitter-frontend-data-model

Conversation

@rombirli

@rombirli rombirli commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Part 1 of 2 split from #6533.

New Maven module java-frontend-semsitter, next to the ECJ-based java-frontend. Nothing depends on it yet. It will host the SemSitter front-end so the two can be switched behind a feature flag later.

The data model is not defined here. It is the jar org.sonarsource.semsitter:analyzer-wire:2.0.0, generated in SemSitter from analyzer.proto (SonarSource/semsitter#5821). This module depends on that jar. There is no copy of the proto and no submodule.

Document is fully protobuf: tree, symbols, reference facts and graph facts. Control lines and the get-types payload stay JSON, and that is the client's job in #6542.

CI of this PR resolves the jar only after analyzer-wire 2.0.0 is published.


Summary by Gitar

  • CI:
    • Added install-analyzer-wire.sh to fetch and install analyzer-wire 2.0.0 from Artifactory before builds
    • Read Repox credentials via Vault in build.yml
  • Build:
    • Registered java-frontend-semsitter module and analyzer-wire version in root pom.xml
  • Tests:
    • Added ProtocolTest covering Document and StringList protobuf round trips

This will update automatically on new commits.

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

SONARJAVA-7339

@datadog-sonarsource

datadog-sonarsource Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Pipelines

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

Build | Test Analyze

View more details · View in GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 82dff6d | Docs | View more details | Give us feedback!

@rombirli
rombirli added this pull request to stack #6543 November 20, 2026 08:08
Comment on lines +44 to 46
- name: Install analyzer-wire
run: bash ./.github/scripts/install-analyzer-wire.sh
- uses: SonarSource/ci-github-actions/build-maven@v2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Bug: Other full-reactor jobs still don't install analyzer-wire

This commit adds the install-analyzer-wire.sh step only to the build and qa-os-win jobs. Several other jobs also resolve the root reactor, which now includes java-frontend-semsitter (pom.xml:54) and depends on org.sonarsource.semsitter:analyzer-wire:2.0.0:

  • test-analyze runs build-maven@v2 on the whole project (build.yml:359).
  • custom-rules-license-check runs license-maven-plugin:aggregate-add-third-party from the repo root (build.yml:420), which resolves the dependencies of every module.
  • The scheduled unified-dogfooding.yml build runs build-maven@v2 on the full reactor (unified-dogfooding.yml:24).

The new step exists because Maven can't resolve the jar from the configured repositories. These jobs will hit the same dependency-resolution error, and since promote needs test-analyze and custom-rules-license-check, a PR build will fail to promote. Fix: add Install analyzer-wire to each of these jobs. In test-analyze and unified-dogfooding, add a config-maven step first so ARTIFACTORY_* is set, as done in build.

Add the install step to custom-rules-license-check (after config-maven), and add config-maven plus the install step before build-maven in test-analyze and unified-dogfooding:

- name: Configure Maven
  uses: SonarSource/ci-github-actions/config-maven@v2
  with:
    repox-url: https://repox-internal.dev.sonar.build
    artifactory-reader-role: private-reader
    use-develocity: ${{ env.USE_DEVELOCITY }}
    develocity-url: ${{ env.DEVELOCITY_URL }}
- name: Install analyzer-wire
  run: bash ./.github/scripts/install-analyzer-wire.sh
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

Comment on lines +4 to +13
base="${ARTIFACTORY_URL}/sonarsource-public-qa/org/sonarsource/semsitter/analyzer-wire/2.0.0"
dest="${RUNNER_TEMP}/analyzer-wire"
mkdir -p "$dest"
curl -fsS -u "${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}" \
-o "$dest/analyzer-wire-2.0.0.pom" "$base/analyzer-wire-2.0.0.pom"
curl -fsS -u "${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}" \
-o "$dest/analyzer-wire-2.0.0.jar" "$base/analyzer-wire-2.0.0.jar"
mvn -B org.apache.maven.plugins:maven-install-plugin:3.1.2:install-file \
-Dfile="$dest/analyzer-wire-2.0.0.jar" \
-DpomFile="$dest/analyzer-wire-2.0.0.pom"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: analyzer-wire version is hard-coded separately from pom.xml

The script hard-codes 2.0.0 in the URL and file names. The version Maven actually resolves is declared separately in dependencyManagement (pom.xml:344-346). If the pom version is bumped and the script is not, CI installs the stale 2.0.0 jar and the build still fails to resolve the new version. Fix: put the version in a single variable, or read it from the pom (e.g. mvn help:evaluate), and pass it to the script.

Parameterize the version so it can be passed in (or derived from the pom) in one place:

version="${ANALYZER_WIRE_VERSION:-2.0.0}"
base="${ARTIFACTORY_URL}/sonarsource-public-qa/org/sonarsource/semsitter/analyzer-wire/${version}"
dest="${RUNNER_TEMP}/analyzer-wire"
mkdir -p "$dest"
for ext in pom jar; do
  curl -fsS -u "${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}" \
    -o "$dest/analyzer-wire-${version}.${ext}" "$base/analyzer-wire-${version}.${ext}"
done
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-data-model branch from f550b6f to 82dff6d Compare November 20, 2026 10:29
@gitar-bot

gitar-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
CI failed: The Test Analyze job (136233007191) failed because the SonarScanner's request for the provisioned JRE from the SonarQube server timed out, which looks like a server or network availability problem. The finding is not attributed to this PR, though the log alone does not fully rule out other causes.

Overview

The Test Analyze job (136233007191) failed because the SonarScanner's request for the provisioned JRE from the SonarQube server timed out, which looks like a server or network availability problem. The finding is not attributed to this PR, though the log alone does not fully rule out other causes.

Failures

Test Analyze job: SonarScanner timed out downloading provisioned JRE from SonarQube (not related to PR)

  • Type: infrastructure
  • Affected jobs: 136233007191
  • Related to change: no
  • Confidence: high
  • Root cause: The Sonar Maven goal failed on the request to /api/v2/analysis/jres/f4e17091-1dca-4306-8447-a68248805664: the response stream closed after an HttpTimeoutException (request timed out). This indicates a server or network availability issue; the Develocity authentication notice is informational and did not cause the failure. The PR adds the SemSitter module and analyzer-wire setup, but no supplied evidence connects those changes to the SonarQube JRE download timeout.
  • Suggested fix: Retry the analysis job and check SonarQube server and network health if the timeout recurs. No code change is indicated by this log.

Summary

  • Change-related failures: 0
  • Infrastructure/flaky failures: 1
  • Recommended action: Retry the analysis job and check SonarQube server and network health if the timeout recurs. No code change is indicated by this log.
Code Review ⚠️ Changes requested 🟡 Medium risk 2 closed / 4 findings

Adding authenticated analyzer-wire retrieval and a new Maven module changes CI dependency setup; artifact or credential failures could block builds.

Adds the java-frontend-semsitter module with its protobuf data model, consuming analyzer-wire 2.0.0 and wiring it into root pom.xml and CI with an install step. Changes requested: the analyzer-wire install step is missing from test-analyze, custom-rules-license-check, and unified-dogfooding, so those jobs will fail dependency resolution and block promote. Also, the script hard-codes 2.0.0 separately from the version in pom.xml, so a future bump could install a stale jar.

Resolved since the last review: TypeRef.Kind now has a real zero-value kind (NAMED), and the client no longer discards scan warnings on Response.

⚠️ Bug: Other full-reactor jobs still don't install analyzer-wire

📄 .github/workflows/build.yml:44-46 📄 .github/workflows/build.yml:359-367 📄 .github/workflows/build.yml:399-413 📄 pom.xml:54

This commit adds the install-analyzer-wire.sh step only to the build and qa-os-win jobs. Several other jobs also resolve the root reactor, which now includes java-frontend-semsitter (pom.xml:54) and depends on org.sonarsource.semsitter:analyzer-wire:2.0.0:

  • test-analyze runs build-maven@v2 on the whole project (build.yml:359).
  • custom-rules-license-check runs license-maven-plugin:aggregate-add-third-party from the repo root (build.yml:420), which resolves the dependencies of every module.
  • The scheduled unified-dogfooding.yml build runs build-maven@v2 on the full reactor (unified-dogfooding.yml:24).

The new step exists because Maven can't resolve the jar from the configured repositories. These jobs will hit the same dependency-resolution error, and since promote needs test-analyze and custom-rules-license-check, a PR build will fail to promote. Fix: add Install analyzer-wire to each of these jobs. In test-analyze and unified-dogfooding, add a config-maven step first so ARTIFACTORY_* is set, as done in build.

Add the install step to custom-rules-license-check (after config-maven), and add config-maven plus the install step before build-maven in test-analyze and unified-dogfooding
- name: Configure Maven
  uses: SonarSource/ci-github-actions/config-maven@v2
  with:
    repox-url: https://repox-internal.dev.sonar.build
    artifactory-reader-role: private-reader
    use-develocity: ${{ env.USE_DEVELOCITY }}
    develocity-url: ${{ env.DEVELOCITY_URL }}
- name: Install analyzer-wire
  run: bash ./.github/scripts/install-analyzer-wire.sh
💡 Quality: analyzer-wire version is hard-coded separately from pom.xml

📄 .github/scripts/install-analyzer-wire.sh:4-13 📄 pom.xml:344-346

The script hard-codes 2.0.0 in the URL and file names. The version Maven actually resolves is declared separately in dependencyManagement (pom.xml:344-346). If the pom version is bumped and the script is not, CI installs the stale 2.0.0 jar and the build still fails to resolve the new version. Fix: put the version in a single variable, or read it from the pom (e.g. mvn help:evaluate), and pass it to the script.

Parameterize the version so it can be passed in (or derived from the pom) in one place
version="${ANALYZER_WIRE_VERSION:-2.0.0}"
base="${ARTIFACTORY_URL}/sonarsource-public-qa/org/sonarsource/semsitter/analyzer-wire/${version}"
dest="${RUNNER_TEMP}/analyzer-wire"
mkdir -p "$dest"
for ext in pom jar; do
  curl -fsS -u "${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}" \
    -o "$dest/analyzer-wire-${version}.${ext}" "$base/analyzer-wire-${version}.${ext}"
done
✅ 2 closed
✅ Quality: TypeRef.Kind has a real kind (NAMED) as its zero value

📄 java-frontend-semsitter/src/main/proto/semsitter.proto:185-199 📄 java-frontend-semsitter/src/main/proto/semsitter.proto:227-232 📄 java-frontend-semsitter/src/main/proto/semsitter.proto:273-279
In proto3 an enum field that is never set reads as its zero value, and a message field that is never set reads as the default instance. Here TypeRef.Kind uses NAMED = 0, so an unset TypeRef comes back as a NAMED type with id "". That applies to Member.return_type for a FIELD, a superclass_type that was never filled in, or a server that forgot to set kind. A consumer calling getReturnType() / getKind() can't tell that apart from a real named type, even though the schema already has an UNKNOWN value. Member.Kind in the same file does use KIND_UNSPECIFIED = 0, so the two enums are inconsistent. TypeAnnotation.Target (TYPE = 0) has the same problem. The test already depends on the implicit default by building TypeRef.newBuilder().setId("java.util.List") without a kind. Renumbering enum values later breaks the wire format against udg-java-server, so the cheap moment to fix this is now, before the schema ships.

✅ Cross-PR: Client throws away the scan warnings the schema puts on Response

📄 java-frontend-semsitter/src/main/proto/semsitter.proto:58-59
Breaks when both PRs merge and a protocol-2 server sends warnings on a scan response (unresolved imports with no dependencies configured).

How

  1. semsitter.proto:59 puts repeated string warnings on the top-level Response, not inside the per-command result messages.
  2. SemSitterClient.java:122-138 (send) checks the id and the ERROR case, then returns the Response without reading getWarningsList().
  3. SemSitterClient.java:97-120 (setSettings, fullGen, getFile, getTypes, hasPackage) return only the nested result, such as .getFullGen() or .getDocument(), so callers never see the warnings.
  4. The warnings are not logged either, so the server's hint about missing dependencies disappears without a trace.

Fix

  • This PR: nothing needed. Optionally move warnings into the result messages that can carry them (FullGenResponse, Document) so the unwrapped value still holds them.
  • SONARJAVA-7339 Add the SemSitter client #6542: in send, log response.getWarningsList() or pass the warnings to a listener, or return the whole Response from the scan methods.

Compared e837f5c with #6542 at 97338c2

🤖 Prompt for agents
Code Review: Adds the `java-frontend-semsitter` module with its protobuf data model, consuming `analyzer-wire` 2.0.0 and wiring it into root `pom.xml` and CI with an install step. Changes requested: the `analyzer-wire` install step is missing from `test-analyze`, `custom-rules-license-check`, and unified-dogfooding, so those jobs will fail dependency resolution and block `promote`. Also, the script hard-codes `2.0.0` separately from the version in `pom.xml`, so a future bump could install a stale jar.
  
  Resolved since the last review: `TypeRef.Kind` now has a real zero-value kind (`NAMED`), and the client no longer discards scan warnings on `Response`.

1. ⚠️ Bug: Other full-reactor jobs still don't install analyzer-wire
   Files: .github/workflows/build.yml:44-46, .github/workflows/build.yml:359-367, .github/workflows/build.yml:399-413, pom.xml:54

   This commit adds the `install-analyzer-wire.sh` step only to the `build` and `qa-os-win` jobs. Several other jobs also resolve the root reactor, which now includes `java-frontend-semsitter` (pom.xml:54) and depends on `org.sonarsource.semsitter:analyzer-wire:2.0.0`:
   - `test-analyze` runs `build-maven@v2` on the whole project (build.yml:359).
   - `custom-rules-license-check` runs `license-maven-plugin:aggregate-add-third-party` from the repo root (build.yml:420), which resolves the dependencies of every module.
   - The scheduled `unified-dogfooding.yml` build runs `build-maven@v2` on the full reactor (unified-dogfooding.yml:24).
   
   The new step exists because Maven can't resolve the jar from the configured repositories. These jobs will hit the same dependency-resolution error, and since `promote` needs `test-analyze` and `custom-rules-license-check`, a PR build will fail to promote. Fix: add `Install analyzer-wire` to each of these jobs. In `test-analyze` and unified-dogfooding, add a `config-maven` step first so `ARTIFACTORY_*` is set, as done in `build`.

   Fix (Add the install step to custom-rules-license-check (after config-maven), and add config-maven plus the install step before build-maven in test-analyze and unified-dogfooding):
   - name: Configure Maven
     uses: SonarSource/ci-github-actions/config-maven@v2
     with:
       repox-url: https://repox-internal.dev.sonar.build
       artifactory-reader-role: private-reader
       use-develocity: ${{ env.USE_DEVELOCITY }}
       develocity-url: ${{ env.DEVELOCITY_URL }}
   - name: Install analyzer-wire
     run: bash ./.github/scripts/install-analyzer-wire.sh

2. 💡 Quality: analyzer-wire version is hard-coded separately from pom.xml
   Files: .github/scripts/install-analyzer-wire.sh:4-13, pom.xml:344-346

   The script hard-codes `2.0.0` in the URL and file names. The version Maven actually resolves is declared separately in `dependencyManagement` (pom.xml:344-346). If the pom version is bumped and the script is not, CI installs the stale 2.0.0 jar and the build still fails to resolve the new version. Fix: put the version in a single variable, or read it from the pom (e.g. `mvn help:evaluate`), and pass it to the script.

   Fix (Parameterize the version so it can be passed in (or derived from the pom) in one place):
   version="${ANALYZER_WIRE_VERSION:-2.0.0}"
   base="${ARTIFACTORY_URL}/sonarsource-public-qa/org/sonarsource/semsitter/analyzer-wire/${version}"
   dest="${RUNNER_TEMP}/analyzer-wire"
   mkdir -p "$dest"
   for ext in pom jar; do
     curl -fsS -u "${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}" \
       -o "$dest/analyzer-wire-${version}.${ext}" "$base/analyzer-wire-${version}.${ext}"
   done

Verification Rules 1/3 met PRs 2 inspected
Rules 2 failed 1 passed 1 not applicable

❌ Approved GitHub Actions runners - The notify job uses the retired sonar-xs-public label; replace it with sonar-xs per the internal GitHub Actions runners policy. The other runners, including the ruling-qa matrix, are approved warp-custom labels.
❌ Internal artifact registries - The new install step and the existing steps use https://repox-internal.dev.sonar.build/artifactory, a host outside the approved Repox endpoints (repox.jfrog.io, repox.sonar.build, repox-internal.sonar.build); verify the host or switch to an approved one (policy: https://xtranet-sonarsource.atlassian.net/wiki/spaces/Platform/pages/872153170/Artifact+Management+-+Engineering+Experience+Squad).
✅ Repository license compliance

Functional validation No results

Broader impact PRs 2 inspected
Cross-PR 2 PRs inspected 0 open impacts

PR 6542: SONARJAVA-7339 Add the SemSitter server client Inspected
PR 6500: SONARJAVA-7320 Cache safe Maven module results in PR checks Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.
Unblock → Override a blocking verdict and allow merging.

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

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

Was this helpful? React with 👍 / 👎 | Gitar

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