anchor.diff:        // TODO: trigger consistency mitigation if more than one email exists
         if (usersWithEmail.length == 1 &&
             usersWithEmail.single.oauthUserId == null) {
  +        // Handle legacy logins that don't have 'openid' scope, and thus, no
  +        // user_id (oauthUserId), these can't be upgraded yet.
  +        if (auth.oauthUserId == null) {
  +          return usersWithEmail.single;
  +        }
  +
           // We've found a single pre-migrated User with empty oauthUserId: need
           // to create OAuthUserID for it.
           final updatedUser = await _db.withTransaction((tx) async {
  
positive.code:         return updatedUser;
        }
  
        final newUser = User()
          ..parentKey = _db.emptyKey
          ..id = _uuid.v4().toString()
  
negative.code:     final mappingKey = _db.emptyKey.append(OAuthUserID, id: auth.oauthUserId);
  
      final user = await retry(() async {
        // Handle legacy logins that don't have 'openid' scope
        if (auth.oauthUserId != null) {
          // Check existing mapping.
          final mapping = (await _db.lookup<OAuthUserID>([mappingKey])).single;
          if (mapping != null) {
            final user = (await _db.lookup<User>([mapping.userIdKey])).single;
            // TODO: we should probably have some kind of consistency mitigation
            if (user == null) {
              throw Exception('Incomplete OAuth userId mapping: '
                  'missing User (`${mapping.userId}`) referenced by `${mapping.id}`.');
            }
            return user;
          }
        }
  
        // Check pre-migrated User with existing email.
  