metacatui icon indicating copy to clipboard operation
metacatui copied to clipboard

infinite update loop for a dataset with two metadata files

Open jeanetteclark opened this issue 1 year ago • 2 comments

Describe the bug

Found this strange edge case where metacatUI will get stuck in an infinite loop updating metadata documents when there is more than one metadata file in a package.

To Reproduce Steps to reproduce the behavior:

  1. Create a new dataset using metacatUI
  2. Run the following R script
library(dataone)
library(datapack)

d1c <- D1Client("STAGING", "urn:node:mnTestKNB")
resource_map_pid <- "{YOUR RM PID HERE}"

pkg <- dataone::getDataPackage(d1c, resource_map_pid)
emlFile <- system.file("extdata/strix-pacific-northwest.xml", package="dataone")
# add an additional metadata file
metadataObj <- new("DataObject", format="eml://ecoinformatics.org/eml-2.1.1", filename=emlFile)
# add a data file
sourceData <- system.file("extdata/OwlNightj.csv", package="dataone")
sourceObj <- new("DataObject", format="text/csv", filename=sourceData)
pkg <- addMember(pkg, sourceObj, metadataObj)
# Upload changes (new files) to package
uploadDataPackage(d1c, pkg, public = TRUE, accessRules=pkg@sysmeta@accessPolicy, quiet = FALSE)

  1. Go back to MetacatUI. In the dataset listing you'll see two recent datasets, the one you created on the web form and the Strix. Both of thse are associated with the same package. Click on the Strix dataset and edit it:
Screen Shot 2024-07-25 at 5 13 06 PM Screen Shot 2024-07-25 at 5 13 17 PM
  1. Make a minor edit to the title of the strix dataset
  2. Observe metacatUI switch back and forth updating the metadata documents, and look at the version chain for the non-Strix metadata.
Screen Shot 2024-07-25 at 5 14 48 PM

Expected behavior

...not this. I'm not sure what the expected behavior is here since the R code really had a bug in it (it should have replaced the metadata record and not added a new one). But I think theoretically multiple metadata documents is supported in the packaging model.

jeanetteclark avatar Jul 26 '24 00:07 jeanetteclark