Review main Merged

95135[TASK] Add autocomplete to setup and language commands

Georg Ringer CR +2 V +2 Normal +49 −5 updated 09/02/26, 13:49

Commit message

Add value completion to the following command inputs:

- setup: options --driver, --distribution and --server-type
- language:update: argument locales

The suggestions are read from the container which has already been
booted by CommandApplication, the closures must not boot again.

--driver now only offers the connection types which are usable with
the database extensions of the current PHP installation. The
interactive "Database driver?" question is limited the same way, as
it offered values its own validator rejects.

--distribution only suggests inactive distributions, because active
ones can not be activated during setup, and suggests nothing if
typo3/cms-impexp is not available.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Stefan Bürk +1
    • Sebastian Fischer +1
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1316

  1. Georg Ringer uploaded patch set 1 08/06/26, 19:35

  2. Georg Ringer commented on patch set 1 08/06/26, 19:35

    This change is ready for review.
  3. Georg Ringer updated the commit message in patch set 2 08/06/26, 19:37

  4. core-ci voted on patch set 1 V +1 08/06/26, 19:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106031

  5. core-ci voted on patch set 2 V +1 08/06/26, 19:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106032

  6. Tobias Gaertner voted on patch set 2 CR +1 V +1 08/06/26, 20:02

  7. Simon Schaufelberger voted on patch set 2 CR +1 V +1 08/15/26, 09:52

  8. Stefan Bürk commented on patch set 2 CR -1 08/15/26, 18:07

    Thanks for pushing the completion series forward - the declarative $suggestedValues closure is the right tool and --server-type is exactly how this should look. Three things before this can go in. 1. "Resolve:" must be "Resolves:". Build/git-hooks/commit-msg requires ^Resolves: #[0-9]+$, and the typo already had a visible effect: #107249 is still in status New with no Gerrit Code Review journal entries at all, whereas #107247 (95143/95147, with the correct keyword) is Under Review with the usual automatic push notes. On merge this would not close the issue. While touching the message: it announces "language:update: locales" and "setup: driver", but the patch also adds completion for setup --distribution and setup --server-type. And a sharper subject would help - "[TASK] Add autocomplete to commands of EXT:install" (49 chars) mirrors 95143 and the forge issue title. 2. --distribution suggests values the command rejects. The closure returns array_keys($distributions['active'] + $distributions['inactive']), but getDistributionForActivation() validates against inactive only and throws 'Distribution "%s" is not available.' for everything else - and it is only reached when $distributions['active'] === [], so an active key can never be a usable value. It also ignores the impexp guard that the option's own description already carries ("[disabled] Requires typo3/cms-impexp to be installed"); with impexp inactive, any value throws 1775034287. Suggest returning [] when the impexp package is not active, and otherwise only array_keys($this->setupService->getAvailableDistributions()['inactive']). 3. language:update should not call loadExtLocalconfDatabase(). By the time a suggestion closure runs, CommandApplication::run() has already done the full boot - _complete is not in CommandRegistry, so wantsFullBoot() is true. You can see it on the already-merged impexp:export completion, which reads TcaSchemaFactory and works: "php bin/typo3 _complete --no-interaction -sbash -c2 -a1 --input=bin/typo3 --input=impexp:export --input=--table=" returns the full table list here. Calling it a second time re-requires the cached ext_localconf (plain require, see SimpleFileBackend::require()) and purges all singletons. And it is not needed anyway: LanguagePackService::getActiveLanguages() is a bare $GLOBALS['TYPO3_CONF_VARS']['LANG']['availableLocales'] read. The bit that actually worries me is the uninstalled system: run() deliberately skips the boot when Bootstrap::checkIfEssentialConfigurationExists() is false, and the closure would then be the only caller of a method whose docblock says "can potentially fatal ... Use only if really needed" - from a TAB press. Please use the 92733 form and just resolve LanguagePackService directly. The same remark applies to 95143's getAvailableCacheGroups(), though there the boot is at least semantically needed for extension-registered cache groups. Two smaller points, not blocking: * --driver offers all six connectionLabels keys, but the validator checks $driverOptions[... . 'ManualConfigurationOptions'], which SetupDatabaseService fills only behind DatabaseCheck::isMysqli()/isPdoMysql()/isPdoPgsql()/isPdoSqlite(). On a pdo_mysql-only container, "--driver=<TAB>" still offers postgres. The interactive ChoiceQuestion has the same flaw today, so this is pre-existing - but you are one line away from fixing both. * UpdateLanguagePackCommand is EXT:core, while #107249 is scoped to EXT:install. Either move that hunk to 95143/#107247 or widen the issue, otherwise the per-extension split of the series does not hold. Finally: --driver and --server-type are testable with Symfony\Component\Console\Tester\CommandCompletionTester without any boot, and core has no completion test yet (grep -rn CommandCompletionTester typo3/ is empty) even though the #106839 changelog links Symfony's testing docs. A small typo3/sysext/install/Tests/Unit/Command/SetupCommandTest.php here would establish the pattern for the rest of the series - and would have caught point 2.
  9. Sebastian Fischer voted on patch set 2 CR +1 08/20/26, 07:11

  10. Georg Ringer uploaded patch set 3 CR +1 V +1 08/27/26, 16:09

  11. core-ci voted on patch set 3 V +1 08/27/26, 16:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107280

  12. Sebastian Fischer voted on patch set 3 CR +1 08/31/26, 14:05

  13. Stefan Bürk commented on patch set 3 CR +1 V +1 09/02/26, 12:14

    Reply

    Done
  14. Benni Mack voted on patch set 3 CR +1 V +1 09/02/26, 12:16

  15. Georg Ringer voted on patch set 3 CR +2 V +2 09/02/26, 13:02

  16. Georg Ringer merged patch set 4 09/02/26, 13:49