72861[TASK] Streamline middleware configuration
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 5
- typo3/sysext/adminpanel/Configuration/RequestMiddlewares.php+32 −20
- typo3/sysext/backend/Configuration/RequestMiddlewares.php1+2 −3
- typo3/sysext/frontend/Configuration/RequestMiddlewares.php+117 −52
- typo3/sysext/redirects/Configuration/RequestMiddlewares.php3+5 −3
- typo3/sysext/workspaces/Configuration/RequestMiddlewares.php8+10 −6
Review log 2939
Show 814 earlier messages
-
Stefan Bürk uploaded patch set 1 01/04/22, 22:12
-
Stefan Bürk updated the commit message in patch set 2 01/04/22, 22:13
-
core-ci voted on patch set 2 V +1 01/04/22, 22:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21622
-
core-ci voted on patch set 1 V +1 01/04/22, 22:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21621
-
Stefan Bürk updated the commit message in patch set 3 01/04/22, 22:51
-
core-ci voted on patch set 3 V +1 01/04/22, 23:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21623
-
Stefan Bürk updated the commit message in patch set 4 01/05/22, 09:43
-
core-ci voted on patch set 4 V +1 01/05/22, 09:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21631
-
Stefan Bürk uploaded patch set 5 01/05/22, 15:47
-
Stefan Bürk updated the commit message in patch set 6 01/05/22, 15:48
-
Stefan Bürk marked it work in progress 01/05/22, 16:02
-
core-ci voted on patch set 6 V +1 01/05/22, 16:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21654
-
core-ci voted on patch set 5 V +1 01/05/22, 16:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21653
-
Stefan Bürk marked it ready for review 01/05/22, 16:11
-
Christian Kuhn updated the commit message in patch set 7 01/05/22, 16:14
-
core-ci voted on patch set 7 V +1 01/05/22, 16:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21656
-
Christian Kuhn commented on patch set 7 V +1 CR +1 01/06/22, 14:22
-
Nikita Hovratov commented on patch set 7 01/06/22, 14:26
configuration -
Benjamin Franzke commented on patch set 7 CR -1 01/06/22, 14:27
RequestMiddlewares.php:24These definitions implicitly define dependencies, you are aware, right? I didn't check this yet, but did you remove typo3/cms-workspaces/preview and typo3/cms-frontend/page-resolver because they are considered implcit due to typo3/cms-frontend/page-argument-validator? If *any* request attribute (or global state :\) is used that is added by typo3/cms-workspaces/preview or typo3/cms-frontend/page-resolver, these dependency definitions must not be removed. -
Christian Kuhn commented on patch set 7 CR -1 01/06/22, 14:28
RequestMiddlewares.php:12Replyactually, forget this comment. -
Christian Kuhn commented on patch set 7 01/06/22, 14:41
Reply
DoneRequestMiddlewares.php:12Replyit would be even better if redirects is *before* admin panel.RequestMiddlewares.php:24ReplyYes. However, the middleware ordering is not strictly a dependency system, it's just ordering. An instance could still *disable* a middleware noted here, which would break this system. It's task of the middleware implementation here to check required information it depends on and bail out on error. This can't be solved by the ordering system here. We therefor decided to reduce the set of ordering dependencies here. We'll however add an according comment to state these dependencies. -
Christian Kuhn uploaded patch set 8 01/06/22, 14:41
-
Benjamin Franzke voted on patch set 8 CR -2 01/06/22, 14:44
-
core-ci voted on patch set 8 V +1 01/06/22, 14:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21706
-
Benjamin Franzke commented on patch set 8 01/06/22, 15:03
RequestMiddlewares.php:24Reply> It's task of the middleware implementation here to check required information it depends on and bail out on error. Yup, because the dependent middleware may not be loaded at all, but *if* it is loaded, it must be ensured to be loaded before. This is by design, and this change makes our middlewares less reliable when any middleware is moved. This is like Before/After= definitions in systemd services, they define: IF a service is loaded, it needs to be loaded after/before this one: https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before= There are not just hard-dependencies but also weak ordering-definitions in service-management systems, we've got a weak one here. Yes, we don't have hard dependencies in middlewares, still, don't start to hoist ordering information, we wouldn't do that for dependencies, so why would we do so for orderings? Therefore I'd rather reject these changes, sorry. Please explain why this changes (that actually go beyond just reordering) are really needed and what they prepare for. Let's not hoist ordering information, please. -
Christian Kuhn commented on patch set 8 01/06/22, 15:41
RequestMiddlewares.php:24ReplyI get your point. You say we shouldn't skip declaring dependencies we do have, even though a middleware with dependencies could still fail if a dependency is disabled. The main thing we wanted to resolve with this patch: When reading the main middleware files top-down, it does not mean that a first middleware is actually executed before another one below - it is kinda often resorted differently. This makes reading these files hard: You have to go to the backend configuration module to see the true ordering of the middlewares. So, if we skip removal of dependencies from the files, I would suggest to strip the patch down to only bring the list of middlewares in the two main files into an order that the ordering service does not shuffle them around again. Stefan did that by adding the 'direct parent' as dependency and removed all other dependencies along the way. I'd love to make the main files better readable by resorting the entries a bit. It would mean that we basically pass the 'before' entries and rely mostly on 'after', partially by adding the direct parent as first after entry. Would you be fine with that? Main goal is to make the main files better readable without having to look at the final sorting displayed in backend configuration module. -
Christian Kuhn commented on patch set 8 01/06/22, 15:47
RequestMiddlewares.php:24ReplyNote the formEngine data provider follow a similar approach already in DefaultConfiguration: The first 'after' entry refers to the direct parent (which nails the order), further 'after' entries then declare dependencies. Result: You can read the list top-down in the file and the ordering service can not shuffle the stuff around. This is beneficial for extension devs who want to 'hang in' further entries - they can rely on what they see in the file. This makes everything much easier, especially with rather long lists. -
Stefan Bürk commented on patch set 8 01/06/22, 16:20
RequestMiddlewares.php:24ReplyBenjamin, I would suggest to do following: - keep the resorting in the config - readd the removed "after/before", adding comments which are "optional" to be before/after another middle ware and which are "mandantory" to be after/before it. Would that be okay than (generally) ? -
Benjamin Franzke commented on patch set 8 CR -1 01/06/22, 17:01
RequestMiddlewares.php:24ReplyYup, resorting is perfectly fine and I understand the reason. Moving before-declarations to after-declarations is good as well, if applicable. Of course things like adminpanel needs to use `before`, but you know and already kept it there, so that's fine ;) Limiting this patch to these changes would be great, yea. Thanks in advance. -
Stefan Bürk uploaded patch set 9 01/07/22, 00:14
-
Stefan Bürk commented on patch set 9 CR -1 01/07/22, 00:14
Still on it - just pushed to save state before night break. -
core-ci voted on patch set 9 V +1 01/07/22, 00:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21747
-
Stefan Bürk uploaded patch set 10 01/07/22, 11:57
-
core-ci voted on patch set 10 V +1 01/07/22, 12:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21761
-
Christian Kuhn commented on patch set 10 V +1 CR +1 01/13/22, 20:31
RequestMiddlewares.php:24ReplyDone -
Benni Mack commented on patch set 10 01/19/22, 09:18
@bnf fine with you? -
Benjamin Franzke commented on patch set 10 CR -1 01/19/22, 09:30
Reply
hm sorry, I don't want to offend, but this change introduces too much comment noise for my personal taste. > DIRECT-Parent: core ships it to be sorted after the first one I don't really unterstand the wording in these "DIRECT-Parent" comments. What is this "first one" that is referred here? The first dependency? Also I still have the feeling middlewares are added to make the ordering explicit although there is not really a dependency: For example in typo3/cms-workspaces/preview > 'typo3/cms-frontend/static-route-resolver', // Optional - only for shipped sorting. So this dependency is for some "default" sorting that we don't actually need. It's just there to document the *current* sorting order, but may cause deadlocks if dependencies change or are reordered. I think it will be a nightmare to maintain these explicit "optional – only for shipped sorting" comments. I would actually prefer if we'd introduce PHP 8 Attributes for Middlewares and not try to document the order through our configuration. That's what the "HTTP Middlewares" section in the backend Configuration module is for.RequestMiddlewares.php:34UnresolvedI think this one needs to stay. ForcedHttpsBackendRedirector uses !$request->getAttribute('normalizedParams')->isHttps() CR-1 because of this one. -
Christian Kuhn commented on patch set 10 V 0 CR 0 02/04/23, 11:03
seems it's very hard to find consensus on this one. let's abandon here for now. -
Christian Kuhn abandoned the change 02/04/23, 11:03
RequestMiddlewares.php:12