Skip to content

Fix Edit Metadata to always pre-populate latest metadata - #1039

Open
youseihuayu-wonderful wants to merge 9 commits into
IQSS:developfrom
youseihuayu-wonderful:fix/1024-edit-metadata-latest-version
Open

Fix Edit Metadata to always pre-populate latest metadata#1039
youseihuayu-wonderful wants to merge 9 commits into
IQSS:developfrom
youseihuayu-wonderful:fix/1024-edit-metadata-latest-version

Conversation

@youseihuayu-wonderful

Copy link
Copy Markdown
Contributor

Summary

  • Fixes Edit Metadata: should always pre-populate the latest metadata #1024: when opening Edit Metadata from an older dataset version, the SPA now pre-fills latest metadata (:latest — draft if present, otherwise latest published), matching JSF and EditDatasetTermsFactory.
  • Root cause: EditDatasetMetadataFactory used the browsed version query param (e.g. 1.0). It now ignores that param and always fetches DatasetNonNumericVersion.LATEST.
  • Adds component regression tests asserting getByPersistentId(..., ':latest', ...) and not "1.0".

Test plan

  • Local: npx cypress run --component --spec tests/component/sections/edit-dataset-metadata/EditDatasetMetadataFactory.spec.tsx2 passing
  • CI component tests
  • Manual: publish v1 without subtitle → publish v2 with subtitle → browse ?version=1.0 → Edit Metadata → subtitle shows v2 value
  • Manual: browsing ?version=1.0 without editing still shows historical v1 metadata

Notes

  • Browse-page version selection is unchanged.
  • Optional docs under docs/issues/ are included for review context; happy to drop them from the PR if preferred.

youseihuayu-wonderful and others added 3 commits July 31, 2026 12:22
Ignore the browsed version query param in EditDatasetMetadataFactory and
fetch :latest instead, matching Edit Terms and JSF. Add component
regression coverage and an issue playbook with verification steps.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document before/after fetch arguments, form outputs for the IQSS#1024
scenario, and the exact automated/manual checks that complete the fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep draft title/body on the branch for later publishing, and avoid
unbound-method lint errors in the Factory regression spec.

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Contributor Author

@ChengShi-1 @pdurbin
Could you please take a look at this PR when you have a chance? Thank you!

@pdurbin pdurbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The changes to EditDatasetMetadataFactory.tsx make sense to me but I didn't test them. I'm also not super familiar with the codebase so I'm clicking "comment" rather than "approve". I did leave a couple comments.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will this and the other files under "docs/issues" be removed before merging? 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, now I see you wrote this:

"Optional docs under docs/issues/ are included for review context; happy to drop them from the PR if preferred."

In my opinion, they are a bit noisy but let's see what others think! 😅

Comment on lines +21 to +23
// Always load the latest version (draft if exists, otherwise latest published).
// Ignore the browsed `version` query param so Edit Metadata matches JSF / Edit Terms
// (IQSS/dataverse-frontend#1024).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please copy this (or something similar) into CHANGELOG.md as well.

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Contributor Author

@pdurbin Done — added under [Unreleased] → ### Fixed in CHANGELOG.md (same substance as this comment, phrased to match the changelog style). See the latest commit on this PR.

@ChengShi-1
ChengShi-1 self-requested a review August 3, 2026 15:49
@ChengShi-1 ChengShi-1 self-assigned this Aug 3, 2026
@ChengShi-1 ChengShi-1 moved this to In Review 🔎 in IQSS Dataverse Project Aug 3, 2026

@ChengShi-1 ChengShi-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good overall. I tested locally and it was working well. Could you solve some comments here and remove extra docs?

const persistentId = searchParams.get('persistentId') ?? undefined
const searchParamVersion = searchParams.get('version') ?? undefined
const version = searchParamVersionToDomainVersion(searchParamVersion)
// Always load the latest version (draft if exists, otherwise latest published).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove comments here

).resolves(metadataBlocksInfoOnCreateMode)
})

