Review main Merged

88316[TASK] Refactor DataHandler->moveRecord()

Christian Kuhn CR +2 V +2 Hard +136 −239 updated 02/23/25, 10:52

Commit message

With the workspace DataHandler hook code being inlined to
moveRecord(), the code can be streamlined and moved around.
Goal is to reach a far more easy to understand code flow
and to optimize calls. The main barrier established with this
patch is the main sub method moveRecord_raw(). Its signature
and handling is kept as is. Handing over "sane" state from
moveRecord() to moveRecord_raw() will be another change.

This patch is the result of a series of logically following
changes. It is not trivial to proof correctness of the final patch
result in comparison to current state by reading the change. To
understand details, a look at the differences between single patch
set version can be helpful.

Patch risk assessment: We have pretty good functional test coverage
in this area. Everything that is actively tested leads to the same
DB state with the patch. About 90% of coding issues during this
refactoring did lead to test failures, with the remaining 10% being
edge cases that can be played through locally. I'd thus consider the
risk to break something with this patch when not in workspaces as
relatively low. The risk to break something with this patch when
in workspaces is moderate or low.

Overview:

* Split the worker part of moveRecord() to three distinct sections:
  "moving in live", "moving a not-workspace-aware table record in
  workspaces" (this scenario is so full of systematic issues that we
  will most likely have to prevent it in TCA later), and "moving a
  workspace aware table record in workspaces". This allows getting
  rid of all the nasty variables like $recIsNewVersion and
  $recordMustNotBeVersionized. This makes the entire method
  significantly better readable.

* Fix a crash in "moving a not-workspace-aware table record in
  workspaces" scenario. This is a drive-by since that scenario is
  broken overall.

* Safe quite a few DB calls by not getting and checking the record
  in question over and over again, especially in workspace.

* Inline moveRecord_moveVersionedRecord() to "moving a workspace aware
  table in workspaces" and streamline it to the reduced scope.

* It turns out two workspace related methods moveRecord_processFields()
  and moveRecord_processFieldValue() are nonsense and can be removed.

* Streamline versionizeRecord() slightly and add a couple of return
  types in other methods. The method visibility changes will not be
  backported.

* Always feed workspaceCannotEditOfflineVersion() with the full
  record to suppress yet another DB call. The signature of that
  method should be adapted in v14 with another patch.

* Add a series of `@todo` comments pointing out potentially broken
  scenarios and fishy overall handling.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Anja Leichsenring +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Anja Leichsenring +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 2443

Show 918 earlier messages
  1. Christian Kuhn uploaded patch set 1 02/21/25, 16:09

  2. core-ci voted on patch set 1 V -1 02/21/25, 16:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74524

  3. Christian Kuhn uploaded patch set 2 V -1 02/21/25, 16:20

  4. core-ci voted on patch set 2 V +1 02/21/25, 16:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74525

  5. Christian Kuhn uploaded patch set 3 V +1 02/21/25, 16:34

  6. core-ci voted on patch set 3 V +1 02/21/25, 16:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74526

  7. Christian Kuhn uploaded patch set 4 V +1 02/21/25, 16:53

  8. core-ci voted on patch set 4 V +1 02/21/25, 17:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74528

  9. Christian Kuhn uploaded patch set 5 V +1 02/21/25, 17:05

  10. core-ci voted on patch set 5 V +1 02/21/25, 17:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74529

  11. Christian Kuhn uploaded patch set 6 V +1 02/21/25, 17:28

  12. core-ci voted on patch set 6 V +1 02/21/25, 17:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74530

  13. Christian Kuhn uploaded patch set 7 V +1 02/21/25, 20:14

  14. core-ci voted on patch set 7 V +1 02/21/25, 20:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74542

  15. Christian Kuhn uploaded patch set 8 V +1 02/21/25, 20:36

  16. core-ci voted on patch set 8 V +1 02/21/25, 20:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74545

  17. Christian Kuhn uploaded patch set 9 V +1 02/22/25, 09:31

  18. core-ci voted on patch set 9 V +1 02/22/25, 09:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74562

  1. Christian Kuhn uploaded patch set 10 V +1 02/22/25, 12:17

  2. core-ci voted on patch set 10 V +1 02/22/25, 12:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74563

  3. Christian Kuhn uploaded patch set 11 V +1 02/22/25, 13:08

  4. core-ci voted on patch set 11 V +1 02/22/25, 13:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74564

  5. Christian Kuhn uploaded patch set 12 V +1 02/22/25, 14:01

  6. core-ci voted on patch set 12 V +1 02/22/25, 14:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74565

  7. Christian Kuhn uploaded patch set 13 V +1 02/22/25, 15:05

  8. core-ci voted on patch set 13 V +1 02/22/25, 15:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74566

  9. Christian Kuhn uploaded patch set 14 V +1 02/22/25, 15:12

  10. core-ci voted on patch set 14 V +1 02/22/25, 15:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74567

  11. Christian Kuhn updated the commit message in patch set 15 V +1 02/22/25, 15:34

  12. core-ci voted on patch set 15 V +1 02/22/25, 15:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74568

  13. Christian Kuhn updated the commit message in patch set 16 V +1 02/22/25, 15:50

  14. core-ci voted on patch set 16 V +1 02/22/25, 15:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74569

  15. Christian Kuhn uploaded patch set 17 V +1 02/22/25, 16:05

  16. Christian Kuhn updated the commit message in patch set 18 02/22/25, 16:10

  17. core-ci voted on patch set 17 V -1 02/22/25, 16:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74570

  18. core-ci voted on patch set 18 V -1 02/22/25, 16:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74571

  19. Christian Kuhn uploaded patch set 19 V -1 02/22/25, 16:26

  20. core-ci voted on patch set 19 V +1 02/22/25, 16:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74572

  21. Anja Leichsenring voted on patch set 19 CR +1 V +1 02/22/25, 18:08

  22. Stefan Bürk voted on patch set 19 CR +1 02/22/25, 19:20

  23. Stefan Bürk voted on patch set 19 V +1 02/22/25, 20:07

  24. Christian Kuhn voted on patch set 19 CR +2 V +2 02/23/25, 10:52

  25. Christian Kuhn merged patch set 20 02/23/25, 10:52