[MODEUS-220] Use order-insensitive comparison for R5.0 pipe-delimited report attribute values#212
Merged
Conversation
R5.0 report validation rejected valid reports when providers returned pipe-delimited attribute values in a different order than expected.
102d4a8 to
90f4057
Compare
|
slaemmer
approved these changes
Feb 26, 2026
alb3rtino
added a commit
to folio-org/mod-erm-usage-counter
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/MODEUS-220
Purpose
R5.0 COUNTER reports include pipe-delimited attribute values such as
Data_Type|Section_Type|YOP|Access_Type|Access_Method. The previous validation logic compared these values as plain strings, which caused valid reports to be rejected when a provider returned the same attributes in a different order within the pipe-delimited string.Approach
HashSet.containsAll()check into dedicatedallAttributesMatchandattributesMatchmethods inProcessorHelper.Attributes_To_Showvalues, the comparison now splits on|and compares the resulting elements as sets, making the check order-independent.