88761[!!!][FEATURE] Add alias for Composer root package
Commit message
Review
-
Code review CR -2
- Benjamin Franzke -2
-
Verified V 0
- core-ci +1 CI
Issues 1
Files 6
- Build/composer/composer.dist.json2+1 −1
- Build/Scripts/validateRstFiles.php+1 −1
- typo3/sysext/core/Classes/Composer/PackageArtifactBuilder.php6+19 −4
- typo3/sysext/core/Classes/Package/Package.php2+22 −11
- typo3/sysext/core/Documentation/Changelog/14.0/Breaking-106432-extensionKeyRootMustNotBeUsedAnyMore.rstnew+35 −0
- typo3/sysext/core/Documentation/Changelog/14.0/Feature-106432-AddAliasForRootPackage.rst5new+32 −0
Review log 3543
Show 1418 earlier messages
-
Helmut Hummel uploaded patch set 1 03/25/25, 21:46
-
core-ci voted on patch set 1 V -1 03/25/25, 21:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76321
-
Andreas Kienast commented on patch set 1 03/26/25, 06:47
Can you please provide a ReST for this? -
Helmut Hummel commented on patch set 1 03/26/25, 07:31
Reply
You mean a different one than the feature one? So one for feature and one for breaking? -
Helmut Hummel uploaded patch set 2
V -103/26/25, 07:33 -
Andreas Kienast commented on patch set 2 03/26/25, 07:33
Reply
Yes, exactly. -
core-ci voted on patch set 2 V -1 03/26/25, 07:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76350
-
Mathias Brodala commented on patch set 2 03/26/25, 07:43
Do we also want/need "root" as "extra.typo3/cms.extension-key "? This way one can also use "EXT:root" references everywhere. -
Simon Schaufelberger commented on patch set 2 03/26/25, 09:04
Feature-106432-AddAliasForRootPackage.rst:17can you please explain what a root package is? -
Mathias Brodala commented on patch set 2 03/26/25, 09:21
Feature-106432-AddAliasForRootPackage.rst:17ReplySimply said your project where you require TYPO3 and extensions. This is a term coined by Composer itself where e.g. various options can only be used in the root package: https://getcomposer.org/doc/04-schema.md -
Helmut Hummel commented on patch set 2 03/26/25, 12:04
Reply
with this change this key can not be used any more for extensions, which O tried to explain in the document. So what exactly is your question? -
Mathias Brodala commented on patch set 2 03/26/25, 12:13
Reply
Right now the package name visible to TYPO3 will be "acme/example-distribution" and code can use "typo3/root" and "root" as aliases. However, AFAIK for usage in "EXT:" references, one must set an "extension-key" which would not be the case here. No big deal since this can and probably should be set in the root manifest if desired. Just wanted to clarify if this is something we want to have by default if no "extension-key" is set in the root manifest. -
Helmut Hummel uploaded patch set 3
V -103/26/25, 15:10 -
Helmut Hummel uploaded patch set 4 03/26/25, 15:16
-
Helmut Hummel commented on patch set 4 03/26/25, 15:16
Reply
It is NOT required to set an extension key to be able to reference a package using EXT: syntax. Actually, it would be more clean, if the package key of a TYPO3 package would be the composer name and the extension key an alias. But not sure what the impact of that would be tbh 😊 With the change proposed here, one can reference the "acme/example-distribution" package with "EXT:root/resources..." as described in the docsReply
DoneFeature-106432-AddAliasForRootPackage.rst:17ReplyDone -
core-ci voted on patch set 3 V +1 03/26/25, 15:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76389
-
core-ci voted on patch set 4 V +1 03/26/25, 15:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76390
-
Mathias Brodala commented on patch set 4 CR +1 03/27/25, 07:40
Awesome change for this hidden gem, thanks!
-
Georg Ringer voted on patch set 4 CR +1 V +1 03/27/25, 08:08
-
Benjamin Franzke commented on patch set 4 CR -1 03/27/25, 08:32
I think we should only do this if a composer-root would be automatically registered as an extension, but currently this root alias would only work if the root composer.json defines an extension: ``` "extra": { "typo3/cms": { "extension-key": "foobar" } }, ``` Only with this setting EXT:root will be become an alias for EXT:foobar. This feature does not work without and I think this is a) intransparent and b) not helpful if we do not lift this requirement to define a custom extension-key. Given this requirement, an alias does not make sense to me. If this is meant to be a convention, then everyone could just define the extension-key to be root: ``` "extra": { "typo3/cms": { "extension-key": "root" } }, ``` …but I'd instead work on making this a default for v14 (without an extra section in root composer.json) *and* provide a proper directory structure, instead of users having to mix `config` and `Configuration` folders in composer root. -
Helmut Hummel commented on patch set 4 03/27/25, 10:56
Reply
Good call, although you're having some wrong assumptions. Any package is considered to be an extension and the only hard requirement is defining an extra.typo3/cms section. This means a root package that defines a web-dir will currently (since typo3 11 with composer installers 4) be considered as extension. Additionally it is planned to always consider the root package as extension, despite an composer.json settings. I only planned to do this in later changes, but it seems to make sense to include such change right away here, which I will now do. -
Benjamin Franzke commented on patch set 4 CR -2 03/27/25, 11:02
Reply
Yes, and if it defines a `web-dir`, it has to define an extension-key. Otherwise we'd error with: > Extension with package name "typo3/test-distribution" does not define an extension key. This is an issue. -
Helmut Hummel uploaded patch set 5
CR +1V +103/27/25, 11:28Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**") -
Benjamin Franzke commented on patch set 5 CR -2 03/27/25, 11:30
Reply
Still -2 for me, since we first need to align path handling, before (auto)defining an alias. -
Simon Schaufelberger wrote 03/27/25, 11:31
Removed cc Simon Schaufelberger. -
core-ci voted on patch set 5 V -1 03/27/25, 11:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76441
-
Helmut Hummel uploaded patch set 6
V -103/28/25, 16:17Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**") -
Helmut Hummel commented on patch set 6 03/28/25, 16:25
Reply
Resolved as discussed in private by excluding extensions from aliasing and always including all other root package types -
Helmut Hummel commented on patch set 6 03/28/25, 16:26
Reply
This is now resolved -
Helmut Hummel commented on patch set 6 03/28/25, 16:26
Reply
Resolved -
core-ci voted on patch set 6 V +1 03/28/25, 16:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76605
-
Benjamin Franzke commented on patch set 6 CR -2 03/31/25, 07:03
PackageArtifactBuilder.php:242Thanks for auto-considering TYPO3 app installations here. I think that's what we want! I think we shouldn't use the term `root` but `EXT:_app` to make it crystal clear that we only refer to the app instance. I propose to use an underscore prefix (`_app`) to denote that this is a synthetic "key", as done for synthetic DNS Records (like `_gateway`, `_outbound`) in: https://man7.org/linux/man-pages/man8/systemd-resolved.service.8.html#SYNTHETIC_RECORDS Another remark: We'd want another path structure for app-defined-extensions: * `EXT:_app/config/tca` instead of `EXT:_app/Configuration/TCA` * `EXT:_app/config/sets` instead of `EXT:_app/Configuration/Sets` …and so on, in order to match our current composer-mode path structure. I think we should roll out the autoregistration of this patch (to handle composer apps as a package) together with the described additional path consolidation. If we do not do that, we end up with a weird mixed state where folder names like `config` and `Configuration` are mixed in composer app instances. -
Benni Mack commented on patch set 6 04/04/25, 07:36
PackageArtifactBuilder.php:242ReplyI am personally in favor of EXT:root... two reasons for this: - we (now) own the extension key "root". "app" is interchangeable with "_app" because TER checks for extension keys that 1) start with an alphanumeric character and b) are not duplicated when removing underscores. So "_app" is an invalid key, PLUS "app" is already registered and does not belong to one of us. - Composer calls it "root package" as well https://getcomposer.org/doc/04-schema.md#root-package - people familiar with composer and packaging already know this term - PHP people are more familiar with composer than with Linux systemd internals. -
Benjamin Franzke uploaded patch set 7
V +104/04/25, 13:19Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**") -
Benjamin Franzke commented on patch set 7 04/04/25, 13:19
composer.dist.json:3Should be backported tov 12 and v13 composer tests, if we consider this an invalid type in general. (since this will cause composer installers to complain about a missing extension key) Maybe even mentioned in the RST, if anyone copied this from core. (Did not find any other usages via github search though) It was introduced in v11 via: > 69174: [FEATURE] Consider all Composer installed extensions as active | https://review.typo3.org/c/Packages/TYPO3.CMS/+/69174PackageArtifactBuilder.php:242Reply> Composer calls it "root package" Yes, but it's not retrievable by the name `root` or any other convention, only by the user defined custom package name or by `Composer\Composer::getPackage()`. Therefore I can not agree with the given argument. Composer semantically defines this as root, yes, but in TYPO3 the composer root can be two conceptional things: * A concrete TYPO3 project * An extension under test (`composer install` executed in extension directory) We need a convention for concrete projects that does not describe extensions under test (since test mode of an extension must not map EXT:root to itself, as that'd make testing inaccurate, since EXT:root is different and test and production mode). **For our case it's not just root, but a concrete composer project, an app.** *(Anyway, I'll happily accept a top-down decision on this topic, but we have time anyway since we first need to align paths structure)* **More important** than the naming decision is that we first need to implement the app-defined extension path structure, before we roll out any autoregistration of the root package, otherwise we end up with a mixed path structure (you could also call it "mess") in the composer root for the meantime, until we potentially (we might also fail to ever reach that) streamline the app-defined extension path structure. This is my main objection for this change, we can not do this without streamlined paths app-extension-paths.Package.php:161We're giving away the `typo3/root` package name for ever... hmm... Does not sound right. Maybe reserve another vendor name if this is really needed(?)Feature-106432-AddAliasForRootPackage.rst:27I know `EXT:vendor/package/..` syntax works, but do you know whether we ever communicated this as API? I think there are edge cases that will result in unexpected issues, e.g., if any TYPO3 extension that is named `typo3` is installed. Reason: extension keys are mapped first, and alias's second: https://github.com/TYPO3/typo3/blob/da29fc6fe375cc03ea870f79697e7a7458de2402/typo3/sysext/core/Classes/Package/PackageManager.php#L296-L300 -
core-ci voted on patch set 7 V +1 04/04/25, 13:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77005
-
Helmut Hummel commented on patch set 7 04/06/25, 20:32
PackageArtifactBuilder.php:242Reply> but it's not retrievable by the name root That is wrong. Composer Runtime API: `\Composer\InstalledVersions::getRootPackage()` > or any other convention Don't know what you mean with that. > Composer semantically defines this as root Composer explicitly names it "root package" in their documentation: https://getcomposer.org/doc/04-schema.md#root-package It is very likely that people a little bit familiar with Composer know this term and it's meaning for Composer projects. > but in TYPO3 the composer root can be two conceptional things I think I grasp how you are looking at it, if so, I agree with your point of of view. I want to propose a different perspective in addition to that. The Composer root package for TYPO3 always is a concrete TYPO3 project. If an extension (more on that later) happens to be the Composer root project, it functions as both: the root of a TYPO3 installation AND as extension. This is useful for extensions under test, but does not have to be limited to that. What defines a TYPO3 extension? Logically any Composer package, that in some way, provides resources to a TYPO3 installation can be considered an extension. Since TYPO3 version 11 and typo3/cms-composer-installers 4. any composer package, that at least defines `extra.typo3/cms` **can** provide resources for a TYPO3 installation. It does **not** have to though. This means any Composer (also root) package with TYPO3 11 and up can provide resources. This change request does not change anything in that regard. What this change also not addresses is the fact, that TYPO3 in most cases does not come with convention **over** configuration, but was extensively built to **only** support conventions for resources. While I would LOVE to change that, doing so in the current state of things is rather a project of months than days. I still think it is achievable step by step and from my perspective there is only one cost: Acceptance of a few "ugly" legacy path structures in the meantime. There is no other technical dept or risk I'm aware of. Enforcing to clean up path structures first however, basically blocks the proposal and the benefits it can deliver now for months or years at worst. What I therefore now suggest as first step (this change request) is: * mitigate most of the ugliness regarding paths, but not everything. * skip aliasing extensions when they are root for now and accept the ugly path structure for now to not break extensions by looking for resources in different base folders. * settle on one name for the alias (go crazy with that name, I don't care, just tell my which one I should use) and ignore the composer name syntax Second step (next change) will be: * make the root package available (auto registered) in non composer mode as well Third step will be: * Start with API syntax and a way to define resources for each extension, so that an extension can e.g. only provide one resource in a configurable way. (I have a rough idea already how this can be done) -
Helmut Hummel commented on patch set 7 04/06/25, 20:42
composer.dist.json:3Reply Unresolved> if we consider this an invalid type in general It is not invalid. It is of type extension. This is the case since basically the first versions of typo3/cms-composer-installers. (extensions are anything starting with `typo3-cms-`) It's only that we enforced that extensions to define an extension key and this was an oversight of me when introducing this composer.json.dist for testing purposes. We can backport this, but I don't think it is a must have.Package.php:161ReplyLet's remove it. I don't mind.Feature-106432-AddAliasForRootPackage.rst:27ReplyI know the theoretical impact and imperfection. I still consider this useful enough to keep it around as is since TYPO3 11 and keep it "private API" for now. -
Helmut Hummel commented on patch set 7 04/06/25, 20:44
PackageArtifactBuilder.php:127UnresolvedThis is wrong and I will revert that! We do **not** want to move backwards and consider ext_emconf.php in Composer mode again. -
Helmut Hummel uploaded patch set 8
V +104/06/25, 20:57Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**") -
core-ci voted on patch set 8 V +1 04/06/25, 21:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77070
-
Benni Mack commented on patch set 8 10/16/25, 18:39
PackageArtifactBuilder.php:242Reply UnresolvedJust a quick update: We now own the public extension keys "app" and "root". I am in favor now of using "app" instead of "root". Two reasons: "app" is more common in the PHP world among developers familiar with Laravel or Symfony. "root" is more technical and also a implementation detail of composer. -
Helmut Hummel abandoned the change 10/27/25, 12:51
I'll abandon this approach for now. Will revisit later