Page MenuHomePhabricator

Librarize includes/services/
Closed, ResolvedPublic

Description

The contents of includes/services/ (ServiceContainer and friends) do not use any MediaWiki-specific code, as far as I can tell, except for the Assert library. As such, they could be moved to the includes/libs/ directory, to signal this fact more clearly, or even extracted into a separate library published to Packagist.

MediaWiki:

Library:

  • Create repo.
  • Verify GitHub mirror.
  • Set up WMF CI.
  • Set up Packagist hook.
  • Set up code coverage pipeline.
  • Set up doxygen pipeline.
  • Add lib to doc.wikimedia.org.

Event Timeline

Change 478729 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/core@master] Move includes/services/ into includes/libs/

https://gerrit.wikimedia.org/r/478729

Change 479747 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Adjust for Wikimedia\Services move

https://gerrit.wikimedia.org/r/479747

Change 479748 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Adjust for Wikimedia\Services move

https://gerrit.wikimedia.org/r/479748

Change 479749 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/BlueSpiceFoundation@master] Adjust for Wikimedia\Services move

https://gerrit.wikimedia.org/r/479749

Change 478729 merged by jenkins-bot:
[mediawiki/core@master] Fully extract services framework as a library

https://gerrit.wikimedia.org/r/478729

Change 479748 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Adjust for Wikimedia\Services move

https://gerrit.wikimedia.org/r/479748

Change 479747 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Adjust for Wikimedia\Services move

https://gerrit.wikimedia.org/r/479747

What do we want to name the library? "Services"? "ServiceContainer"? I like the latter because it's much harder to confuse it with the nodejs services we have.

It's now in Wikimedia\Services. ServiceContainer may work though it's a bit too narrow. It would be nice to somehow indicate that this is about in-process service interfaces and DI infrastructure. On the other hand, this is indeed the view that PHP code should have of any node.js services it wants to call. So from PHP's perspective, "services" is correct.

Anyway, it's merged now. The library name should be the same as the namespace name, to avoid confusion. We can change the namespace name, but it would have to happen quickly, before extensions start using it.

It's now in Wikimedia\Services. ServiceContainer may work though it's a bit too narrow. It would be nice to somehow indicate that this is about in-process service interfaces and DI infrastructure. On the other hand, this is indeed the view that PHP code should have of any node.js services it wants to call. So from PHP's perspective, "services" is correct.

It could also be a nonsense/unique name (e.g. "pimple")

Or something distantly related/play on words of "service"..."Ace" (the sports usage of service), "Cutlery" (the dishes/utensils usage of service). I like "Ace" now.

Anyway, it's merged now. The library name should be the same as the namespace name, to avoid confusion. We can change the namespace name, but it would have to happen quickly, before extensions start using it.

It hasn't been included in a stable release yet, so we still have time to change it. We'll have to provide a compat layer anyways (includes/compat/).

Can we backronym "Ace"? "Augmentable Container Environment"?... naw...

Change 479749 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceFoundation@master] Adjust for Wikimedia\Services move

https://gerrit.wikimedia.org/r/479749

Change 518198 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/libs/Services@master] Initial import from MediaWiki core

https://gerrit.wikimedia.org/r/518198

Legoktm renamed this task from Move includes/services/ into includes/libs/ to Librarize includes/services/.Jun 21 2019, 6:13 AM

Change 518198 merged by jenkins-bot:
[mediawiki/libs/Services@master] Initial import from MediaWiki core

https://gerrit.wikimedia.org/r/518198

@Legoktm nice, thanks! Should extensions also be updated to require that new library in composer.json?

Change 608461 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/vendor@master] Add wikimedia/services 2.0.1

https://gerrit.wikimedia.org/r/c/mediawiki/vendor/ /608461

Change 608462 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] Use wikimedia/services 2.0.1

https://gerrit.wikimedia.org/r/c/mediawiki/core/ /608462

@Legoktm nice, thanks! Should extensions also be updated to require that new library in composer.json?

No. MediaWiki core will provide the library for extensions to use (though I would think that extensions would depend on MediaWikiServices rather than the underlying container implementation...).

@Legoktm should ServiceOptions also be moved to the new library? Or even to its own library, since it may have valid uses outside of a "service"?

@Legoktm should ServiceOptions also be moved to the new library? Or even to its own library, since it may have valid uses outside of a "service"?

ServiceOptions is dependent on the \Config class, so I don't think it's appropriate to librarize...or at least put in this library. Also, now that I look at the ServiceOptions class, I'm not the biggest fan of it, but that's another task.

Change 608461 merged by jenkins-bot:
[mediawiki/vendor@master] Add wikimedia/services 2.0.1

https://gerrit.wikimedia.org/r/c/mediawiki/vendor/ /608461

Change 608462 merged by jenkins-bot:
[mediawiki/core@master] Use wikimedia/services 2.0.1

https://gerrit.wikimedia.org/r/c/mediawiki/core/ /608462

Change 608910 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[integration/docroot@master] doc: Add Services PHP library

https://gerrit.wikimedia.org/r/c/integration/docroot/ /608910

@Legoktm should ServiceOptions also be moved to the new library? Or even to its own library, since it may have valid uses outside of a "service"?

ServiceOptions is dependent on the \Config class, so I don't think it's appropriate to librarize...or at least put in this library. Also, now that I look at the ServiceOptions class, I'm not the biggest fan of it, but that's another task.

For reference, this is now T256898: Reconsider usage of ServiceOptions.

Change 608910 merged by jenkins-bot:
[integration/docroot@master] doc: Add Services PHP library

https://gerrit.wikimedia.org/r/c/integration/docroot/ /608910

Legoktm updated the task description. (Show Details)