Skip to content

Structured BuilderProblem pipeline for DiagnosticCollector - #12702

Open
gnodet wants to merge 2 commits into
feature/warning-modefrom
feature/12643-structured-problems
Open

Structured BuilderProblem pipeline for DiagnosticCollector#12702
gnodet wants to merge 2 commits into
feature/warning-modefrom
feature/12643-structured-problems

Conversation

@gnodet

@gnodet gnodet commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the build report / warning mode chain. This PR implements the structured BuilderProblem pipeline for the 4 pathways identified in the foundation work, plus a full migration of the PluginValidationManager interface.

Commit 1: Pipe structured BuilderProblems into DiagnosticCollector (Pathways 1–4)

Pathway 2 — Plugin parameter validation (AbstractMavenPluginParametersValidator): 3 validators now create BuilderProblem with structured key, severity, and suggestion, and pipe through PluginValidationManagerDiagnosticCollector.

Pathway 3 — Plugin dependency validation (AbstractMavenPluginDependenciesValidator): 4 validators now create BuilderProblem with structured key and pipe through PluginValidationManagerDiagnosticCollector.

Pathway 4 — Plugin manager Contextualizable check (DefaultMavenPluginManager): creates BuilderProblem with key plugin-validation:contextualizable and pipes through PluginValidationManagerDiagnosticCollector.

Commit 2: Migrate PluginValidationManager to native BuilderProblem API

  • Changed PluginValidationManager interface: 3 abstract methods now accept BuilderProblem instead of String
  • Added @Deprecated(since = "4.1.0", forRemoval = true) String-based default methods as backward-compat adapters
  • Updated all 9 call sites across 8 files to create BuilderProblem natively

PR chain

# PR Feature
1 #12694 Logging foundation
2 #12695 Build report
3 #12697 Console modes
4 #12698 Warning mode + diagnostics
5 #12699 mvnlog viewer
6 This PR Structured problems pipeline
7 #12714 TRACE level migration

Test plan

  • mvn test -pl impl/maven-core — tests pass
  • CI

🤖 Generated with Claude Code

@gnodet
gnodet force-pushed the feature/warning-mode branch from 6124231 to dc3bccd Compare August 8, 2026 05:35
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 0e0c4e7 to 4463770 Compare August 8, 2026 05:35
@gnodet
gnodet force-pushed the feature/warning-mode branch from dc3bccd to a7c83db Compare August 8, 2026 12:14
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 4463770 to 8ef52fb Compare August 8, 2026 12:14
@gnodet
gnodet force-pushed the feature/warning-mode branch from a7c83db to 7243fd7 Compare August 8, 2026 19:17
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 8ef52fb to c5cdbba Compare August 8, 2026 19:17
@gnodet
gnodet force-pushed the feature/warning-mode branch from 7243fd7 to af945c2 Compare August 8, 2026 19:35
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from c5cdbba to b0d3de4 Compare August 8, 2026 19:35
@gnodet
gnodet force-pushed the feature/warning-mode branch from af945c2 to 850a04c Compare August 8, 2026 21:48
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch 2 times, most recently from dbf0ac6 to 84d77ae Compare August 8, 2026 21:57
gnodet added 2 commits August 9, 2026 10:10
- mvnlog / mvnlog --json CLI viewer for build-report JSON files
- BuildReportRenderer with ANSI colors, timing, failure details
- SimpleJsonReader dependency-free streaming JSON parser
- mvn --log routes to MavenLogCling, mvnlog shell scripts
- MavenITgh12571BuildReportTest: 8 ITs covering build report, console modes,
  warning mode, version info on failure, and mvnlog viewer
…nager migration

- Pipe structured BuilderProblems into DiagnosticCollector for pathways 2-4:
  plugin parameter validation, dependency validation, Contextualizable check
- Migrate PluginValidationManager interface to native BuilderProblem API
- Deprecated String-based methods with backward-compat adapters
- Updated all 9 call sites across 8 files
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 84d77ae to b6a409b Compare August 9, 2026 08:11
@gnodet
gnodet force-pushed the feature/warning-mode branch from 850a04c to 5913a2b Compare August 9, 2026 08:11
@gnodet
gnodet marked this pull request as ready for review August 9, 2026 08:11

@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.

Well-structured PR that cleanly pipes structured BuilderProblems into the DiagnosticCollector. Two observations after verification (a finding about source-incompatible API changes was a false positive — old String-based methods are preserved as deprecated defaults).

Also noted:

  • The mvnlog tool addition is complete with comprehensive unit and integration tests.
  • The EXCLUDED_LOGGERS set correctly prevents double-counting for classes that now pipe BuilderProblems directly.
  • The shell script changes correctly handle --log routing.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

*/
private static BuilderProblem toBuilderProblem(ModelProblem problem) {
BuilderProblem.Severity severity =
switch (problem.getSeverity()) {

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.

The diagnostic key is generated as "model:" + problem.getMessage().hashCode(). Using String.hashCode() for deduplication keys is fragile — hash collisions would cause unrelated problems to be silently deduplicated. The same pattern appears in DefaultProjectsSelector and the deprecated adapters in PluginValidationManager.

Elsewhere in this PR, human-readable keys are used (e.g. "plugin-validation:contextualizable", "plugin-validation:maven2-plugin"). Consider using a more collision-resistant approach here too — e.g., incorporating the problem source and a truncated/normalized message.

@@ -100,4 +112,26 @@ public List<MavenProject> selectProjects(List<File> files, MavenExecutionRequest

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.

This toBuilderProblem(ModelProblem) method is an exact duplicate of the one in DefaultMaven.java. If the conversion logic changes, both copies must be updated in lockstep. Consider extracting to a shared utility method.

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.

1 participant