Skip to content

Fix promotion of deleted relation returning invalid date time value error#27040

Merged
AlexGaillard merged 7 commits intomainfrom
cms-1463
Apr 10, 2026
Merged

Fix promotion of deleted relation returning invalid date time value error#27040
AlexGaillard merged 7 commits intomainfrom
cms-1463

Conversation

@gaetansenn
Copy link
Copy Markdown
Contributor

@gaetansenn gaetansenn commented Apr 3, 2026

Scope

What's changed:

  • splitRecursive now returns undefined instead of an empty array [] for defaultOverwrites when processing arrays of primitives
  • Removed redundant object.map() call that reprocessed array elements without using the result

Potential Risks / Drawbacks

  • None

Tested Scenarios

  • Reproduced "Invalid time value" error by promoting a version with a deleted O2M relation on a collection with date_updated field
  • Verified the promote succeeds after the fix

Review Notes / Questions

  • None

Checklist

  • Added or updated tests
  • Documentation PR created here or not required
  • OpenAPI package PR created here or not required

Fixes #26084

@gaetansenn gaetansenn requested a review from AlexGaillard as a code owner April 3, 2026 16:39
@gaetansenn gaetansenn changed the title fix: use nullish coalescing for overwriteDefaults in payload transfor… Fixe version promote failing with "Invalid time value" when related items with date fields are deleted Apr 3, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Apr 3, 2026

@gaetansenn gaetansenn changed the title Fixe version promote failing with "Invalid time value" when related items with date fields are deleted Fix version promote failing with "Invalid time value" when related items with date fields are deleted Apr 3, 2026
Copy link
Copy Markdown
Member

@ComfortablyCoding ComfortablyCoding left a comment

Choose a reason for hiding this comment

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

Please review previous attempts and context, the previous feedback in #26968 (review) still applies here.

@gaetansenn gaetansenn changed the title Fix version promote failing with "Invalid time value" when related items with date fields are deleted Return undefined defaultOverwrites for primitive arrays in splitRecursive "Invalid time value" when related items with date fields are deleted Apr 7, 2026
@gaetansenn gaetansenn changed the title Return undefined defaultOverwrites for primitive arrays in splitRecursive "Invalid time value" when related items with date fields are deleted Return undefined defaultOverwrites for primitive arrays in splitRecursive Apr 7, 2026
@gaetansenn
Copy link
Copy Markdown
Contributor Author

gaetansenn commented Apr 7, 2026

Please review previous attempts and context, the previous feedback in #26968 (review) still applies here.

Good catch, fixed the root cause in splitRecursive instead ! Thanks

Copy link
Copy Markdown
Member

@ComfortablyCoding ComfortablyCoding left a comment

Choose a reason for hiding this comment

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

I believe these changes are still a symptom of the problem?

After this change a delete operation retains no meta information and treats the promote as the time the action took place, unlike update which retains its update by/update at information irrespective of the promotion time. This is in addition to any other possible repercussions of this change.

Update retains meta

Screen.Recording.2026-04-07.at.3.02.13.PM.mov

Delete loses it and treats promote

Screen.Recording.2026-04-07.at.3.02.43.PM.mov

@gaetansenn
Copy link
Copy Markdown
Contributor Author

I believe these changes are still a symptom of the problem?

After this change a delete operation retains no meta information and treats the promote as the time the action took place, unlike update which retains its update by/update at information irrespective of the promotion time. This is in addition to any other possible repercussions of this change.

Update retains meta https://github.com/user-attachments/assets/88a36a5d-6e4a-41c9-964d-734d0c8f9b30

Delete loses it and treats promote https://github.com/user-attachments/assets/3b927079-5c04-4088-8249-a2351688cd06

I have updated splitRecursive to inherit the parent's _user/_date for primitive arrays, so delete operations now retain the correct meta from the version edit. What do you think ?

@ComfortablyCoding ComfortablyCoding changed the title Return undefined defaultOverwrites for primitive arrays in splitRecursive Fix promotion of deleted relation returning invalid date time value error Apr 10, 2026
Copy link
Copy Markdown
Member

@AlexGaillard AlexGaillard left a comment

Choose a reason for hiding this comment

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

Works! 🎉

@AlexGaillard AlexGaillard merged commit ba680bb into main Apr 10, 2026
96 of 98 checks passed
@AlexGaillard AlexGaillard deleted the cms-1463 branch April 10, 2026 19:43
@github-actions github-actions Bot added this to the Next Release milestone Apr 10, 2026
formfcw pushed a commit that referenced this pull request Apr 20, 2026
…rror (#27040)

* fix: use nullish coalescing for overwriteDefaults in payload transformers

* Revert "fix: use nullish coalescing for overwriteDefaults in payload transformers"

This reverts commit 79e1e86.

* fix: return undefined defaultOverwrites for primitive arrays in splitRecursive

* fix: propagate parent overwrite defaults to primitive arrays in splitRecursive

* Update moody-papers-help.md

---------

Co-authored-by: daedalus <44623501+ComfortablyCoding@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can’t promote version — Invalid time value

3 participants