MODAUD-310: Skip storing user audit events that contain only internal metadata changes#260
Open
slaemmer wants to merge 14 commits into
Open
MODAUD-310: Skip storing user audit events that contain only internal metadata changes#260slaemmer wants to merge 14 commits into
slaemmer wants to merge 14 commits into
Conversation
Two Dependabot commits each independently broke junit-platform-surefire-provider:1.3.2, an obsolete plugin dependency added in 2018 before Surefire 2.22.0 introduced native JUnit Platform support: - 5dae2de bumped maven-surefire-plugin 2.22.2 -> 3.5.5: Surefire 3.x changed plugin classloading, causing the old provider to produce 0 tests. - 0fbbb55 bumped junit-bom 5.12.0 -> 6.0.3 (JUnit 6): junit-platform-commons 6.x removed CollectionUtils.toUnmodifiableList(), which the old provider calls at startup, causing NoSuchMethodError. The junit-platform-runner module was also removed in JUnit 6.0.0. Reverting either bump alone does not restore test execution - both independently break the old provider for different reasons. Fix: remove junit-platform-surefire-provider and the now-redundant junit-jupiter-engine and junit-vintage-engine from the Surefire plugin dependencies in root pom.xml. Surefire 2.22+ discovers engines automatically from the project test classpath. Also remove the unused junit-platform-runner test dependency (deprecated since JUnit Platform 1.8, removed in 6.0.0, and has no usages in this codebase) and the stale TODO comment referencing FOLIO-1609/SUREFIRE-1588.
The shouldDetectProfilePictureLinkChange test was silently not running due to the broken Surefire configuration. Now that tests run again, it fails because FieldChangeDto stores URI values as Object, so equals() comparison against a String literal fails despite identical toString() output. Assert individual fields using toString() instead.
… metadata changes
Two Dependabot commits each independently broke junit-platform-surefire-provider:1.3.2, an obsolete plugin dependency added in 2018 before Surefire 2.22.0 introduced native JUnit Platform support: - 5dae2de bumped maven-surefire-plugin 2.22.2 -> 3.5.5: Surefire 3.x changed plugin classloading, causing the old provider to produce 0 tests silently. - 0fbbb55 bumped junit-bom 5.12.0 -> 6.0.3 (JUnit 6): junit-platform-commons 6.x removed CollectionUtils.toUnmodifiableList(), which the old provider calls at startup, causing NoSuchMethodError. Reverting either bump alone does not restore test execution. Fix: remove junit-platform-surefire-provider and the now-redundant junit-jupiter-engine and junit-vintage-engine from the Surefire plugin dependencies in root pom.xml. Surefire 2.22+ discovers engines automatically from the project test classpath. Also remove the unused junit-platform-runner test dependency and the stale TODO referencing FOLIO-1609/SUREFIRE-1588, and remove useSystemClassLoader=false which the TODO indicated should be dropped when upgrading to Surefire 3.x.
…nd InventoryEntitiesToAuditCollectionMapperTest
…ly update records
|
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.



MODAUD-310
Purpose
GET /audit/users/{id}returns atotalRecordscount that includes UPDATED eventswhose entire diff consists of internal system-managed metadata fields
(
metadata.createdDate,metadata.updatedDate,metadata.createdByUserId,metadata.updatedByUserId). These carry no user-visible change but are updatedautomatically by FOLIO on every save. The ui-users version history pane already filters
them out client-side, causing two problems:
totalRecordsis inflated: the displayed count is higher than the number of visible entrieslimitevents per page but visible entriesare fewer, requiring extra "Load more" clicks to find real changes
Approach
Three layers of change:
1. Service-layer guard (new events)
Extend the existing
isUpdateWithNoDiffcheck inUserEventServiceImplwith a newisUpdateWithOnlyMetadataChangespredicate. Incoming UPDATED events whose diff containsonly paths listed in
UserAuditConstants.INTERNAL_METADATA_FIELD_PATHSare silentlydiscarded before reaching the database. Events with at least one non-metadata field or
collection change are stored normally. Metadata fields are preserved in the diff of stored
events for context. CREATED and DELETED events are unaffected.
2. Retroactive cleanup (existing records)
Replace
deleteEmptyUpdateRecordswith the broaderdeleteMetadataOnlyUpdateRecords,which deletes UPDATED records whose diff contains only internal metadata paths (including
null-diff records as a subset). This is chained into
UserFieldExclusionHandlerso thatchanging the excluded-fields setting cleans up both newly metadata-only records and any
pre-existing ones in a single pass.
3. Upgrade migration
A new
cleanup_metadata_only_update_records.ftlmigration runs once on upgrade tomod-audit-3.1.0, deleting all pre-existing metadata-only and null-diff UPDATED recordsfrom the database before the new module version starts processing events.
Pre-Merge Checklist:
Before merging this PR, please go through the following list and take appropriate actions.