Entity validation does not always prevent concurrent editing of pending revisions

Created on 4 July 2017, over 7 years ago
Updated 7 December 2023, 11 months ago

Problem/Motivation

Normal workflow in HEAD without pending revisions:

  1. Create a page
  2. Open the edit page
  3. Open another edit page in another tab to simulate a concurrent edit
  4. Change the title and save a new revision
  5. Now in the other tab without refreshing the page change the title again and save a new revision
  6. Verify a validation error is displayed

Steps to reproduce with Content Moderation in HEAD:

  1. Enable the Content Moderation module
  2. Enable the Editorial workflow for articles
  3. Create an article and save it as draft
  4. Open the edit page
  5. Open another edit page in another tab to simulate a concurrent edit
  6. Change the title and save a draft
  7. Now in the other tab without refreshing the page change the title again and save as draft
  8. Verify a validation error is displayed
  9. Create another article and save it as published
  10. Open the edit page
  11. Open another edit page in another tab to simulate a concurrent edit
  12. Change the title and save a draft
  13. Now in the other tab without refreshing the page change the title again and save as draft

Expected result: a validation error is displayed.
Actual result: the second draft "overrides" the first one, although both revisions are correctly stored, so there is no actual data loss.

Proposed resolution

Keep track of the entity revision at the moment the form is built and verify the latest revision matches it when saving the entity via a dedicated constraint validator.

The ultimate goal for this issue is to bring consistency in the entity validation logic when it comes to pending revisions. This solution assumes sequential creation is the default intended behavior for pending revisions, at least for Content Moderation.

Remaining tasks

  • Validate the proposed solution
  • Reviews

User interface changes

None

API changes

Only additions

Data model changes

None

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Entity  →

Last updated about 22 hours ago

Created by

🇬🇧United Kingdom timmillwood 🏴󠁧󠁢󠁷󠁬󠁳󠁿 Wales, UK

Live updates comments and jobs are added and updated live.
  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024