Review main Merged

95694[BUGFIX] Keep booted container in database analyzer

Stefan Bürk CR +2 V +2 Hard +277 −5 updated 09/08/26, 07:11

Commit message

The two database analyzer actions of the install tool boot the
full container through LateBootService but rely on its default
of resetting the global container to the failsafe one before the
returned container is used. Services taken from the returned
container work, but everything resolved through
GeneralUtility::makeInstance() further down the call chain is
resolved against the failsafe container again.

Since #106867 the query restrictions fetch TcaSchemaFactory via
GeneralUtility::makeInstance(). Counting the rows of a table that
is no longer defined by any ext_tables.sql, shown as "Rows in
table" next to the rename suggestion, creates a QueryBuilder with
the DefaultRestrictionContainer while the failsafe container is
active. It does not provide TcaSchemaFactory, so v14 ends up with
an ArgumentCountError as soon as a leftover table exists.

Both actions now keep the booted container active, as every other
action of MaintenanceController already does. Main is not affected
since #110163 resolves the schema factory through the container
of the connection, and receives the same call along with the
functional and e2e tests that cover a leftover table.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Georg Ringer +1
    • Benni Mack +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Georg Ringer +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 3

Files 5

Review log 1213

  1. Stefan Bürk uploaded patch set 1 09/07/26, 21:24

  2. core-ci voted on patch set 1 V +1 09/07/26, 21:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108042

  3. Georg Ringer voted on patch set 1 CR +1 V +1 09/08/26, 05:01

  4. Benni Mack voted on patch set 1 CR +1 V +1 09/08/26, 06:21

  5. Benjamin Franzke commented on patch set 1 CR -1 09/08/26, 06:35

    Could you actually verify the reported bug against `main`? The mentioned trace should not happen in `main` because https://review.typo3.org/c/Packages/TYPO3.CMS/+/89956/29/typo3/sysext/core/Classes/Database/Query/Restriction/DeletedRestriction.php refactored it to use DI instead of `makeInstance`, that means it does not require a *global* container. The analysis is based on v14, so maybe we should only apply this in v14, since main already uses proper DI in database services.
  6. Benjamin Franzke commented on patch set 1 09/08/26, 06:39

    Reply

    This is also evident from the fact that the new functional tests do not fail without the adjustment in the controller in `main`, but only in `v14`.
  7. Benjamin Franzke commented on patch set 1 09/08/26, 06:44

    Reply

    (the playwright tests do not fail either in `main` without the adjustment) **Therefore my suggestion: Keep the v14 change as is (feel free to merge), but transform the `main` change to a TASK that only adds the test.** Background: Benni is trying to remove `makeInstance()` for services wherever possible, and every place, where we can avoid having to place a global container is a place where we are already "clean" of `makeInstance()` for services.
  8. Stefan Bürk commented on patch set 1 09/08/26, 06:50

    Reply

    @ben@bnf.dev Thanks for the questioning: > The analysis is based on v14 ... That's not correct, I started from main (not affected) and `14.3` (affected) second - and I also checked and verified `13.4` (not affected). It's also mentioned in the commit message: > Main is not affected since #110163 resolves the schema factory > through the container of the connection, and receives the same > call along with the functional and e2e tests that cover a leftover > table. and also in the forge issue (https://forge.typo3.org/issues/110600#note-6): > main and 13.4 are not affected by this issue, for main the DI build > up has been reworked (fixed) with #110163 and 13.4 is not affected > because it does not use TcaSchemaFactory which has been introduced > with #106867 for `14.0.0`. I kept doing the change in main and 14.3 the **same** way it is done in the other `MaintenanceController` actions in **both** versions **and** to have tests in place ensuring that this keps working also in the future. And do the change the same on main and backport and not adding fix only in 14.3 or splitting the text further up. See: > Both actions now keep the booted container active, as every other > action of MaintenanceController already does. > since main already uses proper DI in database services. Correct - and I also mentioned that is the reason why it does not affect main despite the "missing calls". I'd say that we can verify this in a follow-up for **main only** after this bugfix and remove the calls added here together with the other calls in that controller done in the same way. At least that was my thoughts I missed to communicate properly. @ben@bnf.dev Is the change other wise okay for you ?
  9. Stefan Bürk commented on patch set 1 09/08/26, 06:53

    Reply

    > Background: Benni is trying to remove makeInstance() for services wherever > possible, and every place, where we can avoid having to place a global > container is a place where we are already "clean" of makeInstance() for > services. Yes I know that - must be removed in that controller anyway (other methods does it the same way still on main) - and because of that I decided to keep the main and backport change the same as possible - cleanup follup needs to be done anyway for main.
  10. Benjamin Franzke commented on patch set 1 CR 0 09/08/26, 06:56

    Reply

    I'm against it anyway, since it is a **needless** change to make it global. It **will** make it easier to add `makeInstance()` again, your test would prevent that. Anyway, I missed that part of the commit message, so if the three of you were fine with that I'll refrain from my -1.
  11. Benjamin Franzke commented on patch set 1 09/08/26, 07:01

    Reply

    > other methods does it the same way still on main Yes, because `makeInstance()` is still used by underlying services in those cases. I agree it needs to be removed everywhere, but it doesn't help to **add** it everywhere *in my opinion*. Having certain "cleaned" areas, makes it easier to clean everything later on. Anyway, you got the votes, feel free to merge.
  12. Benjamin Franzke voted on patch set 1 CR +2 V +2 09/08/26, 07:11

  13. Benjamin Franzke merged patch set 2 09/08/26, 07:11