Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug related to returnDatasetFieldTypes in Dataverses.listMetadataBlocks endpoint #10985

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

pdurbin
Copy link
Member

@pdurbin pdurbin commented Oct 30, 2024

What this PR does / why we need it:

We should be checking for inheritance of metadata blocks from parent collection to child collection.

Which issue(s) this PR closes:

Special notes for your reviewer:

@pdurbin started this pull request but @GPortas added the actual fix.

We were attempting to retrieve the metadata block fields for the requested dataverse without verifying whether isMetadataBlockRoot was set to true. See https://github.com/IQSS/dataverse/pull/10985/files#diff-171c256be8744ca0742a9570ed33a3e335eae0544d08be04545ef31fdd5328d1. Consequently, when accessing a dataverse that inherits from the root, we couldn't find a relationship with the desired metadata block, as that relationship with the block exists in the parent, not the child dataverse.

We have fixed this to always get the fields from the parent collection when isMetadataBlockRoot is false.

Suggestions on how to test this:

Make sure Jenkins reports all test passing.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

No.

Is there a release notes update needed for this change?:

No. In practice, this only affects the SPA, which is still in development.

Additional documentation:

None.

@pdurbin pdurbin requested a review from GPortas October 30, 2024 17:20
@coveralls
Copy link

coveralls commented Oct 30, 2024

Coverage Status

coverage: 21.185%. remained the same
when pulling f317ab0 on 10984-returnDatasetFieldTypes
into 64ac076 on develop.

Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:10984-returnDatasetFieldTypes
ghcr.io/gdcc/configbaker:10984-returnDatasetFieldTypes

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

@pdurbin
Copy link
Member Author

pdurbin commented Oct 30, 2024

As expected https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-10985/1/testReport/edu.harvard.iq.dataverse.api/DataversesIT/testListMetadataBlocks/ failed with this:

1 expectation failed.
JSON path data[0].fields.title.displayOnCreate doesn't match.
Expected: <true>
  Actual: null

This is because the "fields" object is empty:

{
    "status": "OK",
    "data": [
        {
            "id": 1,
            "name": "citation",
            "displayName": "Citation Metadata",
            "displayOnCreate": true,
            "fields": {
                
            }
        }
    ]
}

@pdurbin pdurbin changed the title add test for returnDatasetFieldTypes #10984 add test for returnDatasetFieldTypes and FIXME to code #10984 Oct 30, 2024
@pdurbin pdurbin marked this pull request as ready for review October 30, 2024 20:47
@pdurbin pdurbin added the Size: 0.5 A percentage of a sprint. 0.35 hours label Oct 30, 2024
@pdurbin pdurbin changed the title add test for returnDatasetFieldTypes and FIXME to code #10984 add test for returnDatasetFieldTypes and add FIXME to code Oct 30, 2024
@cmbz cmbz added the FY25 Sprint 9 FY25 Sprint 9 (2024-10-23 - 2024-11-06) label Oct 31, 2024
@GPortas GPortas added Size: 3 A percentage of a sprint. 2.1 hours. Original size: 3 SPA.Q4.10 Resolve TODOs and tech debt SPA These changes are required for the Dataverse SPA labels Oct 31, 2024
@GPortas GPortas changed the title add test for returnDatasetFieldTypes and add FIXME to code Fix wrong behavior for returnDatasetFieldTypes in Dataverses.listMetadataBlocks endpoint Oct 31, 2024
@GPortas GPortas changed the title Fix wrong behavior for returnDatasetFieldTypes in Dataverses.listMetadataBlocks endpoint Fix wrong bug related to returnDatasetFieldTypes in Dataverses.listMetadataBlocks endpoint Oct 31, 2024
@GPortas GPortas changed the title Fix wrong bug related to returnDatasetFieldTypes in Dataverses.listMetadataBlocks endpoint Fix bug related to returnDatasetFieldTypes in Dataverses.listMetadataBlocks endpoint Oct 31, 2024
@GPortas GPortas removed the Size: 0.5 A percentage of a sprint. 0.35 hours label Oct 31, 2024
@pdurbin pdurbin self-assigned this Oct 31, 2024
Copy link
Member Author

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I created this pull request (just adding a test and a FIXME), I can't approve it in GitHub but I would if I could!

I moved it to "ready for QA" at least.

@pdurbin pdurbin removed their assignment Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FY25 Sprint 9 FY25 Sprint 9 (2024-10-23 - 2024-11-06) Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA.Q4.10 Resolve TODOs and tech debt SPA These changes are required for the Dataverse SPA
Projects
Status: Ready for QA ⏩
Development

Successfully merging this pull request may close these issues.

returnDatasetFieldTypes=true not working on non-root collection inheriting "citation" from root
4 participants