Audit trail generates unnecessary logs when changing a subset of the values in a metadata field with multiple values
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- angular, typescript
- Domain
- full-stack
Research direction
The bug is that a submission PATCH with op add on /sections/publicationStep/dc.contributor.author resends the full value list, so the back end removes and re-adds every value and writes a REMOVE/ADD audit pair for each. Start by tracing how the Angular submission form builds that PATCH, then the back-end handler that applies it. Before coding, confirm with maintainers whether the fix belongs in the front end (send only replace for changed values) or in the back-end audit logic (skip unchanged values). Done means only changed values produce audit records.
Written by the indexing model from the issue text.
Description
Describe the bug
While investigating the issue https://github.com/DSpace/DSpace/issues/12686 on the backend, I discovered that unnecessary logs are being created when a single value (or a subset of values) of a metadata with multiple values is modified.
For example, for an item with N authors (dc.contributor.author), if only one value is modified, there will be 2 * N_ audit records of type MODIFY_METADATA, one with the action ADD and another REMOVE for each value (even though only one was modified).
This happens because the front-end sends a PATCH with the body ["op": "add", "path": "/sections/publicationStep/dc.contributor.author", "value": [...]] where the complete list of values is sent again.
This causes the back-end to remove all metadata values and add them again, instead of just applying the modifications.
I'm not sure, however, whether this should be handled here on the front-end (sending a single 'replace' for the modified values) or perhaps on the back-end itself (checking if there was an actual change in the metadata value before creating the audit log).
To Reproduce
Steps to reproduce the behavior:
- Access an item with more than one value for a given metadata field.
- Change a single value from that group of metadata fields, or a subset of the values, and save the changes.
- Access the audit tab. There will be a pair of logs (ADD and REMOVE) for each value, including the values that remained the same.
Example:
Tested on this item, changing the name of the first author.
Those two opened logs below are the actual change, the other four are pairs of ADD and REMOVE for each one of the other values (not changed).
Expected behavior
Only metadata values that have actually been modified should generate a pair of audit logs (REMOVE + ADD).
- Dominant language
- TypeScript
- Stars
- 180
- Forks
- 577
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 95
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DSpace/dspace-angular
-
accessibility affects: 10.x affects: main bug ux
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DSpace/dspace-angular#6531 · 1 comment ·
Maintainers usually reply within 1 day
-
accessibility affects: 10.x affects: main bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
DSpace/dspace-angular#6530 ·
Maintainers usually reply within 1 day
-
Submission Form Allows Deletion of All Repeating Item EntriesPossibly taken @Rowan-McKereghan claimed this 5 days ago. Openaffects: 8.x affects: 9.x bug component: submission
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DSpace/dspace-angular#6511 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Visual issues with qualdrop fieldsPossibly taken @DanGastardelli claimed this 15 days ago. Openaffects: 10.x affects: 9.x bug claimed: Acervos Digitais component: submission Difficulty: Low ux
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
DSpace/dspace-angular#6412 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Facet headings have incorrect clickable area to expand/collapsePossibly taken @jesielviana claimed this 12 days ago. Openaccessibility affects: 10.x affects: 8.x affects: 9.x bug ux
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DSpace/dspace-angular#6364 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in DSpace/dspace-angular
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
steelbrain/node-ssh#487 ·
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundariesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 62/100
lingdojo/kana-dojo#34127 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
osmlab/name-suggestion-index#13104 ·
Maintainers usually reply within 1 day