Skip to content

SLCORE-2243 Add connected mode and on-demand artifact resolvers#1925

Merged
nquinquenel merged 6 commits intofeature/on-demand-analyzersfrom
feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts
Mar 24, 2026
Merged

SLCORE-2243 Add connected mode and on-demand artifact resolvers#1925
nquinquenel merged 6 commits intofeature/on-demand-analyzersfrom
feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts

Conversation

@Krosovok
Copy link
Copy Markdown
Contributor

No description provided.

@Krosovok Krosovok requested a review from nquinquenel March 18, 2026 12:09
@sonar-review-alpha
Copy link
Copy Markdown

sonar-review-alpha bot commented Mar 18, 2026

Summary

This PR introduces a resolver-based architecture for plugin artifact management in connected mode and on-demand scenarios. The key changes are:

  1. Artifact Resolver Pattern: New ConnectedModeArtifactResolver and ConnectedModeCompanionPluginResolver classes handle plugin resolution with automatic scheduling of background downloads when needed.

  2. Shared Download Executor: UniqueTaskExecutor deduplicates concurrent plugin downloads for the same connection+plugin combination, preventing redundant work and race conditions.

  3. Event Model Refactoring: PluginStatusChangedEventPluginStatusUpdateEvent now carries a collection of statuses per connection, enabling batch updates when downloads complete.

  4. Centralized Download Logic: ServerPluginDownloader orchestrates all plugin downloads (language and companion) and publishes status events on completion.

What reviewers should know

Start here:

  • UniqueTaskExecutor.java — The core innovation: a simple key-based deduplicator ensuring only one download runs per plugin
  • ServerPluginDownloader.java — Orchestrates downloads and event publishing
  • ConnectedModeArtifactResolver.java — How language plugins are resolved from server storage or scheduled for download

Key logic to understand:

  • Language plugins return immediately with SYNCED if locally up-to-date (hash match), or DOWNLOADING if a background fetch is scheduled
  • Enterprise languages (SECRETS, IAC, GO) have version gates that are checked before resolution
  • The skipSyncPluginKeys mechanism allows IDEs to override server plugins with embedded versions
  • Fallback logic handles plugin key renames (e.g., "iacenterprise" → "iac")

Watch for:

  • Event publishing happens asynchronously after downloads complete — reviewers should verify events are fired for both success and failure paths
  • The isSonarQubeCloudOrVersionAtLeast static method is now shared between resolvers and PluginsService — confirm it's used consistently
  • Package moves from ondemand to resolvers touch many imports

  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

@hashicorp-vault-sonar-prod
Copy link
Copy Markdown

hashicorp-vault-sonar-prod bot commented Mar 18, 2026

SLCORE-2243

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Two real bugs need fixing before merge — companion plugins will silently serve stale jars after a server upgrade, and an unguarded code path in the companion download lambda can leave the UI stuck in DOWNLOADING state indefinitely.

🗣️ Give feedback

@nquinquenel nquinquenel requested a review from Copilot March 19, 2026 08:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces new artifact resolver implementations intended to support downloading analyzers in both connected mode (from server) and on-demand mode (from a remote URL/cache), along with corresponding unit tests.

Changes:

  • Add ConnectedModeArtifactResolver to resolve/sync plugins from SonarQube/SonarCloud storage/server plugin lists, including companion plugin handling.
  • Add OnDemandArtifactResolver to download/version-cache specific artifacts on demand with signature verification and event publishing.
  • Add unit tests covering download scheduling, status reporting, and success/error paths for both resolvers.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/resolvers/ConnectedModeArtifactResolver.java New connected-mode resolver that reads server plugin lists / storage, schedules downloads, and publishes status update events.
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ondemand/OnDemandArtifactResolver.java New on-demand resolver that downloads artifacts into a versioned cache, verifies signatures, and publishes status update events.
backend/core/src/test/java/org/sonarsource/sonarlint/core/plugin/ConnectedModeArtifactResolverTest.java New unit tests validating connected-mode resolver behavior across storage/server/error scenarios.
backend/core/src/test/java/org/sonarsource/sonarlint/core/plugin/ondemand/OnDemandArtifactResolverTest.java New unit tests validating on-demand resolver behavior for async downloads, caching, and event publishing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@Krosovok Krosovok force-pushed the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch from c81873d to cf5fc28 Compare March 19, 2026 13:13
Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Solid work overall — the async download pattern, cache management, and version-gate logic are well structured. Two bugs need fixing before merge: a race condition in the synchronous extra-artifact path and a missing error handler in companion-plugin downloads.

