Skip to content

fix: extend tracking fallback to accept same-id-different-URL entries - #2134

Open
gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:fix/same-id-different-url-fallback
Open

fix: extend tracking fallback to accept same-id-different-URL entries#2134
gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:fix/same-id-different-url-fallback

Conversation

@gnodet

@gnodet gnodet commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #2133 added a legacy tracking fallback for entries written by older resolvers using ID-only keys (nid format). However, it does not fix the actual Maven IT failures.

The real problem (identified by @cstamas): when ITs run, support artifacts are installed from real Central, producing nid_hurl tracking entries:

sisu-maven-plugin-1.1.0.jar>central-8fac3ebd6edbaca3c794783fa38088af0aa128e7=

where 8fac3ebd... = sha1(https://repo.maven.apache.org/maven2).

Then each IT overrides central to file:target/null to prevent remote access. The resolver looks for:

sisu-maven-plugin-1.1.0.jar>central-<sha1(file:target/null)>=

The sha1 hashes differ → exact lookup misses → artifact treated as "present but unavailable" → tries to download from file:target/null → 💥. All 9 IT jobs fail (4229 failures across 507 test classes).

Fix

Add a second fallback stage inside the existing legacyTrackingFallback guard: after the legacy ID-only check, scan tracking entries for any key matching the repo-ID prefix (repoId-). This accepts artifacts tracked under the same logical repository identity regardless of the URL hash suffix.

The prefix uses repoId- (with the dash separator from the nid_hurl format) to avoid false positives with repos whose ID shares a prefix (e.g. central must not match centralbackup-<sha1>).

Tests

  • testUrlQualifiedTrackingSameIdDifferentUrlAcceptedViaFallback: same-id-different-URL now accepted (was: assertFalse)
  • testUrlQualifiedTrackingAcceptsSameIdDifferentUrlEntries: new — simulates the IT scenario (Central → file:target/null)
  • Updated factory tests to reflect relaxed same-id behavior
  • All 587 resolver tests pass

Related

The legacy tracking fallback added in apache#2133 handles entries written by
older resolvers using ID-only keys (nid format). However, it does not
handle the case where tracking entries ARE in nid_hurl format but the
repository URL has changed — the scenario that breaks Maven ITs.

When ITs run, the support artifacts are installed into the shared local
repo from real Central, producing tracking entries like:
  artifact>central-<sha1(https://repo.maven.apache.org/maven2)>=

Then each IT overrides central to file:target/null to prevent remote
access. The resolver looks for:
  artifact>central-<sha1(file:target/null)>=

The sha1 hashes differ, so the exact lookup misses, and the artifact
is treated as 'present but unavailable'.

Add a second fallback stage: after the legacy ID-only check, scan the
tracking entries for any key matching the repo-ID prefix ('repoId-').
This accepts artifacts tracked under the same logical repository
identity regardless of the URL hash suffix.

The prefix uses 'repoId-' (with the dash separator) to avoid false
positives with repos whose ID shares a prefix (e.g. 'central' must
not match 'centralbackup-<sha1>').
@gnodet
gnodet requested a review from cstamas September 8, 2026 17:57

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Solid fix. The prefix-based same-ID fallback correctly resolves the IT failure scenario (Central URL override producing mismatched SHA1 hashes in tracking entries). Well-guarded behind legacyTrackingFallback, thorough inline comments, and adequate test coverage.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@cstamas

cstamas commented Sep 8, 2026

Copy link
Copy Markdown
Member

Does not this fully defies f013 fix?

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.

2 participants