Review main Merged

82452[TASK] Streamline TypoScriptFrontendItitialization

Christian Kuhn CR +2 V +2 Expert +993 −768 updated 01/18/24, 11:32

Commit message

This patch is the result of a careful refactoring of
the TypoScriptFrontendInitialization 'body' methods.

The patch establishes the new PageInformationFactory
which does all the main lifting. It either returns
the verified PageInformation object, or throws an
early dedicated exception carrying a response from the
ErrorController when something went wrong (access
checks, language overlays ...), or a StatusException
when ErrorController itself error'ed.

When PageInformation could be determined, rendering
is dispatched to middlewares below. In case of error,
the code flow is streamlined to always *return* the
early response, so upper middlewares can kick in. This
was a mixed bag before, where such exceptions sometimes
bubbled up, skipping upper middlewares.

While most error scenarios are covered by the complex
'SiteHandling' related functional tests already, a set
of simple additional tests is set up to check for
casual things in a more obvious way.

Note the internal code flow within PageInformationFactory
can still be simplified and disentangled some more, but
the outer class communication is fine now and the
internal handling is already much more easy to follow.

As drive-by, @internal getUriToCurrentPageForRedirect()
is moved from TSFE to the consuming 'shortcut and
mountpoint redirect' middleware.

The patch also outlines flaws of the PageRepository
strategy, that becomes obvious after disentangling the
consuming code. It adds a todo on how PageRepository
could be improved. We should follow this path soon, since
the entire area with all the access and logic checks is
security relevant: We want to end up with code that is as
easy to grasp and follow as possible.

Review

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

Issues 2

Files 27

Show 7 more files

Review log 3566

