Review main Merged

91287[TASK] Add option to not add cache busting to generated URIs

Helmut Hummel CR +2 V +2 Hard +134 −141 updated 11/04/25, 08:05

Commit message

The initial idea was to omit an option whether to add cache
busting for a generated URL or not and apply cache busting
everywhere. The reason for that was, that such specific option
might not be useful for other implementations of the URI generation
interface.

It turned out however, that there are legitimate cases where
not adding cache busting is required. Some of those are in code
that was touched already. For those a workaround for the missing
option was added, which was removing the query string. This workaround
is incomplete and also does not work when configuring versionNumberedFileNames.

Additionally, when generating URLs to JS assets, that already have a
hashed identifier in filename e.g. from a frontend build, adding
additional cache busting would not only be useless, it can also lead to
unnecessary additional requests, when the JS code itself required the
same asset without TYPO3 cache busting.

On top of that, especially when imagining resources publishing to CDNs
and generating URLs for those, not only the cache busting option would
be obsolete, but also the "absolute" option, as URLs would have to be
always absolute.

Also the prefix option would be obsolete.

Last but not least, by implementing this option, the impact of
some changes could be lowered as well, having less required deprecations
and less breaking changes.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • Simon Praetorius +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • Simon Praetorius +1
    • core-ci +1 CI

Issues 1

Files 14

Review log 4356

