* reland "Refactors global key duplication detection (#46183)" This reverts commit d2b66dbf. * fix test