Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Bug: GH-1703 Locally cached artifacts defy RRF
Within ArtifactResolver there was a subtle bug,
caused by unintentional lazy evaluation of
logical OR. In case filter is present, it is
ONLY and only LRM availability that drives the logic.
  • Loading branch information
cstamas committed Dec 10, 2025
commit 87690f51edf2c7822ba8feb504a15d9832e8b79c
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,10 @@ private List<ArtifactResult> resolve(
new LocalArtifactRequest(
artifact, filteredRemoteRepositories, request.getRequestContext()));
result.setLocalArtifactResult(local);
boolean found = (filter != null && local.isAvailable()) || isLocallyInstalled(local, versionResult);
// with filtering it is availability that drives logic
// without filtering it is simply presence of file that drives the logic
boolean found = (filter != null && local.isAvailable())
|| (filter == null && isLocallyInstalled(local, versionResult));
// with filtering: availability drives the logic
// without filtering: simply presence of file drives the logic
// "interop" logic with simple LRM leads to RRF breakage: hence is ignored when filtering in effect
if (found) {
if (local.getRepository() != null) {
Expand Down Expand Up @@ -480,6 +481,18 @@ private List<ArtifactResult> resolve(
}
}

/**
* This is the method that checks local artifact result if no RRF being used. Unlike with RRF, where only
* {@link LocalArtifactResult#isAvailable()} is checked, here we perform multiple checks:
* <ul>
* <li>if {@link LocalArtifactResult#isAvailable()} is {@code true}, return {@code true}</li>
* <li>if {@link LocalArtifactResult#getRepository()} is instance of {@link LocalRepository}, return {@code true}</li>
* <li>if {@link LocalArtifactResult#getRepository()} is {@code null} and request had zero remote repositories set, return {@code true}</li>
* </ul>
* Note: the third check is interfering with RRF, as RRF may make list of remote repositories empty, that was
* originally non-empty, by eliminating remote repositories to consider.
* Hence, we may use this method ONLY if RRF is inactive.
*/
private boolean isLocallyInstalled(LocalArtifactResult lar, VersionResult vr) {
if (lar.isAvailable()) {
return true;
Expand Down