What's the problem :
Currently it is possible to upload a File with the same name to Commons and to a local project. This results in the file on the local project appearing instead of the one at Commons (This is as designed behaviour.)
On English Wikipedia there are bots that check for this, and mark affected files with {{shadows commons}} or an approptiate equivalent template.
One of the bots that currently does this uses an SQL query to do this:- https://github.com/greencardamom/Shadows/blob/master/shadows.sql
This query may fail once the changes to Replicas are implemented , as it won't be possible to join tables cross-wiki as is done here. (see https://lists.wikimedia.org/pipermail/cloud/2020-November/001290.html and https://wikitech.wikimedia.org/wiki/News/Wiki_Replicas_2020_Redesign)
What is desired:
A mechanism to do the same checking for 'shadowed' content, using 2 queries that doesn't need the relevant tables to be joined cross wiki.