[MODEUSCNT-69] Use order-insensitive comparison for R5.1 report attribute arrays#103
Merged
Conversation
030afbd to
a35c6bf
Compare
a35c6bf to
8e37722
Compare
8e37722 to
a1168dd
Compare
|
slaemmer
approved these changes
Feb 26, 2026
alb3rtino
added a commit
that referenced
this pull request
Mar 11, 2026
…ic (#105) https://folio-org.atlassian.net/browse/MODEUSCNT-70 ## Purpose The report merging logic in both COUNTER 5.0 and 5.1 modules performs order-sensitive comparisons on report header attributes. This causes merge failures when attribute arrays or pipe-delimited values appear in different orders across reports that are otherwise equivalent. The validation code paths were already fixed in #103 and [mod-erm-usage#212](folio-org/mod-erm-usage#212), but the merging code paths were not covered. ## Approach - COUNTER 5.1 `ReportMerger`: Apply `ReportValidator.normalize()` to report headers before the distinctness check during merge validation. Made `normalize()` package-private and added recursion into nested objects so it handles the full header structure. - COUNTER 5.0 `ReportsMerger`: Replace `distinct()` with a `distinctByNormalized()` predicate that normalizes pipe-delimited values (split, sort, rejoin) before deduplication, applied to both report attributes and report filters. - Added tests in both modules covering merge scenarios with reordered attributes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



https://folio-org.atlassian.net/browse/MODEUSCNT-69
Purpose
The
ReportValidator.validateReportHeaderReportAttributes()method uses an order-sensitive comparison (equals) when checking report attributes against expected values. This causes valid reports to be rejected when a provider returns theAttributes_To_Showarray elements in a different order than what is defined inReportProperties. For example, a TR report expecting["YOP", "Access_Type", "Access_Method"]would fail validation if a provider returns["Access_Method", "YOP", "Access_Type"], even though the content is identical.Approach
equalscomparison with a newreportAttributesMatchmethod that compares object fields individually, using set-based comparison for array values viaarrayEqualsIgnoreOrderAttributes_To_Showarray order and verifies validation still passes