Review main Merged

89938[BUGFIX] Preserve workspace history during publishing

Benni Mack CR +2 V +2 Normal +76 −26 updated 07/26/25, 18:50

Commit message

This change introduces ACTION_PUBLISH history type and
migrates workspace edit history to live records
during publishing to maintain complete
audit trails.

Previously, when publishing workspace records to live, all
intermediate edit history from the workspace was lost when the
workspace record was deleted. This created gaps in the audit trail.

Changes made:
- Add ACTION_PUBLISH constant to RecordHistoryStore
- Add publishRecord() method with complete old/new diff payload
- Add migrateWorkspaceHistory() to transfer workspace history to
  live record
- Update version_swap() to use new publish action instead of stage
  change
- Update RecordHistory to handle ACTION_PUBLISH display as 'publish'

The complete workspace editing history is now preserved on the live
record, providing full traceability of all changes made during
workspace editing.

ACTION_PUBLISH entries now display with a blue "published" badge in
the backend history module, providing clear visual distinction from
other action types.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
  • Verified V +2 Done
    • Benni Mack +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 1113

  1. Benni Mack uploaded patch set 1 06/27/25, 16:00

  2. core-ci voted on patch set 1 V +1 06/27/25, 16:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81080

  3. Benjamin Franzke commented on patch set 1 V -1 07/04/25, 09:48

    DataHandlerHook.php:446

    This does not work when publishing a single record via the `⇆` action button in the list of record (which is dispatched via `WorkspacesAjaxController::publishSingleRecord`). The history only shows "stage changed" instead of "published" then. Looks like `publishSingleRecord()` defines orig and versioned id in different order in constrast to `executeSelectionAction()`. `publishSingleRecord()` swaps the versioned id with the live id https://github.com/TYPO3/typo3/blob/06dc67941c3e9acf3046df86c18afd4e894fc900/typo3/sysext/workspaces/Classes/Controller/WorkspacesAjaxController.php#L152-L155 …while `executeSelectionAction()` swaps the live id with the versioned id. https://github.com/TYPO3/typo3/blob/06dc67941c3e9acf3046df86c18afd4e894fc900/typo3/sysext/workspaces/Classes/Controller/WorkspacesAjaxController.php#L204-L207 Which of these is the correct one?
  4. Benjamin Franzke commented on patch set 1 07/04/25, 09:53

    DataHandlerHook.php:446 Reply

    From a semantics perspective `publishSingleRecord()` feels more correct to me, because the action is dispatched on the versioned record and instructs apply this to the live id. …but there must be a reason why even publish and discard within `executeSelectionAction` use different semantics (which I do not know)…
  5. Benjamin Franzke commented on patch set 1 07/04/25, 10:07

    DataHandlerHook.php:446 Reply

    Forget my previous analysis, the issue is a different one: It works only for existing records, but not for newly added records, because that that means we do not get here, but bail out early and handle this case via `DataHandlerHook::publishNewRecord`.
  6. Benjamin Franzke commented on patch set 1 07/04/25, 10:25

    DataHandlerHook.php:446 Reply

    It is more complicated. * `⇆` is broken for existing (because of swapped t3ver_oid and uid) *and* new records. * `executeSelectionAction` works for existing records, but not for new records (because of DataHandlerHook::publishNewRecord) Also, if I'm not absolutely mistaken JS get's the naming wrong and submits t3ver_oid as a version id and the version-records uid as the live id, which is wrong: https://github.com/TYPO3/typo3/blob/191fc1d95143cc304ca4c0bd4299d4ebb8e42de5/Build/Sources/TypeScript/workspaces/backend.ts#L180-L181
  7. Benjamin Franzke commented on patch set 1 CR +1 V +1 07/04/25, 11:08

    DataHandlerHook.php:446 Reply

    I'm so sorry, now `⇆` is working for existing records, I don't know what went wrong If I was just dumb. The "problem" that "published" is not logged for new records persists, but I understand that that is less problematic, since new records already use the later-liveid and therefore history is preserved "automatically". I'm resolving here.
  8. Benni Mack uploaded patch set 2 CR +1 V +1 07/24/25, 16:11

  9. core-ci voted on patch set 2 V +1 07/24/25, 16:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82267

  10. Oli Bartsch voted on patch set 2 CR +1 V +1 07/25/25, 14:41

  11. Benjamin Franzke commented on patch set 2 CR +1 V +1 07/26/25, 10:38

    DataHandlerHook.php:446 Reply

    New record publishing works now, thanks!
  12. Benni Mack voted on patch set 2 CR +2 V +2 07/26/25, 18:50

  13. Benni Mack merged patch set 3 07/26/25, 18:50