Skip to content

feat: record failure reasons in modernization metadata#1708

Open
ap44444 wants to merge 1 commit into
jenkins-infra:mainfrom
ap44444:feat/record-failure-reasons-clean
Open

feat: record failure reasons in modernization metadata#1708
ap44444 wants to merge 1 commit into
jenkins-infra:mainfrom
ap44444:feat/record-failure-reasons-clean

Conversation

@ap44444
Copy link
Copy Markdown
Contributor

@ap44444 ap44444 commented Apr 15, 2026

When a plugin migration fails, the tool writes "migrationStatus": "fail" to the modernization metadata JSON but provides no explanation. So 46% of all records in the metadata repository are failures with no descriptive information and maintainers cannot tell whether the failure was due to a precondition (e.g. parent POM 1.x, HTTP repositories) or runtime build error.

This PR adds a failureReasons field to ModernizationMetadata that takes the error messages at the time of failure. Precondition errors (e.g. "Found parent version starting with 1. in pom file preventing modernization") are recorded first, and then any runtime exception messages. This field is not there in JSON entirely when the migration succeeds, so existing successful records will not be affected.

Testing done

Two unit tests added to PluginModernizerTest:

  • testCollectModernizationMetadata_WithPreconditionErrors_ShouldRecordFailureReasons: this verifies that a precondition failure (PARENT_POM_1X) is captured in failureReasons and migrationStatus is "fail"
  • testCollectModernizationMetadata_WithRuntimeErrors_ShouldRecordFailureReasons: this verifies that a runtime build error message is captured in failureReasons

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@ap44444 ap44444 force-pushed the feat/record-failure-reasons-clean branch from 54c2b6c to adb1587 Compare April 15, 2026 22:30
@ap44444 ap44444 marked this pull request as ready for review April 15, 2026 22:56
@ap44444 ap44444 requested a review from jonesbusy as a code owner April 15, 2026 22:56
* Reasons why the migration failed, if any.
* Null when migration succeeded (omitted from JSON).
*/
private List<String> failureReasons;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure a list is enough. Each execution will clear result.

I'm wonder if we need a Map<String, String> instea (recipe/failure)

I need to think more about it

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.

Thank you, I think that would be helpful too, but I chose a list because the current codebase does not have error tracking for each recipe. The error models 'PreconditionError and PluginProcessingException' returns lists of errors for each plugin, but do not specify to which sub-recipe. A map may require changes to how the errors are tracked.

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