Review main Merged Breaking

90549[!!!][TASK] Remove circular dependency between ProcessedFile and Task

Benni Mack CR +2 V +2 Hard +202 −79 updated 09/19/25, 08:58

Commit message

ProcessedFile previously had a circular dependency with Task classes:
- ProcessedFile->getTask() created Task objects
- Task constructors required ProcessedFile objects

This refactoring eliminates the circular dependency by:
- Moving checksum calculation logic outside ProcessedFile
- Removing getTask() method from ProcessedFile
- Having FileProcessingService create Task objects when needed
  via TaskTypeRegistry
- ProcessedFile now only holds taskType and configuration,
  not Task objects

Breaking changes:
- ProcessedFile->getTask() method removed
- ProcessedFile->generateProcessedFileNameWithoutExtension() removed
- ProcessedFileRepository->add() now requires TaskInterface parameter
- ProcessedFileRepository->update() now requires TaskInterface parameter
- Task objects should now be created externally via TaskTypeRegistry

These changes may affect extensions that directly interact with
ProcessedFile task methods or manually call ProcessedFileRepository
methods.

As a drive-by change, comments are added to the extension scanner
MethodMatchers to state that listed method calls are not matched
on their object instance.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • Stefan Froemken +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • Stefan Froemken +1
    • core-ci +1 CI

Issues 1

Files 13

Review log 3747