Show 2431 earlier messages
  1. Helmut Hummel uploaded patch set 1 10/27/25, 18:55

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

  3. Helmut Hummel uploaded patch set 2 V -1 10/27/25, 19:54

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

  5. Garvin Hicking commented on patch set 2 10/27/25, 20:15

    Breaking-107537-UrlGenerationSystemResources.rst:40

    ```suggestion :caption: Result (note the leading "/") ```
  6. Garvin Hicking commented on patch set 2 10/27/25, 20:26

    ResourceCompressor.php:509

    ```suggestion // @todo: Until a full refactor of this class, we return an URL relative to document root ```
  7. Simon Praetorius commented on patch set 2 10/27/25, 20:41

    UriGenerationOptions.php:34

    ```suggestion * to specific implementations of SystemResourcePublisherInterface, ```

    UriGenerationOptions.php:35

    ```suggestion * which means, that if other resource publishing stategies ```
  8. Garvin Hicking commented on patch set 2 10/27/25, 20:53

    UriGenerationOptions.php:35 Reply

    ```suggestion * which means, that if other resource publishing strategies ``` 😄
  9. Simon Praetorius commented on patch set 2 10/27/25, 21:05

    UriGenerationOptions.php:35 Reply

    nooo, damn it. I should just go to bed and let Garvin handle this.
  10. Helmut Hummel commented on patch set 2 10/28/25, 08:57

    UriGenerationOptions.php:34 Reply

    Fix applied.
  11. Helmut Hummel rebased onto patch set 3 V +1 10/28/25, 08:58

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

  13. Helmut Hummel uploaded patch set 4 V +1 10/28/25, 09:09

  14. Helmut Hummel commented on patch set 3 10/28/25, 09:09

    UriGenerationOptions.php:35 Reply

    Done
  15. Helmut Hummel commented on patch set 4 10/28/25, 09:11

    Breaking-107537-UrlGenerationSystemResources.rst:40 Reply

    Done
  16. Helmut Hummel commented on patch set 4 10/28/25, 09:11

    ResourceCompressor.php:509 Reply

    Done
  17. Helmut Hummel uploaded patch set 5 10/28/25, 09:11

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

  19. core-ci voted on patch set 5 V +1 10/28/25, 09:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87774

  20. Oliver Klee updated the commit message in patch set 6 V +1 10/28/25, 11:01

  21. core-ci voted on patch set 6 V +1 10/28/25, 11:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87800

  22. Helmut Hummel uploaded patch set 7 V +1 10/29/25, 20:46

  23. core-ci voted on patch set 7 V +1 10/29/25, 20:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88046

  24. Simon Schaufelberger commented on patch set 7 10/30/25, 01:20

    -the
  25. Benjamin Franzke commented on patch set 7 10/30/25, 08:08

    ImportMap.php:268

    Please explain why `render()` should receive a request. I think request is too generic and not explicit enough, since requiring a request does not reflect, what parts of the request is needed and if – at some point in time – attributes are used, which may not be available. I want this interface to be very explicit, since we also rely on it in install tool. If we need additonal data/information in render, then we should add it there. Maybe leave out this todo for now?
  26. Lina Wolf commented on patch set 7 11/01/25, 08:15

    Breaking-107537-UrlGenerationSystemResources.rst:43

    Shouldn't an assests path be returned, for example /_assets/5f237792cbcdc97cfceade1e16ea33d7/Icons/Extension.svg
  27. Helmut Hummel commented on patch set 7 11/03/25, 08:16

    ImportMap.php:268 Reply

    Well, https://github.com/TYPO3/typo3/blob/c3df7e73db0258f1fc344b4243ebf8067f425a44/typo3/sysext/core/Classes/SystemResource/Publishing/SystemResourcePublisherInterface.php#L35 needs a request. ImportMap renders URIs based on system resources, therefore it makes sense to depend on this interface to generate them, which it can't, when it does not receive a request. So better discuss now, whether to SystemResourcePublisherInterface has a too broad dependency to the request or not. Current default implementation needs at least NormalizedParams and also ApplicationType, when doing cache busting, due to different cache busting confg for FE and BE (maybe add a generic config, or drop this config at all?). What about future/ userland implementations of this interface? Can we be sure, they don't need a request? Can we know which request attributes they need?
  28. Helmut Hummel commented on patch set 7 11/03/25, 08:18

    Breaking-107537-UrlGenerationSystemResources.rst:43 Reply

    Ah, well. It is a matter of using Composer or Classic mode. I will make a note to add Comoposer mode example as well with _asset/ paths
  29. Helmut Hummel commented on patch set 7 11/03/25, 08:21

    Reply

    Done
  30. Helmut Hummel commented on patch set 7 11/03/25, 08:23

    Breaking-107537-UrlGenerationSystemResources.rst:43 Reply

    Done
  31. Helmut Hummel commented on patch set 7 11/03/25, 08:52

    ImportMap.php:268 Reply

    The main issue with the current code structure and the sitePrefix dependency is, that URI generation and prefixing with a site path are two operations. This currently works, but will be unreliable or simply wrong when having a generic interface for URI generation, which can generate e.g. CDN URIs with scheme and CDN hostname. URI generation must happen as one operation in the future.
  1. Helmut Hummel uploaded patch set 8 V +1 11/03/25, 09:31

  2. Helmut Hummel commented on patch set 8 11/03/25, 09:33

    ImportMap.php:268 Reply

    That would be one way to resolve the todo's: https://review.typo3.org/c/Packages/TYPO3.CMS/+/91406
  3. core-ci voted on patch set 8 V +1 11/03/25, 09:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88351

  4. Benjamin Franzke commented on patch set 8 11/03/25, 10:41

    ImportMap.php:268 Reply

    Thanks for your answer and proposal! > The main issue with the current code structure and the sitePrefix dependency is, that URI generation and prefixing with a site path are two operations. Understood, but ImportMap URL generation is separated into two steps on purpose: * We need to be able to warmup the importmap, without knowing the installation destination in CLI context `bin/typo3 cache:warmup -g system` * We want to use such a compiled importmap to a runtime determined basepath. That means from *my perspective* that's not an "issue", but a demand for URL generation, which the new design does not want to provide ;) > URI generation must happen as one operation in the future. I'm not fully sold to that idea (it's a good academic idea, but may fail in the face of reality, given the performance impact that everything needs to be done runtime or known upfront, but we'll see), but let's pretend we will do that: If we add the site path (=subdir installation prefix) to the importmap during compile time (e.g. in CLI context), we either will end up with two options * ignoring request-dependant sitePath, which ends up in breaking subdir installations or we * introduce a static sitePath configuration option to be able to support subdir's statically I'm not sure I like either of that, do you plan to make the sitePath a static option? I guess you'll face this problem more often (well, it's also easy to oversee, since we do not have good test coverage for that). Anyway, with the given proposal we end up unsupporting subdir installations, if I understand https://review.typo3.org/c/Packages/TYPO3.CMS/+/91406 correctly (see https://review.typo3.org/c/Packages/TYPO3.CMS/+/91406/comment/614433b2_dd5ec860/). If we really want to "forbid" two-step URL generation, a possible solution *could* be to not cache URL paths in importmap cache at all, but only store system resource description objects and resolve all importmap URIs runtime. If the new resource API is able to handle that performantly – I'm fine.
  5. Helmut Hummel rebased onto patch set 9 V +1 11/03/25, 11:52

  6. Helmut Hummel commented on patch set 9 11/03/25, 12:00

    ImportMap.php:268 Reply

    without reading your comment here first I implemented what you proposed here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/91406/ So I can mark this one as resolved, right?
  7. core-ci voted on patch set 9 V +1 11/03/25, 12:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88364

  8. Helmut Hummel commented on patch set 9 11/03/25, 12:45

    ImportMap.php:268 Reply

    > it's a good academic idea, but may fail in the face of reality, given the performance impact that everything needs to be done runtime or known upfront, but we'll see challenge accepted. > If the new resource API is able to handle that performantly – I'm fine. resolving resource might be costly indeed. with a central API though, it is possible to build a resource (URI) cache, that all usages will benefit from, not only ImportMap. Let's see what is needed here in the future.
  9. Simon Praetorius commented on patch set 9 11/03/25, 17:46

    DefaultSystemResourceUriGenerator.php:69

    how can this be null? Or should it be nullable? In that case, the type of the property needs to be adjusted.
  10. Helmut Hummel commented on patch set 9 11/03/25, 17:49

    DefaultSystemResourceUriGenerator.php:69 Reply

    oh, of course thanks. nullable is not required here
  11. Helmut Hummel uploaded patch set 10 V +1 11/03/25, 17:52

  12. Helmut Hummel commented on patch set 9 11/03/25, 17:52

    DefaultSystemResourceUriGenerator.php:69 Reply

    Done
  13. Simon Praetorius voted on patch set 10 CR +1 V +1 11/03/25, 17:53

  14. core-ci voted on patch set 10 V -1 11/03/25, 18:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88404

  15. core-ci commented on patch set 10 11/03/25, 18:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88404

  16. Helmut Hummel uploaded patch set 11 CR +1 V +1 11/03/25, 18:42

  17. Helmut Hummel commented on patch set 10 11/03/25, 18:42

    DefaultSystemResourceUriGenerator.php:69 Reply

    actually $this->options is nullable
  18. core-ci voted on patch set 11 V +1 11/03/25, 18:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88410

  19. Helmut Hummel uploaded patch set 12 V +1 11/03/25, 19:11

  20. core-ci voted on patch set 12 V +1 11/03/25, 19:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88413

  21. Simon Praetorius voted on patch set 12 CR +1 V +1 11/03/25, 19:53

  22. Garvin Hicking voted on patch set 12 CR +1 V +1 11/03/25, 19:57

  23. Georg Ringer voted on patch set 12 CR +1 V +1 11/03/25, 20:44

  24. Helmut Hummel commented on patch set 12 CR +2 V +2 11/04/25, 08:05

    Thanks! Some todos discussed here will be resolved in this: https://review.typo3.org/c/Packages/TYPO3.CMS/+/91406/
  25. Helmut Hummel merged patch set 13 11/04/25, 08:05