it('always fetches :latest when the URL carries an older published version (issue #1024)', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you remove the issue number here (issue #1024) ?

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Contributor Author

@chengshi — I removed the comments and the issue number from the test title. please take a look!

@ChengShi-1

Copy link
Copy Markdown
Contributor

Hi @youseihuayu-wonderful , thanks. Also, could you drop docs/issue ?

@ChengShi-1 ChengShi-1 closed this Aug 3, 2026
@ChengShi-1 ChengShi-1 reopened this Aug 3, 2026
@ChengShi-1

Copy link
Copy Markdown
Contributor

I clicked a wrong button to close it but i didn't mean it :( sorry for this

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Contributor Author

@ChengShi-1 Dropped docs/issues from the PR.

@ChengShi-1 ChengShi-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me!

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Aug 3, 2026
@pdurbin

pdurbin commented Aug 4, 2026

Copy link
Copy Markdown
Member

I just clicked the "Approve workflows to run" button:

Screenshot 2026-08-04 at 3 14 12 PM

Update: And now there are failing checks:

Screenshot 2026-08-04 at 3 15 42 PM

@cmbz cmbz added FY27 Sprint 3 FY27 Sprint 3 (2026-07-29 - 2026-08-12) FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) labels Aug 12, 2026
@pdurbin

pdurbin commented Aug 19, 2026

Copy link
Copy Markdown
Member

@youseihuayu-wonderful can you please rebase or merge the latest from the "develop" branch to see if the failing Chromatic checks are skipped?

This is the change we made to skip them for forks:

@youseihuayu-wonderful

Copy link
Copy Markdown
Contributor Author

@youseihuayu-wonderful can you please rebase or merge the latest from the "develop" branch to see if the failing Chromatic checks are skipped?

This is the change we made to skip them for forks:

@pdurbin Done — I merged the latest develop, and both Chromatic jobs are now skipped. The other CI checks didn’t rerun. Should I close and reopen the PR to trigger them?

@pdurbin

pdurbin commented Aug 20, 2026

Copy link
Copy Markdown
Member

The other CI checks didn’t rerun.

Huh. Thanks for noticing that! They were skipped on this PR of your as well:

For reference, there should be checks called "test" etc. like this:

Screenshot 2026-08-20 at 2 22 20 PM

I took that screenshot from #1050 where you haven't yet pulled in my "skip Chromatic checks for forks" PR (#1043). I hope that PR of mine isn't causing the other checks to be skipped!

@pdurbin

pdurbin commented Aug 20, 2026

Copy link
Copy Markdown
Member

@youseihuayu-wonderful can you please rebase or merge develop into your branch. This is to pick up the following PR which @ChengShi-1 and I hope will allow the checks to run on forks:

@youseihuayu-wonderful

youseihuayu-wonderful commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

@youseihuayu-wonderful can you please rebase or merge develop into your branch. This is to pick up the following PR which @ChengShi-1 and I hope will allow the checks to run on forks:

@pdurbin I fix — and the #1055 triggered the fork checks successfully. All relevant checks passed, including Edit Dataset Metadata E2E (4/4). The overall E2E failure is the S3 issue tracked in #1053.

@ChengShi-1 ChengShi-1 added Size: 3 A percentage of a sprint. 2.1 hours. SPA labels Aug 21, 2026
@cmbz cmbz added the FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) label Aug 26, 2026
@cmbz cmbz added the FY27 Sprint 6 FY27 Sprint 6 (2026-09-09 - 2026-09-23) label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY27 Sprint 3 FY27 Sprint 3 (2026-07-29 - 2026-08-12) FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) FY27 Sprint 6 FY27 Sprint 6 (2026-09-09 - 2026-09-23) Size: 3 A percentage of a sprint. 2.1 hours. SPA

Projects

Status: Ready for QA ⏩

Development

Successfully merging this pull request may close these issues.

Edit Metadata: should always pre-populate the latest metadata

4 participants