reda-alaoui commented on PR #534:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/534#issuecomment-6859135343

   _This analysis was AI generated._
   
   We merged this PR into our fork's maintenance branch, and its integration 
tests turned up three problems with the current head (3db7dae). The failures 
under 1 and 3 reproduce on this PR's head itself; the overflow under 2 showed 
up on our fork, from code this PR adds unchanged.
   
   **1. A dependency whose POM is not downloaded yet loses its transitive 
dependencies.**
   The key-time collection runs offline but shares the session's 
`RepositoryCache`. When a dependency's POM is not in the local repository yet, 
the offline collection records an empty descriptor in Resolver's `DataPool`, 
and the build's own resolution then reuses it. In a fresh checkout of this PR, 
the first build of `DependencyVersionChangeInvalidatesCacheTest` already fails: 
`The POM for … is missing, no dependency information available`, then 
`NoClassDefFoundError: org/hamcrest/SelfDescribing` in surefire. Any CI agent 
that meets a new dependency version would hit this.
   
   Under Maven's lenient descriptor policy the missing POM does not even throw, 
so the incomplete-graph detection never fires: the key is computed from a graph 
truncated below that dependency.
   
   **2. The incomplete-graph marker is not a hash.**
   `markIncompleteDependencyGraph` stores `UUID.randomUUID().toString()`, but 
`HashChecksum.update(String)` only accepts hex hashes. With XX, the default 
algorithm, the checksum buffer overflows (`BufferOverflowException`) and the 
build fails. The PR's IT project configures SHA-256, which only digests the 
decoded junk, so the tests never hit it.
   
   **3. The checksum depends on the requested phase.**
   This is the regression @AlexanderAshitkin flagged: with 
`includeTestDependencies`, a `compile` build and a later `install` of the same 
inputs get different checksums. `Issue449Test` and 
`MissingExecutionTriggerRebuildTest` fail on this PR's head because of it.
   
   How we fixed them on our branch, in case it helps:
   - 
[c075b01](https://github.com/Cosium/maven-build-cache-extension/commit/c075b019847f0afa78a269acf344f08bbb7a9c48):
 the offline collection gets its own `RepositoryCache` and a strict descriptor 
policy. When the local repository is incomplete, the graph is collected again 
with the build's own session, which downloads the POMs the build needs anyway. 
A cold local repository then keeps its transitive dependencies, gets a complete 
key, and still uses the cache. `ColdLocalRepositoryTest` covers it.
   - 
[753183e](https://github.com/Cosium/maven-build-cache-extension/commit/753183e51605248365579f91218973868f9dad5c):
 the marker is a hash of the random value.
   - 
[9f04e8e](https://github.com/Cosium/maven-build-cache-extension/commit/9f04e8ec1df5225b66a05f4e47b9d102ef2d2310):
 the test-dependencies flag is removed, so test scope is always part of the key.
   
   These commits sit on top of our fork's 1.3.0.x code, which threads a cache 
zone through the checksum calculation, so they won't apply here as is.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to