Repository navigation
Conversation
84d77ae to
b6a409b
Compare
c0b643f to
2a79603
Compare
gnodet
left a comment
There was a problem hiding this comment.
Clean mechanical migration of 70+ debug statements to trace level. MavenSimpleConfiguration, CliUtils, and tests are all correctly updated to handle the new Level.TRACE enum value.
Missing TRACE handling in two logging backends:
The new TRACE enum value is correctly handled in MavenSimpleConfiguration (case TRACE -> "trace"), CliUtils (case TRACE, DEBUG ->), and the test, but two other setRootLoggerLevel implementations were not updated:
Log4j2Configuration.java(line 32-36):default -> "error"silently mapsTRACEto"error"— should addcase TRACE -> "trace"LogbackConfiguration.java(line 34-37):default -> ch.qos.logback.classic.Level.ERRORsilently mapsTRACEto ERROR — should addcase TRACE -> ch.qos.logback.classic.Level.TRACE
Both are live code — registered in META-INF/maven/slf4j-configuration.properties as runtime-selected implementations. While Level.TRACE is not yet wired to a CLI option (limiting immediate impact), the inconsistency should be fixed to prevent a silent bug when trace-level CLI support lands.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
gnodet
left a comment
There was a problem hiding this comment.
Clean mechanical migration of 70+ internal DEBUG statements to TRACE level. All switch expressions, guard conditions, and tests are correctly updated.
Non-blocking observations:
LifecycleDebugLogger.debug(String)now callslogger.trace(), making the method name misleading. However, the class is non-public API and renaming would expand the scope unnecessarily.- Several trace log calls use string concatenation instead of parameterized logging (pre-existing, not introduced by this PR).
- Pre-existing arithmetic bug in
DefaultModelBuilder.java:2722:afterSize - beforeSizeproduces a negative count for removed entries. Should bebeforeSize - afterSize. This PR only changed the log level.
LGTM — the migration is well-scoped: only internal plumbing is demoted to TRACE, while plugin-facing DEBUG output correctly remains at DEBUG.
This review was generated by an AI agent (Claude Code) and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
gnodet
left a comment
There was a problem hiding this comment.
Clean mechanical migration of 70+ internal DEBUG statements to TRACE level across 18 files. All switch expressions, guard conditions, and tests are correctly updated.
The migration scoping is well-reasoned: only internal framework plumbing (lifecycle engine, classrealm, cache internals, resolver, model builder, plugin resolution) is demoted to TRACE. Plugin-facing DEBUG output (parameter resolution, mojo configuration) correctly remains at DEBUG, preserving the signal that plugin developers need from -X.
Note: the two prior AI-generated reviews flagged Log4j2Configuration and LogbackConfiguration as missing TRACE handling — this is a false positive since both files were removed in an earlier PR in the chain and do not exist on the target branch feature/12643-structured-problems.
Looks good overall. ✅
This review was generated by an AI agent (Claude Code) and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
2a79603 to
6eff81f
Compare
b6a409b to
4b6969b
Compare
gnodet
left a comment
There was a problem hiding this comment.
Clean mechanical migration of 70+ internal DEBUG statements to TRACE across 18 files. The scoping is well-reasoned — only internal framework plumbing (lifecycle engine, classrealm, cache internals, resolver, model builder, plugin resolution) is demoted to TRACE, while plugin-facing DEBUG output (parameter resolution, mojo configuration) correctly remains at DEBUG.
The Slf4jConfiguration.Level enum update is correctly propagated to MavenSimpleConfiguration, and the CliUtils mapping functions correctly map TRACE to the same level as DEBUG for legacy APIs that lack a TRACE concept.
A few minor pre-existing observations (not introduced by this PR):
DefaultModelBuilder.javaline ~2722:afterSize - beforeSizeproduces a negative value when reporting "removed {} entries" — should bebeforeSize - afterSizeLifecycleDebugLogger: Several trace log calls use string concatenation instead of parameterized logging ("Project: " + ...vs"Project: {}", ...)- The
compat/maven-resolver-providerTypeDeriverstill hasdebug()calls for the same messages migrated totrace()in theimpl/version — acceptable since compat modules are legacy wrappers
LGTM — the rebase introduced no content changes and the migration is correct throughout.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
4b6969b to
3b439d0
Compare
6eff81f to
6c40a9e
Compare
3b439d0 to
5f53884
Compare
6c40a9e to
7a6b6ad
Compare
5f53884 to
a964976
Compare
7a6b6ad to
2d77564
Compare
a964976 to
33f16e8
Compare
2d77564 to
0d2db3b
Compare
33f16e8 to
0661b09
Compare
0d2db3b to
b282ea5
Compare
gnodet-bot
left a comment
There was a problem hiding this comment.
The logging migration itself (DEBUG → TRACE for 70+ statements) is clean and well-scoped. The Slf4jConfiguration.Level.TRACE enum addition, switch propagation in CliUtils/MavenSimpleConfiguration, and test updates are all correct.
However, the DefaultModelBuilder.java diff includes several non-logging functional changes that revert or weaken fixes that were already present on the base branch (feature/12643-structured-problems). These need to be addressed before merge.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
| // to prevent StackOverflowError from path representation mismatches (GH-12598). | ||
| Path normalizedPath = | ||
| sourcePath != null ? sourcePath.toAbsolutePath().normalize() : null; | ||
| Path normalizedPath = sourcePath != null ? sourcePath.normalize() : null; |
There was a problem hiding this comment.
sourcePath.normalize() without toAbsolutePath()
The base branch used sourcePath.toAbsolutePath().normalize() here to ensure a canonical, absolute path is stored in activeModelReads. The comment that was removed explicitly explained why:
Use
toAbsolutePath().normalize()for consistent path identity inactiveModelReads. This must match the normalization used ingetEnhancedProperties()guard check to prevent StackOverflowError from path representation mismatches (GH-12598).
With only .normalize(), a relative sourcePath (e.g. when modelSource.getPath() returns a relative Path) will be stored as-is. The guard in getEnhancedProperties at line 751 uses rootModelPath.normalize() — also without toAbsolutePath(). If the two paths represent the same file but one is absolute and one is relative, the contains() check returns false and the StackOverflow reappears on projects that triggered GH-12598.
| Path normalizedPath = sourcePath != null ? sourcePath.normalize() : null; | |
| Path normalizedPath = sourcePath != null ? sourcePath.toAbsolutePath().normalize() : null; |
| if (isParentWithinRootDirectory(rootModelPath, rootDirectory) | ||
| && !activeModelReads.contains( | ||
| rootModelPath.toAbsolutePath().normalize())) { | ||
| && !activeModelReads.contains(rootModelPath.normalize())) { |
There was a problem hiding this comment.
rootModelPath.normalize() without toAbsolutePath()
The base branch guard was rootModelPath.toAbsolutePath().normalize() to match the identity of entries put into activeModelReads by doReadFileModel. That comment was deleted here:
Use
toAbsolutePath().normalize()for the guard check to handle paths obtained via different representations (e.g., symlinks, relative segments).
The rootModelPath comes from modelProcessor.locateExistingPom(rootDirectory). If that returns a relative or symlinked path while the entry in activeModelReads is an absolute path (or vice versa), the cycle guard fires when it shouldn't, or misses when it should fire.
| && !activeModelReads.contains(rootModelPath.normalize())) { | |
| && !activeModelReads.contains(rootModelPath.toAbsolutePath().normalize())) { |
| return dominant; | ||
| return List.copyOf( | ||
| request.getRepositories() != null | ||
| ? request.getRepositories() |
There was a problem hiding this comment.
mergeRepositoriesById removed
The base branch's repos() method called mergeRepositoriesById() which merged duplicate repo entries (same ID, different snapshot/release policies) that mirror injection can produce. The Javadoc explained:
Without this merge, policy deduplication in the resolver can drop the snapshot policy, causing SNAPSHOT parent resolution to fail (MNG-12769).
This PR replaces repos() with a plain List.copyOf(...), silently reintroducing the MNG-12769 bug for projects that use mirrors with split release/snapshot policies.
The fix should be re-applied here, or moved to a layer below ModelBuilderSessionState if the intent is to clean up its scope.
Migrates ~70 DEBUG log statements to TRACE in internal plumbing code: lifecycle engine, classrealm, cache internals, resolver, plugin resolution. DEBUG (-X) remains the right level for plugin development. TRACE is for Maven core developers diagnosing framework internals, accessible via -Dmaven.logger.defaultLogLevel=trace. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
b282ea5 to
fdab681
Compare
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the DefaultModelBuilder.java issues (sourcePath normalization, rootModelPath normalization, mergeRepositoriesById) are all resolved: the PR has been rebased onto master and those changes have been removed from the diff entirely. ✅
The logging migration itself is clean and correctly applied across all 17 files. One issue remains before merge:
Missing case TRACE in LogbackConfiguration and Log4j2Configuration
MavenSimpleConfiguration was correctly updated with case TRACE -> "trace". But two sibling implementations were not:
LogbackConfiguration.java(line 34–37): usesdefault -> ch.qos.logback.classic.Level.ERROR, soLevel.TRACEmaps silently to ERRORLog4j2Configuration.java(line 32–35): usesdefault -> "error", same silent failure
Currently no code path sets context.loggerLevel = Level.TRACE in LookupInvoker, so this is latent. But the PR description explicitly advertises -Dmaven.logger.defaultLogLevel=trace support — when that path is wired, users on Logback/Log4j2 backends will get ERROR output instead of TRACE with zero diagnostic indication. Add explicit case TRACE arms to both.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
| * Level | ||
| */ | ||
| enum Level { | ||
| TRACE, |
There was a problem hiding this comment.
Adding TRACE here requires updating all Slf4jConfiguration implementations. MavenSimpleConfiguration is updated ✅ but LogbackConfiguration and Log4j2Configuration both use default -> ERROR — Level.TRACE will silently map to ERROR on those backends.
Summary
lifecycle engine, classrealm, cache internals, resolver, plugin resolution
TRACEtoSlf4jConfiguration.Levelenum so the logging system supports-Dmaven.logger.defaultLogLevel=traceas a system property for Maven core developersDEBUG(-X) remains the right level for plugin development;TRACEis forMaven core developers diagnosing framework internals
Motivation
Separate two audiences:
Without this migration, TRACE exists but nothing emits at it, making the distinction
theoretical. This PR populates it with the noisiest internal plumbing output that
dominates
-Xtoday and drowns out the signal plugin developers actually want.What stays at DEBUG
mvnupupgrade diagnosticsStatus
This PR is now independent — rebased onto
masterwith no dependency on thelogging PR stack. The original stacked version included unrelated
DefaultModelBuilderchanges from the base branch; those have been removed.
Files changed (17 files)
Slf4jConfiguration,MavenSimpleConfiguration,CliUtilsLifecycleDebugLogger,BuildPlanExecutor,MultiThreadedBuilderDefaultRequestCache,CacheConfigurationResolverDefaultClassRealmManagerDefaultArtifactDescriptorReader, relocation sources,TypeDeriverDefaultPluginVersionResolver,DefaultPluginPrefixResolverDefaultClassRealmManagerTest,LookupInvokerLoggingTestTest plan
DefaultClassRealmManagerTestpasses (mock expectations updated)LookupInvokerLoggingTestpasses (new TRACE enum value)Related
🤖 Generated with Claude Code