Show 2141 earlier messages
  1. Christian Kuhn uploaded patch set 1 01/13/24, 15:20

  2. core-ci voted on patch set 1 V -1 01/13/24, 15:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51536

  3. Christian Kuhn uploaded patch set 2 V -1 01/15/24, 12:39

  4. core-ci voted on patch set 2 V -1 01/15/24, 12:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51580

  5. Christian Kuhn uploaded patch set 3 V -1 01/15/24, 13:29

  6. core-ci voted on patch set 3 V +1 01/15/24, 13:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51582

  7. Christian Kuhn uploaded patch set 4 V +1 01/15/24, 14:08

  8. core-ci voted on patch set 4 V +1 01/15/24, 14:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51583

  9. Christian Kuhn uploaded patch set 5 V +1 01/15/24, 14:27

  10. core-ci voted on patch set 5 V +1 01/15/24, 14:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51584

  11. Christian Kuhn uploaded patch set 6 V +1 01/15/24, 16:24

  12. core-ci voted on patch set 6 V +1 01/15/24, 16:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51595

  13. Christian Kuhn uploaded patch set 7 V +1 01/15/24, 17:06

  14. core-ci voted on patch set 7 V -1 01/15/24, 17:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51596

  15. Christian Kuhn uploaded patch set 8 V -1 01/15/24, 17:42

  16. core-ci voted on patch set 8 V +1 01/15/24, 17:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51598

  17. Christian Kuhn uploaded patch set 9 V +1 01/16/24, 11:09

  18. core-ci voted on patch set 9 V -1 01/16/24, 11:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51634

  19. Christian Kuhn uploaded patch set 10 V -1 01/16/24, 11:37

  20. core-ci voted on patch set 10 V +1 01/16/24, 11:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51635

  21. Christian Kuhn uploaded patch set 11 V +1 01/16/24, 14:28

  22. core-ci voted on patch set 11 V +1 01/16/24, 14:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51646

  23. Christian Kuhn uploaded patch set 12 V +1 01/16/24, 15:03

  24. core-ci voted on patch set 12 V -1 01/16/24, 15:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51652

  25. Christian Kuhn uploaded patch set 13 V -1 01/16/24, 15:34

  26. core-ci voted on patch set 13 V +1 01/16/24, 15:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51653

  27. Christian Kuhn uploaded patch set 14 V +1 01/16/24, 15:54

  28. core-ci voted on patch set 14 V +1 01/16/24, 15:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51654

  29. Christian Kuhn uploaded patch set 15 V +1 01/16/24, 16:06

  30. core-ci voted on patch set 15 V -1 01/16/24, 16:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51655

  31. Christian Kuhn uploaded patch set 16 V -1 01/16/24, 17:08

  32. core-ci voted on patch set 16 V -1 01/16/24, 17:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51656

  33. Christian Kuhn uploaded patch set 17 V -1 01/16/24, 17:20

  34. core-ci voted on patch set 17 V -1 01/16/24, 17:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51657

  35. Christian Kuhn uploaded patch set 18 V -1 01/16/24, 17:29

  36. core-ci voted on patch set 18 V +1 01/16/24, 17:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51658

  37. Christian Kuhn uploaded patch set 19 V +1 01/16/24, 18:08

  38. core-ci voted on patch set 19 V -1 01/16/24, 18:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51659

  39. Christian Kuhn uploaded patch set 20 V -1 01/16/24, 18:15

  40. core-ci voted on patch set 20 V +1 01/16/24, 18:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51660

  41. Christian Kuhn rebased onto patch set 21 V +1 01/17/24, 10:19

  1. core-ci voted on patch set 21 V +1 01/17/24, 10:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51676

  2. Christian Kuhn uploaded patch set 22 V +1 01/17/24, 15:27

  3. core-ci voted on patch set 22 V -1 01/17/24, 15:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51697

  4. Christian Kuhn uploaded patch set 23 V -1 01/17/24, 17:07

  5. Christian Kuhn uploaded patch set 24 01/17/24, 17:09

  6. core-ci voted on patch set 23 V -1 01/17/24, 17:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51703

  7. core-ci voted on patch set 24 V +1 01/17/24, 17:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51704

  8. Christian Kuhn uploaded patch set 25 V +1 01/18/24, 08:48

  9. core-ci voted on patch set 25 V +1 01/18/24, 08:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51725

  10. Christian Kuhn uploaded patch set 26 V +1 01/18/24, 09:09

  11. Christian Kuhn updated the commit message in patch set 27 01/18/24, 09:12

  12. core-ci voted on patch set 26 V +1 01/18/24, 09:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51727

  13. Christian Kuhn updated the commit message in patch set 28 01/18/24, 09:16

  14. core-ci voted on patch set 27 V +1 01/18/24, 09:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51728

  15. Christian Kuhn updated the commit message in patch set 29 01/18/24, 09:18

  16. Christian Kuhn updated the commit message in patch set 30 01/18/24, 09:21

  17. core-ci voted on patch set 28 V +1 01/18/24, 09:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51729

  18. Christian Kuhn uploaded patch set 31 01/18/24, 09:24

  19. core-ci voted on patch set 29 V +1 01/18/24, 09:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51730

  20. core-ci voted on patch set 30 V +1 01/18/24, 09:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51731

  21. core-ci voted on patch set 31 V +1 01/18/24, 09:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51732

  22. Stefan Bürk voted on patch set 31 CR +1 V +1 01/18/24, 10:40

  23. Benni Mack commented on patch set 31 CR +1 V +1 01/18/24, 11:02

    I think this is a great step forward. In general, I think we should try to move the errorController out of the factory and into the middleware, and instead throw customized Exceptions with the error code + message in it to create the response in the middleware - but that is the icing on the cake, not directly relevant for this change. Thanks for the tests
  24. Christian Kuhn commented on patch set 31 CR +2 V +2 01/18/24, 11:32

    Reply

    Yeah, I guess we could do this. But I guess its fine as is for now and we could do that later as well, the introduced exception is internal and could very well carry code and message data instead of the response. We can rethink after the ext:redirect RedirectService hack has been resolved, I suppose.
  25. Christian Kuhn merged patch set 32 01/18/24, 11:32