Page MenuHomePhabricator

Use of EntityRevisionLookup (and other services) from client in the repo may be problematic
Closed, ResolvedPublic

Description

Seems we are now using some services from the client in the repo, due to how the factories and stuff are instantiated.

For EntityRevisionLookup, we have this (with ForbiddenSerializer used in EntityContentDataCodec):

I think the serializer in EntityContentDataCodec might be there to support the old internal serialization format (which exists for entities not edited for a long time, or for old revisions and might be needed for dump generation) and think we still need it.

I am concerned that whatever it does might (silently or in subtle ways) break and that we should be careful about using client services in the repo.

	'EntityRevisionLookup' => function(
		RepositoryServiceContainer $services,
		WikibaseClient $client
	) {
		$codec = new EntityContentDataCodec(
			$services->getEntityIdParser(),
			new ForbiddenSerializer( 'Entity serialization is not supported on the client!' ),
			$services->getEntityDeserializer(),
			$client->getSettings()->getSetting( 'maxSerializedEntitySize' ) * 1024
		);

		/** @var WikiPageEntityMetaDataAccessor $metaDataAccessor */
		$metaDataAccessor = $services->getService( 'WikiPageEntityMetaDataAccessor' );

		return new WikiPageEntityRevisionLookup(
			$codec,
			$metaDataAccessor,
			$services->getDatabaseName()
		);
	},

Event Timeline

Removing from sprint board, since this ticket is not actionable. It is however useful for tracking the issue described, and making sure the introduction of WikibaseServices actually solves it.

Michael claimed this task.
Michael subscribed.

This has been fixed and now tests based on ClientNoBadUsageTest make sure that it is not reintroduced.