Review main Merged

96938[TASK] Soft-fail and show broken site configurations

Garvin Hicking CR +2 V +2 Expert +1846 −71 updated 10/30/26, 10:53

Commit message

A single site configuration that could not be loaded rendered the
whole installation inaccessible, as soon as the site configuration
cache was rebuilt. A typical cause is an environment variable that
resolves to an empty string, turning "https://%env(HOST)%/" into the
malformed base "https:///".

Site configurations failing to be turned into a Site object are now
skipped and collected as invalid sites, listing the exception type,
code, message and (if known) - the affected configuration option.

Errors from loading/resolving are kept in the core cache, errors
of the Site object creation are evaluated per
request, as base variants depend on the context.

`Site` throws the new `InvalidSiteConfigurationException` for malformed
entry points and missing locales, naming the configuration path, e.g.
"languages.1.base".

Invalid sites are shown in a new section of the GUI Sites module, can be
edited there with the error shown above the form, and do not offer to
create a duplicate site configuration for their root page. This
follows the approach of invalid site sets or unassigned sites.

The new CLI command `site:validate` reports invalid sites and fails
if there are any, `site:list` shows a warning. `site:validate` also
checks the base of every base variant, as the Site object only
evaluates the variant matching the current context.

Only configuration errors are collected, other exceptions are thrown
as before. Pages of an invalid site nested in another site are not
resolved to the outer site.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Matthias Vogel +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Matthias Vogel +1
    • core-ci +1 CI

Issues 1

Files 41

Show 21 more files

Review log 1419

  1. Garvin Hicking uploaded patch set 1 10/20/26, 15:50

  2. core-ci voted on patch set 1 V -1 10/20/26, 16:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111877

  3. core-ci voted on patch set 1 V +1 10/20/26, 16:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111877

  4. Matthias Vogel uploaded patch set 2 V +1 10/20/26, 18:27

  5. core-ci voted on patch set 2 V +1 10/20/26, 18:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111908

  6. Matthias Vogel voted on patch set 2 CR +1 V +1 10/20/26, 18:46

  7. Oli Bartsch uploaded patch set 3 CR +1 V +1 10/21/26, 07:32

  8. Oli Bartsch commented on patch set 3 10/21/26, 07:35

    Hi Garvin, I pushed to address some review findings. Please check if you agree: - Invalid sites are now logged when detected: load/resolve errors once per cache build, Site object errors per request. Before, nothing was logged in frontend requests. - Only configuration errors (YAML parse/loading/placeholder, InvalidSiteConfigurationException, UnexpectedValueException) are collected and cached. Exceptions from SiteConfigurationLoadedEvent listeners or \Error are thrown again, so a transient failure is not cached as an invalid site until the next cache flush. - site:validate now also validates the base and the base of every base variant (site and languages), not only the variant matching the CLI context. - SiteFinder::getSiteByPageId() no longer falls back to the outer site for pages of an invalid nested site, it throws SiteNotFoundException. - site:list uses the cached sites again. - Added InvalidSiteTest (frontend): a valid site renders while another is broken (fails without your patch with the original exception), and a page below a broken nested site gets a 404. Unit tests cover logging and listener exceptions. RST updated accordingly.
  9. core-ci voted on patch set 3 V +1 10/21/26, 07:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111974

  10. Oli Bartsch voted on patch set 3 CR +1 V +1 10/21/26, 07:52

  11. Garvin Hicking commented on patch set 3 10/21/26, 07:53

    Reply

    Yes, thanks, these reworks are very helpful. I don't use variants myself a lot so I was not thinking of this case.
  12. Garvin Hicking commented on patch set 3 10/21/26, 10:04

    Adding @ben@bnf.dev into the mix to get his feedback, I'd like to not merge this without his feedback 😊
  13. Matthias Vogel uploaded patch set 4 CR +1 V +1 10/21/26, 10:53

  14. Garvin Hicking commented on patch set 4 10/21/26, 10:58

    SiteConfiguration.php:398

    Nice, I think this also has the benefit to make the flags more explicit in this place. IMPORTS/PLACEHOLDERS are a trigger.

    SiteConfiguration.php:407

    Having this optional is also a good benefit.
  15. core-ci voted on patch set 4 V +1 10/21/26, 11:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111999

  16. Matthias Vogel voted on patch set 4 CR +1 V +1 10/22/26, 07:49

  17. Oli Bartsch voted on patch set 4 CR +1 V +1 10/22/26, 20:06

  18. Garvin Hicking commented on patch set 4 CR +2 V +2 10/30/26, 10:35

    Reply

    Talked about in our merger meeting. Fine to merge, may have follow-ups when he looks at it.
  19. Garvin Hicking merged patch set 5 10/30/26, 10:53