Skip to content

SLCORE-2238 Add on-demand plugin storage infrastructure#1920

Open
Krosovok wants to merge 1 commit intofeature/on-demand-analyzersfrom
feature/vt/SLCORE-2238-on-demand-storage
Open

SLCORE-2238 Add on-demand plugin storage infrastructure#1920
Krosovok wants to merge 1 commit intofeature/on-demand-analyzersfrom
feature/vt/SLCORE-2238-on-demand-storage

Conversation

@Krosovok
Copy link
Contributor

No description provided.

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

sonar-review-alpha bot commented Mar 18, 2026

Summary

Adds foundational infrastructure for on-demand plugin storage. Introduces DownloadableArtifact enum to define downloadable plugins (C-family, C#, OmniSharp) with version management and URL pattern generation, and OnDemandPluginCacheManager to manage plugin cache lifecycle by deleting version directories older than 60 days while preserving the current version. Includes a test dependency (system-stubs-jupiter) for mocking system properties during testing.

What reviewers should know

Start with DownloadableArtifact.java — it's the core abstraction that maps artifact keys to versions and download URLs. Note the three OmniSharp entries have TODO comments and incomplete URL patterns ("TBA"), indicating future work. The properties files are templates/fixtures that versions will be injected into during the build. OnDemandPluginCacheManager uses file modification time to determine age, so understand that the 60-day retention window is based on last-modified rather than creation time. The test fixture versions (cfamily 6.50.0, csharp 9.32.0) match the main properties template. No actual downloads or caching logic is implemented yet — this PR establishes the data model and cleanup infrastructure.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

@hashicorp-vault-sonar-prod
Copy link

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

SLCORE-2238

Copy link

@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 cache cleanup logic is clean and well-tested, but there's a latent runtime crash in DownloadableArtifact that needs fixing before this is merged.

🗣️ Give feedback

CSHARP_OSS("cs", "cs.version", "/Distribution/sonar-csharp-plugin/sonar-csharp-plugin-%s.jar"),
OMNISHARP_MONO("omnisharpMonoLocation", "omnisharp.mono.version", "TBA"), // todo urlPattern
OMNISHARP_NET6("omnisharpNet6Location", "omnisharp.net6.version", "TBA"), // todo urlPattern
OMNISHARP_WIN("omnisharpWinLocation", "omnisharp.win.version", "TBA"); // todo urlPattern

Choose a reason for hiding this comment

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

The three OmniSharp entries reference version keys (omnisharp.mono.version, omnisharp.net6.version, omnisharp.win.version) that are absent from ondemand-plugins.properties. Calling version() on any of them throws IllegalStateException at runtime — the guard on line 53 makes it fail loudly, not silently. Since byArtifactKey is public and these artifact keys are real lookup strings, any caller that resolves an OmniSharp artifact and then calls version() will blow up in production.

Either add placeholder entries in the properties file (even empty/commented-out ones with a clear TODO) so the failure surface is obvious, or don't add the OmniSharp entries to the enum until their version and URL are defined.

  • Mark as noise

Copy link

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

Adds initial infrastructure for on-demand plugin storage by introducing a cache cleanup manager, a registry of downloadable artifacts, and a resource file intended to provide artifact versions.

Changes:

  • Introduce OnDemandPluginCacheManager and unit tests to clean up old cached plugin versions based on retention.
  • Add DownloadableArtifact enum to describe downloadable artifacts and load their versions from a classpath properties file.
  • Add ondemand-plugins.properties as the source of artifact version values.

Reviewed changes

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

File Description
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ondemand/OnDemandPluginCacheManager.java New cache cleanup logic for removing old plugin-version directories.
backend/core/src/test/java/org/sonarsource/sonarlint/core/plugin/ondemand/OnDemandPluginCacheManagerTest.java New unit tests covering cleanup behavior for missing/current/old/recent version dirs.
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ondemand/DownloadableArtifact.java New artifact registry that loads version strings from a properties resource and builds URLs.
backend/core/src/main/resources/ondemand-plugins.properties New properties file intended to provide versions for on-demand artifacts.

💡 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-2238-on-demand-storage branch from 8831045 to 9ace31a Compare March 19, 2026 10:09
@sonarqube-next
Copy link

Copy link

@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 misleading "LRU" comment has been corrected, but the OmniSharp runtime-crash issue flagged in the previous round is still unresolved.

🗣️ Give feedback

}

public String urlPattern() {
var base = System.getProperty(PROPERTY_URL_PATTERN, "https://binaries.sonarsource.com");
Copy link
Member

Choose a reason for hiding this comment

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

I'd put the binaries URL as a static var

Comment on lines +1 to +2
cfamily.version=6.50.0
cs.version=9.32.0 No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

I think we need the full version here, with the build, no?

Copy link
Member

Choose a reason for hiding this comment

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

Edit: I noticed the other PR, I guess this is temporary

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