ugent-library / biblio-backoffice

Apache License 2.0
7 stars 0 forks source link

Cannot edit author for record #875

Closed mietcls closed 1 year ago

mietcls commented 1 year ago

Story

Cannot edit author in record 8722906, https://backoffice.biblio.ugent.be/publication/8722906 on people & affiliations tab https://backoffice.biblio.ugent.be/publication/8722906?redirect-url=%2Fpublication&show=contributors

Record: Author to be connected: https://telefoonboek.ugent.be/nl/people/801001101009

Steps to reproduce

  1. Go to record 8722906
  2. Go to the people & affiliations tab https://backoffice.biblio.ugent.be/publication/8722906?redirect-url=%2Fpublication&show=contributors
  3. Click edit. Image
netsensei commented 1 year ago

Quick update: the profile for that person doesn't exist in the Biblio frontend. I get a 404 not found.

This problem has popped up a few times now. I'm looking for ways to bubble errors so we can easily troubleshoot this (e.g. find it back in the logs, looking for ways to return something in the console.log) .

nics commented 1 year ago

@netsensei people without publications also give a 404, i'll show you how to inspect it in mongo

netsensei commented 1 year ago

There's two sides to solving this issue.

Data cleaning / transferring publications between people

This particular issue is caused by inconsistencies in the person data we receive and how we handle those inconsistencies in Biblio frontend. This person must have had a duplicate record in the past. During de-duplication, one of the duplicate records is removed. However the UUID of the record is still being referenced in older publication records. When someone tries to edit those contributors, our logic tries to fetch the non-existing record from Biblio Frontend triggering an error.

Solving this requires us to build a "transfer" script which will allow us to look for records referencing to person A and switching the ID to refer to a person B. This would allow us to "transfer" a record belonging person A to person B; and switch out contributors (editors, authors, supervisors) from A to B.

Transferring records between people already existed in Librecat as a separate script. We'll need this script if we want to maintain the same workflow we had when fixing these issues.

For this particular case: once we've got a working transfer script, we can solve the issue for this particular person.

Error logging / showing errors

Logging an error to the browser's console isn't the best way of dealing with errors because (a) it would require us to add brittle code to pass on errors (b) we may be pushing too much internal application information to the researcher.

The better way to do this is producing enough information in the application error logs and providing a unique error ID to the end-user which allows us to easily fetch the relevant error message from the logs. This is how it works:

  1. The end user performs an action like "edit contributor" and receives this error message instead of a non-reacting interface:

image

  1. The end user contacts the Biblio Team and passes on the mentioned error code: 01GKHDQWQ828D4GPQK1J1P6X8A

  2. The Biblio Team passes the error code to us, allowing us to quickly fetch the error from the logs:

Screenshot from 2022-12-05 16-39-39

For now, we'll have to manually trudge through log files on a server. But when we move to proper monitoring tools, having an error code will make investigating and pinpointing what went wrong very efficient.

mietcls commented 1 year ago

After consulting in DM, we established the long-term fix will take time, and we can give people a "way out" and information at least. The band-aid might not work for a lot of cases, but there's at least a chance.

We are aware not every error should become so "in-your-face" for our public, because everything will appear broken. This is temporarily the only solution.

Suggestion for the message: Scherm­afbeelding 2022-12-06 om 14 10 56

<div class="modal-backdrop show" style="position:absolute;z-index:0;"></div>
<div class="modal" tabindex="-1" role="dialog" style="display: block;">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-body">
          <div class="c-blank-slate c-blank-slate-info">
            <div class="bc-avatar">
              <i class="if if-service"></i>
            </div>
            <h4>Biblio could not complete the action.</h4>
            <p>
              Copy this code <code class="c-code">#######</code>
              <br>
              and send it to <a href="mailto:biblio@ugent.be">biblio@ugent.be</a>.
              <br>
              <br>
              The Biblio team will complete the action for you.
            </p>
          </div>
      </div>
      <div class="modal-footer">
        <button class="btn btn-link" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
nicolasfranck commented 1 year ago

"Biblio will complete the action for you" -> sounds like we will do their job ;-)

mietcls commented 1 year ago

Unfortunately right now, yes

mietcls commented 1 year ago

Can you assign this to me when it is "done" so I can communicate about it?

nics commented 1 year ago

fixed thanks @netsensei @miet deployed