Show 1722 earlier messages
  1. Benni Mack uploaded patch set 1 09/02/25, 18:50

  2. core-ci voted on patch set 1 V -1 09/02/25, 19:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84276

  3. Benni Mack uploaded patch set 2 V -1 09/02/25, 19:56

  4. core-ci voted on patch set 2 V +1 09/02/25, 20:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84277

  5. C. Gogolin commented on patch set 2 CR +1 V +1 09/03/25, 04:50

    I think the separation of ProcessedFile and Task is very good.
  6. Stefan Froemken commented on patch set 2 CR -1 09/05/25, 10:40

    $processedFile->isProcessed() will be called from AbstractTask, FileProcessingService, ImageProcessingService and ContentObjectRenderer. Only for AbstractTask the earlier Checksum check was kept. For all other classes the checksum check is gone. I will remove my -1, if you can explain me why that will not be a problem.

    AbstractTask.php:149

    If this is called the checksum check will not be validated anymore

    AbstractTask.php:157

    Comment is only valid on checksum missmatch. I prefer something like: "File needs processing on checksum mismatch"

    AbstractTask.php:159

    What about just: return $checksum && $this->getConfigurationChecksum() !== $checksum;

    LocalCropScaleMaskHelper.php:180

    This is OK for me as all core classes implementing from TaskInterface are also extending AbstractTask.

    FileProcessingService.php:70

    Awesome. Everything is already here to create a new task. Bye bye ->getTask().
  7. Garvin Hicking commented on patch set 2 09/05/25, 11:27

    more specifically, ProcessedFileRepository?

    ProcessedFileRepository.php:300

    This disables XClassing, right? Not that I would suggest doing xclassing with a processedFile, but we might want to mention this specifically in an RST?
  8. Stefan Froemken commented on patch set 2 09/05/25, 12:15

    ProcessedFileRepository.php:300 Reply

    I saw that, too, but we instantiate ProcessedFile with new three times in whole core.
  9. Garvin Hicking commented on patch set 2 09/05/25, 13:01

    ProcessedFileRepository.php:300 Reply

    This is done only in tests and not actual core code yet. So for now you could use XCLass with it, I believe.
  10. Garvin Hicking commented on patch set 2 09/05/25, 14:17

    AbstractTask.php:157 Reply

    IMO we could even remove the whole comment here; the "if" here is declarative enough that it checks checksum (mis)match?!

    AbstractTask.php:159 Reply

    Personally I find it easier to read that "false" is the default method's return. That way I don't need to "grok" an expression to easily recognize it.

    LocalCropScaleMaskHelper.php:180 Reply

    Agreed.
  11. Benni Mack uploaded patch set 3 CR +1 V +1 09/08/25, 09:11

  12. core-ci voted on patch set 3 V +1 09/08/25, 09:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84611

  13. Markus Klein commented on patch set 3 09/08/25, 10:05

    ProcessedFileRepository.php:300 Reply

    Then you need to xclass this file here instead to replace the create-method.
  14. Markus Klein commented on patch set 3 09/08/25, 10:09

    AbstractTask.php:191

    I'd prefer this for readability: ``` $file = $this->getTargetFile()->getOriginalFile(); return implode('_', [ $file->getNameWithoutExtension(), $file->getUid(), $this->getConfigurationChecksum(), ]); ```

    SvgImageProcessor.php:173

    wouldn't it be better to adjust the type hint of the method right away? It's a breaking change already, so take the chance?
  15. Benni Mack commented on patch set 3 09/08/25, 13:51

    SvgImageProcessor.php:173 Reply

    it's a protected method. IMHO this method will hopefully vanish completely, but I haven't been that far in the API refactoring process yet.
  16. Garvin Hicking commented on patch set 3 09/08/25, 14:32

    Breaking-107397-CircularDependencyBetweenProcessedFileAndTaskRemoved.rst:98

    Missing extension scanner entries
  17. Garvin Hicking commented on patch set 3 CR -1 09/10/25, 11:09

    on it
  18. Garvin Hicking uploaded patch set 4 CR -1 V +1 09/10/25, 11:13

  19. core-ci voted on patch set 4 V +1 09/10/25, 11:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84773

  20. Garvin Hicking uploaded patch set 5 V +1 09/10/25, 12:16

  21. Garvin Hicking commented on patch set 5 09/10/25, 12:19

    Reply

    Done

    AbstractTask.php:159 Reply

    Done

    AbstractTask.php:191 Reply

    Done

    SvgImageProcessor.php:173 Reply

    I would agree to leave this for further refactoring.

    Breaking-107397-CircularDependencyBetweenProcessedFileAndTaskRemoved.rst:98 Reply

    I fell into a rabbit-hole here and figured out the hard way that listing `add` and `update` methods does not work. I left a note for future me. Hope it's ok to do this as a drive-by here.
  22. core-ci voted on patch set 5 V +1 09/10/25, 12:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84774

  1. Benni Mack commented on patch set 5 09/10/25, 15:58

    We should get rid of ProcessedFile->isOutdated while we're at it.
  2. Markus Klein uploaded patch set 6 V +1 09/10/25, 16:07

  3. Markus Klein commented on patch set 6 09/10/25, 16:07

    only rebased
  4. Garvin Hicking commented on patch set 6 09/10/25, 16:11

    Reply

    (unresolving)
  5. core-ci voted on patch set 6 V -1 09/10/25, 16:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84789

  6. Georg Ringer uploaded patch set 7 V -1 09/10/25, 18:04

  7. core-ci voted on patch set 7 V +1 09/10/25, 18:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84793

  8. Markus Klein commented on patch set 7 09/11/25, 20:04

    AbstractTask.php:157 Reply

    agreed
  9. Markus Klein commented on patch set 7 09/11/25, 20:05

    LocalImageProcessor.php:305

    introducing the uid here is really bad for multi-head installations (load balancing)
  10. Benni Mack uploaded patch set 8 V +1 09/12/25, 20:29

  11. Benni Mack commented on patch set 8 09/12/25, 20:30

    AbstractTask.php:149 Reply

    what does that mean? Can you elaborate? If the file is not (yet) processed, it needs processing...

    AbstractTask.php:157 Reply

    Done
  12. Benni Mack commented on patch set 8 09/12/25, 20:30

    LocalImageProcessor.php:305 Reply

    Done
  13. Benni Mack commented on patch set 8 09/12/25, 20:30

    Reply

    we can keep it for the time being.
  14. core-ci voted on patch set 8 V -1 09/12/25, 20:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84929

  15. Benni Mack uploaded patch set 9 V -1 09/12/25, 20:47

  16. Benni Mack commented on patch set 9 09/12/25, 20:47

    AbstractTask.php:149 Reply

    Done
  17. core-ci voted on patch set 9 V -1 09/12/25, 21:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84931

  18. Benni Mack commented on patch set 9 09/12/25, 21:02

    AbstractTask.php:149 Reply

    With the latest change, the tests fail again due to the checksum validation of the deferred backend image processing.
  19. Stefan Froemken uploaded patch set 10 V -1 09/18/25, 23:06

  20. core-ci voted on patch set 10 V +1 09/18/25, 23:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85137

  21. Stefan Froemken commented on patch set 10 CR +1 V +1 09/19/25, 07:17

    I have replaced exe file with pdf, and pdf with png in fileadmin. Further I have add 1 then 2 and then 3 files into CEs and played around with columns to initialize new image resizing. Looks good.
  22. Georg Ringer voted on patch set 10 CR +1 V +1 09/19/25, 08:14

  23. Garvin Hicking voted on patch set 10 CR +1 V +1 09/19/25, 08:58

  24. Benni Mack voted on patch set 10 CR +2 V +2 09/19/25, 08:58

  25. Benni Mack merged patch set 11 09/19/25, 08:58