🗣️ Give feedback

@Krosovok Krosovok force-pushed the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch from cf5fc28 to 22b01b7 Compare March 20, 2026 15:42
Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: The two resolver classes are well-structured and fit cleanly into the existing architecture. One real test bug and one logic duplication need attention before merge.

🗣️ Give feedback

@nquinquenel nquinquenel force-pushed the feature/on-demand-analyzers branch from 164f088 to 2d8567a Compare March 22, 2026 19:58
@nquinquenel nquinquenel force-pushed the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch from 22b01b7 to 2ca7ac5 Compare March 22, 2026 21:49
@nquinquenel nquinquenel changed the base branch from feature/on-demand-analyzers to feature/vt/SLCORE-2242-resolve-embedded-unsupported-premium-artifacts March 22, 2026 21:50
Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Two real bugs need fixing before merge: one causes a missing status notification that leaves a language permanently stuck in "downloading", and one turns an intended graceful degradation into an uncaught exception. See inline comments.

🗣️ Give feedback

@Krosovok Krosovok force-pushed the feature/vt/SLCORE-2242-resolve-embedded-unsupported-premium-artifacts branch from 474a0c7 to f2d5ed6 Compare March 23, 2026 09:15
@Krosovok Krosovok force-pushed the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch from 2ca7ac5 to 56c111f Compare March 23, 2026 09:25
Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Most of the previous round's issues have been addressed cleanly — the companion-hash check, the stuck-in-DOWNLOADING bug, scheduleIfNotInProgress extraction, and the blocking test helper are all fixed. Three issues remain open: the IAC fallback event notification bug (real data loss in production), the useless null guard on version(), and the isSonarCloud ternary duplication.

🗣️ Give feedback

@Krosovok Krosovok changed the base branch from feature/vt/SLCORE-2242-resolve-embedded-unsupported-premium-artifacts to feature/on-demand-analyzers March 23, 2026 13:16
@Krosovok Krosovok force-pushed the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch 4 times, most recently from 9a15124 to 6080d4f Compare March 23, 2026 14:00
@Krosovok Krosovok changed the base branch from feature/on-demand-analyzers to feature/vt/SLCORE-2242-resolve-embedded-unsupported-premium-artifacts March 23, 2026 14:07
@Krosovok Krosovok force-pushed the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch from 6080d4f to d450532 Compare March 23, 2026 14:10
@Krosovok Krosovok changed the base branch from feature/vt/SLCORE-2242-resolve-embedded-unsupported-premium-artifacts to feature/on-demand-analyzers March 23, 2026 14:11
Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Four of the five previously flagged issues are properly resolved. The IAC fallback notification bug (ID 2972231832) is still present and needs fixing before merge.

🗣️ Give feedback

@nquinquenel nquinquenel force-pushed the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch from 1baf305 to a350610 Compare March 23, 2026 15:32
Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Clean, well-structured refactor with good test coverage. One logic duplication worth collapsing before this pattern drifts further.

🗣️ Give feedback

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: The two previously flagged issues remain unaddressed. The IAC fallback bug (#2972231832) is a functional defect that will leave ANSIBLE and GITHUBACTIONS languages stuck in DOWNLOADING state permanently on any server that does not have iacenterprise but has iac.

🗣️ Give feedback

@sonarqube-next
Copy link
Copy Markdown

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: The logic duplication issue is cleanly resolved. The IAC fallback notification bug is still present and needs fixing before merge.

🗣️ Give feedback

@nquinquenel nquinquenel merged commit fa2aac2 into feature/on-demand-analyzers Mar 24, 2026
15 checks passed
@nquinquenel nquinquenel deleted the feature/vt/SLCORE-2243-resolve-connected-ondemand-artifacts branch March 24, 2026 09:23
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.

3 participants