Skip to content

fix: preserve file version snapshots during version creation#531

Merged
kpsherva merged 1 commit into
CERNDocumentServer:masterfrom
zubeydecivelek:fix-rdm-versioning
Jun 19, 2026
Merged

fix: preserve file version snapshots during version creation#531
kpsherva merged 1 commit into
CERNDocumentServer:masterfrom
zubeydecivelek:fix-rdm-versioning

Conversation

@zubeydecivelek

Copy link
Copy Markdown
Contributor

In _versions(), when we build cumulative file snapshots, we are assigning the same versioned_files dictionary to every version:

versions[version]["files"] = versioned_files

Because this dictionary keeps getting updated in the next loop iterations, the earlier versions were also reflecting the latest state.

For example, if we have:

  • draft.pdf v1
  • draft.pdf v2

we would expect:

  • record version 1 -> draft.pdf v1
  • record version 2 -> draft.pdf v2

But because all versions shared the same dictionary reference, we are getting:

  • record version 1 -> draft.pdf v2
  • record version 2 -> draft.pdf v2

So we are missing previous versions and always keeping the latest file version in the earlier snapshots too.

this one has easy fix:

versions[version]["files"] = deepcopy(versioned_files)

Second issue: we create the version bucket before checking whether the file should be skipped. For example, if Plot files have versions 3 and 4, but plots are skipped later, we still create record versions 3 and 4. Since no kept files change in those versions, they become duplicate versions.

For example:

  • main.pdf has 2 version
  • plot.png has 4 version

If plots are skipped, we probably only want:

  • record version 1 -> main.pdf v1
  • record version 2 -> main.pdf v2

But currently we can get:

  • record version 1 -> main.pdf v1
  • record version 2 -> main.pdf v2
  • record version 3 -> same as version 2
  • record version 4 -> same as version 2

@zubeydecivelek zubeydecivelek requested a review from kpsherva June 17, 2026 17:09
@zubeydecivelek zubeydecivelek moved this to In review 🔍 in Sprint Q2 2026 ☀️ Jun 18, 2026
@kpsherva kpsherva moved this from In review 🔍 to In progress in Sprint Q2 2026 ☀️ Jun 19, 2026
@zubeydecivelek

Copy link
Copy Markdown
Contributor Author

To see the difference here is the dummy PR with the test file only
zubeydecivelek#5

@kpsherva kpsherva moved this from In progress to In review 🔍 in Sprint Q2 2026 ☀️ Jun 19, 2026
@kpsherva kpsherva merged commit 43f0f03 into CERNDocumentServer:master Jun 19, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from In review 🔍 to To release 🤖 in Sprint Q2 2026 ☀️ Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants