cowwoc commented on code in PR #394:
URL:
https://github.com/apache/maven-build-cache-extension/pull/394#discussion_r2578228299
##########
src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java:
##########
@@ -974,6 +1164,285 @@ public FileVisitResult visitFile(Path path,
BasicFileAttributes basicFileAttribu
return hasFiles.booleanValue();
}
+ /**
+ * Move pre-existing build artifacts to staging directory to prevent
caching stale files.
+ *
+ * <p><b>DESIGN RATIONALE - Staleness Detection via Staging Directory:</b>
+ *
+ * <p>This approach solves three critical problems that timestamp-based
checking cannot handle:
+ *
+ * <p><b>Problem 1: Future Timestamps from Clock Skew</b>
+ * <ul>
+ * <li>Machine A (clock ahead at 11:00 AM) builds and caches artifacts
+ * <li>Machine B (correct clock at 10:00 AM) restores cache
+ * <li>Restored files have timestamps from the future (11:00 AM)
+ * <li>User runs "git checkout" to different branch (sources timestamped
10:02 AM)
+ * <li>Maven incremental compiler sees: sources (10:02 AM) < classes
(11:00 AM)
Review Comment:
Fixed
--
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]