Review 13.4 Merged

88326[TASK] Refactor DataHandler->moveRecord()

Christian Kuhn CR +2 V +2 Hard +136 −237 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
  • Verified V +2 Done
    • Christian Kuhn +2
    • core-ci +1 CI

Issues 2

Files 2

Review log 34

  1. Christian Kuhn uploaded patch set 1 02/23/25, 10:42

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

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

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