Skip to content

Conversation

@g-saracca
Copy link
Contributor

@g-saracca g-saracca commented Sep 26, 2025

What this PR does / why we need it:

Adds a mechanism to avoid two users updating same dataset version metadata and also same file metadata version.
Usese sourceLastUpdateTime query param for optimistic concurrency control. Depends on this js-dataverse PR.

Which issue(s) this PR closes:

Suggestions on how to test this:

Step 1: Run the Development Environment

  1. Execute npm i.
  2. Navigate with cd packages/design-system && npm i && npm run build.
  3. Return with cd ../../.
  4. Ensure you have a .env file similar to .env.example
  5. Navigate with cd dev-env.
  6. Start the environment using ./run-env.sh unstable.
  7. To verify the environment, visit http://localhost:8000/ and check your local Dataverse installation.

Step 2:

Test the concurrency control in edit dataset metadata page.

  1. Create a Dataset.
  2. Once in the Dataset Page, click Edit Dataset -> Metadata to open it in a new tab and then click it to open it in the same tab.
  3. In the same tab, edit something and save, should succeed.
  4. After that; in the new tab, edit something and save, should fail thanks to this control. Something like "Internal version timestamp [ISO date] is outdated.

Test the concurrency control in edit file metadata page.

  1. Upload a file to the recently created dataset.
  2. Open the edit file metadata page in two tabs.
  3. In the first tab, edit something and save, should succeed.
  4. After that; in the second tab, edit something and save, should fail also thanks to this control.

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

No.

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

Yes, added.

@coveralls
Copy link

coveralls commented Sep 26, 2025

Coverage Status

coverage: 97.223% (+0.02%) from 97.207%
when pulling 2bcbc00 on 841-change-internalVersionNumber-to-sourceLastUpdateTime-in-update-dataset-metadata
into cd0b794 on develop.

@g-saracca g-saracca marked this pull request as ready for review September 26, 2025 19:14
@g-saracca g-saracca changed the title 841 change internal version number to source last update time in update dataset metadata Use sourceLastUpdateTime in Update Dataset and File Metadata Sep 26, 2025
@g-saracca g-saracca moved this to Ready for Review ⏩ in IQSS Dataverse Project Sep 26, 2025
@g-saracca g-saracca added Size: 3 A percentage of a sprint. 2.1 hours. GREI Re-arch GREI re-architecture-related SPA: Edit Dataset Page SPA.Q3.8 Edit Files Metadata Page labels Sep 26, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements optimistic concurrency control for dataset and file metadata editing by replacing internal version numbers with last update timestamps. The changes prevent concurrent editing conflicts by using the sourceLastUpdateTime query parameter to ensure users are editing the most recent version of the metadata.

  • Replaces datasetInternalVersionNumber parameter with datasetLastUpdateTime across all dataset metadata forms
  • Updates file metadata editing to include datasetLastUpdateTime for concurrency control
  • Adds lastUpdateTime field to DatasetVersion model for tracking version timestamps

Reviewed Changes

Copilot reviewed 50 out of 52 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/dataset/domain/models/Dataset.ts Adds lastUpdateTime field to DatasetVersion model
src/sections/shared/form/DatasetMetadataForm/index.tsx Replaces datasetInternalVersionNumber prop with datasetLastUpdateTime
src/sections/edit-file-metadata/EditFilesList.tsx Adds datasetLastUpdateTime prop for file metadata concurrency control
src/files/domain/useCases/editFileMetadata.ts Updates to accept sourceLastUpdateTime parameter
tests/component/sections/shared/dataset-metadata-form/DatasetMetadataForm.spec.tsx Updates test cases to use datasetLastUpdateTime instead of internalVersionNumber

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ChengShi-1 ChengShi-1 self-assigned this Oct 6, 2025
@ChengShi-1 ChengShi-1 moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Oct 6, 2025
@ChengShi-1 ChengShi-1 added Original size: 3 FY26 Sprint 7 FY26 Sprint 7 (2025-09-24 - 2025-10-08) labels Oct 6, 2025
Copy link
Contributor

@ChengShi-1 ChengShi-1 left a comment

Choose a reason for hiding this comment

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

looks good

@github-project-automation github-project-automation bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Oct 6, 2025
@ChengShi-1 ChengShi-1 removed their assignment Oct 6, 2025
@ofahimIQSS ofahimIQSS self-assigned this Oct 8, 2025
@ofahimIQSS ofahimIQSS moved this from Ready for QA ⏩ to QA ✅ in IQSS Dataverse Project Oct 8, 2025
@ofahimIQSS
Copy link
Contributor

image

very nice - merging!

@ofahimIQSS ofahimIQSS merged commit fafbed3 into develop Oct 8, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from QA ✅ to Merged 🚀 in IQSS Dataverse Project Oct 8, 2025
@ofahimIQSS ofahimIQSS deleted the 841-change-internalVersionNumber-to-sourceLastUpdateTime-in-update-dataset-metadata branch October 8, 2025 16:17
@ofahimIQSS ofahimIQSS removed their assignment Oct 8, 2025
@ofahimIQSS ofahimIQSS restored the 841-change-internalVersionNumber-to-sourceLastUpdateTime-in-update-dataset-metadata branch October 8, 2025 16:28
@ofahimIQSS ofahimIQSS deleted the 841-change-internalVersionNumber-to-sourceLastUpdateTime-in-update-dataset-metadata branch October 8, 2025 16:30
@cmbz cmbz added the FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) label Oct 8, 2025
@scolapasta scolapasta moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 7 FY26 Sprint 7 (2025-09-24 - 2025-10-08) FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) GREI Re-arch GREI re-architecture-related Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA: Edit Dataset Page SPA.Q3.8 Edit Files Metadata Page

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

Change internalVersionNumber to sourceLastUpdateTime in Update Dataset Metadata

6 participants