Skip to content

MCR-3773 Fix XEditor validation failures sharing the same XPath#3054

Open
yagee-de wants to merge 1 commit into
2025.06.xfrom
issues/MCR-3773-x-editor-displays-only-one-message-per-xpath
Open

MCR-3773 Fix XEditor validation failures sharing the same XPath#3054
yagee-de wants to merge 1 commit into
2025.06.xfrom
issues/MCR-3773-x-editor-displays-only-one-message-per-xpath

Conversation

@yagee-de

@yagee-de yagee-de commented Jul 20, 2026

Copy link
Copy Markdown
Member

Link to jira.

Pull Request Checklist (Author)

Please go through the following checklist before assigning the PR for review:

Ticket & Documentation

  • The issue in the ticket is clearly described and the solution is documented.
  • Design decisions (if any) are explained.
  • The ticket references the correct source and target branches.
  • The fixed-version is correctly set in the ticket and matches the PR's target branch (main).

Feature & Improvement Specific Checks

  • Instructions on how to test or use the feature are included or linked (e.g. to documentation).
  • For UI changes: before & after screenshots are attached.
  • New features or migrations are documented.
  • Does this change affect existing applications, data, or configurations?
    • Yes: Is a migration required? If yes, describe it.
    • Breaking change is marked in the commit message.

Bugfix-Specific Checks

  • Affected version is listed in the ticket.
  • Minimal code changes were made (no refactoring).
  • This PR truly fixes only the reported bug.
  • No breaking changes are introduced.
  • A relevant test was added (if feasible).

Testing

  • I have tested the changes locally.
  • The feature behaves as described in the ticket.
  • Were existing tests modified?
    • Yes: explain the changes for reviewers.

MCR Conventions & Metadata

  • MCR naming conventions are followed
  • If the public API has changed:
    • Old API is deprecated or a migration is documented.
    • If not, no action needed.
  • Java license headers are added where necessary.
  • Javadoc is written for non-self-explanatory classes/methods (Clean Code).
  • All configuration options are documented in Javadoc and mycore.properties.
  • No default properties are hardcoded — all set via mycore.properties.

Multi-Repo Considerations

  • Is an equivalent PR in MIR required?
    • If yes, is it already created?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses XEditor validation result handling when multiple xed:validate declarations target the same absolute XPath, ensuring distinct failed rules can be reported in declaration/validation order while keeping the validation marker semantics stable.

Changes:

  • Reworked validation result storage to track failed rules by (absolute XPath, rule element identity) instead of just XPath.
  • Removed “skip if XPath already has error” short-circuiting from multiple validators so later rules can still be evaluated and recorded.
  • Added a focused JUnit 5 test suite covering distinct-rule reporting, continued evaluation after failure, and de-duplication for multiple validators originating from one rule element.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mycore-xeditor/src/test/java/org/mycore/frontend/xeditor/validation/MCRXEditorValidatorValidationResultsTest.java Adds regression tests validating ordering and distinct failure reporting for shared XPaths.
mycore-xeditor/src/main/java/org/mycore/frontend/xeditor/validation/MCRXPathTestValidator.java Removes early-exit on existing errors so later rules can still contribute failures.
mycore-xeditor/src/main/java/org/mycore/frontend/xeditor/validation/MCRXEditorValidator.java Documents and exposes failed-rule lookup and ordered failed-rules access.
mycore-xeditor/src/main/java/org/mycore/frontend/xeditor/validation/MCRValidator.java Removes early-exit on existing errors to allow multiple distinct rule failures per XPath.
mycore-xeditor/src/main/java/org/mycore/frontend/xeditor/validation/MCRValidationResults.java Implements new failed-rule tracking keyed by XPath + rule element identity; keeps marker behavior stable.
mycore-xeditor/src/main/java/org/mycore/frontend/xeditor/validation/MCRRequiredValidator.java Removes early-exit on existing errors for consistent evaluation behavior.
mycore-xeditor/src/main/java/org/mycore/frontend/xeditor/validation/MCRExternalValidator.java Removes early-exit on existing errors so distinct external validations can still be recorded.
mycore-xeditor/pom.xml Adds junit-jupiter-api test dependency needed for the new JUnit 5 tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 83 to 90
public MCRValidator getFailedRule(String xPath) {
return xPath2FailedRule.get(xPath);
for (Map.Entry<FailedRuleKey, MCRValidator> failedRule : failedRules.entrySet()) {
if (xPath.equals(failedRule.getKey().xPath())) {
return failedRule.getValue();
}
}
return null;
}
@yagee-de
yagee-de force-pushed the issues/MCR-3773-x-editor-displays-only-one-message-per-xpath branch from 5c45f2d to 22048d7 Compare July 21, 2026 11:28
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