fabric8-services / fabric8-wit

wit stands for Work Item Tracker
http://devdoc.almighty.io/
Apache License 2.0
45 stars 86 forks source link

Patch request for system.boardcolumn generates incorrect audit trails #2192

Open sahil143 opened 6 years ago

sahil143 commented 6 years ago

Expected behavior

  1. oldValue and newValue of boardcolumn audit should have name of column instead of id
  2. Should not generate Audit trail for assignes and label on system.boardcolumns patch

Actual behavior

  1. BoardColumn Audit has columnIds
  2. Extra logs are generated

    Steps to reproduce the problem

  3. Send a patch request to update boardcolumn ex: https://api.prod-preview.openshift.io/api/workitems/52a89cab-b23b-4b80-9cda-ed6a6de79d7b Payload:
    
    {"data":{"id":"52a89cab-b23b-4b80-9cda-ed6a6de79d7b","attributes":{"version":8},"links":{"self":"https://api.prod-preview.openshift.io/api/workitems/52a89cab-b23b-4b80-9cda-ed6a6de79d7b"},"relationships":{"system.boardcolumns":{"data":[{"id":"7389fa7d-39c8-4865-8094-eda9a7836161","type":"boardcolumns"}]}},"type":"workitems"}}

2. fetch the audit trail for that workItem
Audit log for above workitem: http://jsoneditoronline.org/?id=469723b429ce3b6abac3d009202ab530
Notice that assignee and labels audit log has no values and should not be genrated
jarifibrahim commented 6 years ago

Should not generate Audit trail for assignes and label on system.boardcolumns patch

I cannot reproduce it. I tried reproducing it via tests and via locally running fabric8-ui.

jarifibrahim commented 6 years ago

The issue is in the reorder API. The reorder API sets the field values of type list to [] (empty list) and the PATCH request removes these [] which generates the audit log.

DhritiShikhar commented 6 years ago

@jarifibrahim does the UX confirm that we do not want event log for reorder event?

jarifibrahim commented 6 years ago

@DhritiShikhar

@jarifibrahim does the UX confirm that we do not want event log for reorder event?

The issue is about how we deal the empty arrays. The reorder API adds [] to fields of kind list and the workitem update API removes this. This creates an event log that we do not need.