Repository: oppia/oppia

Issue:
Console error when user with given username does not exist
**Describe the bug**
A console error is shown when you try to edit a role of user that doesn't exist, e.g. when you insert a wrong username.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to https://oppiatestserver.appspot.com/admin#/roles
 2. Enter username that doesn't exist
 4. See error in the console

**Observed behavior**
Console error.

**Expected behavior**
Error shown in the webpage explaining that the username is incorrect, even just a toast might be fine


Console error when user with given username does not exist
**Describe the bug**
A console error is shown when you try to edit a role of user that doesn't exist, e.g. when you insert a wrong username.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to https://oppiatestserver.appspot.com/admin#/roles
 2. Enter username that doesn't exist
 4. See error in the console

**Observed behavior**
Console error.

**Expected behavior**
Error shown in the webpage explaining that the username is incorrect, even just a toast might be fine




Discussion:
@vojtechjelinek may I work on this issue?
@DubeySandeep Can you look into this please?
> Error shown in the webpage explaining that the username is incorrect, even just a toast might be fine

We have an error-message field below the username input section, maybe show the error message there for consistency!

Code pointers:

https://github.com/oppia/oppia/blob/4d27b837d506b7e141019c2af1b0902a36c4ed65/core/templates/pages/admin-page/roles-tab/admin-roles-tab.component.ts#L67-L73

Need to handle the error case here and add warning message as needed! 
@DubeySandeep Will you be working on this? This should be fixed before the next release is cut.
@DubeySandeep Friendly ping on this please.
@DubeySandeep any updates here?
@nithusha21 I had discussed this with @vojtechjelinek i.e, I won't be able to create a PR (busy with some other stuff) for this issue and I've added a code pointer on how this could be fixed!
@vojtechjelinek may I work on this issue?
@DubeySandeep Can you look into this please?
> Error shown in the webpage explaining that the username is incorrect, even just a toast might be fine

We have an error-message field below the username input section, maybe show the error message there for consistency!

Code pointers:

https://github.com/oppia/oppia/blob/4d27b837d506b7e141019c2af1b0902a36c4ed65/core/templates/pages/admin-page/roles-tab/admin-roles-tab.component.ts#L67-L73

Need to handle the error case here and add warning message as needed! 
@DubeySandeep Will you be working on this? This should be fixed before the next release is cut.
@DubeySandeep Friendly ping on this please.
@DubeySandeep any updates here?
@nithusha21 I had discussed this with @vojtechjelinek i.e, I won't be able to create a PR (busy with some other stuff) for this issue and I've added a code pointer on how this could be fixed!

Resolving patch:
diff --git a/scripts/run_mypy_checks.py b/scripts/run_mypy_checks.py
--- a/scripts/run_mypy_checks.py
+++ b/scripts/run_mypy_checks.py
@@ -41,86 +41,48 @@
     'core/controllers/',
     'core/domain/action_registry.py',
     'core/domain/action_registry_test.py',
-    'core/domain/activity_jobs_one_off.py',
-    'core/domain/activity_jobs_one_off_test.py',
     'core/domain/activity_services.py',
     'core/domain/activity_services_test.py',
-    'core/domain/activity_validators.py',
-    'core/domain/activity_validators_test.py',
-    'core/domain/app_feedback_report_validators.py',
-    'core/domain/app_feedback_report_validators_test.py',
-    'core/domain/audit_validators.py',
-    'core/domain/audit_validators_test.py',
-    'core/domain/auth_jobs_one_off.py',
-    'core/domain/auth_jobs_one_off_test.py',
     'core/domain/auth_services.py',
     'core/domain/auth_services_test.py',
-    'core/domain/auth_validators.py',
-    'core/domain/auth_validators_test.py',
-    'core/domain/base_model_validators.py',
-    'core/domain/base_model_validators_test.py',
-    'core/domain/beam_job_validators.py',
-    'core/domain/beam_job_validators_test.py',
     'core/domain/blog_services.py',
     'core/domain/blog_services_test.py',
-    'core/domain/blog_validators.py',
-    'core/domain/blog_validators_test.py',
     'core/domain/calculation_registry.py',
     'core/domain/calculation_registry_test.py',
     'core/domain/change_domain.py',
     'core/domain/classifier_services.py',
     'core/domain/classifier_services_test.py',
-    'core/domain/classifier_validators.py',
-    'core/domain/classifier_validators_test.py',
     'core/domain/classroom_services.py',
     'core/domain/classroom_services_test.py',
     'core/domain/collection_domain.py',
     'core/domain/collection_domain_test.py',
-    'core/domain/collection_jobs_one_off.py',
-    'core/domain/collection_jobs_one_off_test.py',
     'core/domain/collection_services.py',
     'core/domain/collection_services_test.py',
-    'core/domain/collection_validators.py',
-    'core/domain/collection_validators_test.py',
     'core/domain/config_services.py',
     'core/domain/config_services_test.py',
-    'core/domain/config_validators.py',
-    'core/domain/config_validators_test.py',
     'core/domain/cron_services.py',
     'core/domain/customization_args_util.py',
     'core/domain/customization_args_util_test.py',
     'core/domain/draft_upgrade_services.py',
     'core/domain/draft_upgrade_services_test.py',
-    'core/domain/email_jobs_one_off.py',
-    'core/domain/email_jobs_one_off_test.py',
     'core/domain/email_manager.py',
     'core/domain/email_manager_test.py',
     'core/domain/email_services.py',
     'core/domain/email_services_test.py',
     'core/domain/email_subscription_services.py',
     'core/domain/email_subscription_services_test.py',
-    'core/domain/email_validators.py',
-    'core/domain/email_validators_test.py',
     'core/domain/event_services.py',
     'core/domain/event_services_test.py',
     'core/domain/exp_domain.py',
     'core/domain/exp_domain_test.py',
     'core/domain/exp_fetchers.py',
     'core/domain/exp_fetchers_test.py',
-    'core/domain/exp_jobs_one_off.py',
-    'core/domain/exp_jobs_one_off_test.py',
     'core/domain/exp_services.py',
     'core/domain/exp_services_test.py',
-    'core/domain/exploration_validators.py',
-    'core/domain/exploration_validators_test.py',
     'core/domain/expression_parser.py',
     'core/domain/expression_parser_test.py',
-    'core/domain/feedback_jobs_one_off.py',
-    'core/domain/feedback_jobs_one_off_test.py',
     'core/domain/feedback_services.py',
     'core/domain/feedback_services_test.py',
-    'core/domain/feedback_validators.py',
-    'core/domain/feedback_validators_test.py',
     'core/domain/fs_domain.py',
     'core/domain/fs_domain_test.py',
     'core/domain/fs_services.py',
@@ -135,14 +97,8 @@
     'core/domain/image_validation_services_test.py',
     'core/domain/improvements_services.py',
     'core/domain/improvements_services_test.py',
-    'core/domain/improvements_validators.py',
-    'core/domain/improvements_validators_test.py',
-    'core/domain/interaction_jobs_one_off.py',
-    'core/domain/interaction_jobs_one_off_test.py',
     'core/domain/interaction_registry.py',
     'core/domain/interaction_registry_test.py',
-    'core/domain/job_validators.py',
-    'core/domain/job_validators_test.py',
     'core/domain/learner_goals_services.py',
     'core/domain/learner_goals_services_test.py',
     'core/domain/learner_playlist_services.py',
@@ -153,12 +109,8 @@
     'core/domain/moderator_services_test.py',
     'core/domain/object_registry.py',
     'core/domain/object_registry_test.py',
-    'core/domain/opportunity_jobs_one_off.py',
-    'core/domain/opportunity_jobs_one_off_test.py',
     'core/domain/opportunity_services.py',
     'core/domain/opportunity_services_test.py',
-    'core/domain/opportunity_validators.py',
-    'core/domain/opportunity_validators_test.py',
     'core/domain/param_domain.py',
     'core/domain/param_domain_test.py',
     'core/domain/platform_feature_services.py',
@@ -171,25 +123,16 @@
     'core/domain/platform_parameter_registry_test.py',
     'core/domain/playthrough_issue_registry.py',
     'core/domain/playthrough_issue_registry_test.py',
-    'core/domain/prod_validation_jobs_one_off.py',
     'core/domain/question_domain.py',
     'core/domain/question_domain_test.py',
     'core/domain/question_fetchers.py',
     'core/domain/question_fetchers_test.py',
-    'core/domain/question_jobs_one_off.py',
-    'core/domain/question_jobs_one_off_test.py',
     'core/domain/question_services.py',
     'core/domain/question_services_test.py',
-    'core/domain/question_validators.py',
-    'core/domain/question_validators_test.py',
     'core/domain/rating_services.py',
     'core/domain/rating_services_test.py',
-    'core/domain/recommendations_jobs_one_off.py',
-    'core/domain/recommendations_jobs_one_off_test.py',
     'core/domain/recommendations_services.py',
     'core/domain/recommendations_services_test.py',
-    'core/domain/recommendations_validators.py',
-    'core/domain/recommendations_validators_test.py',
     'core/domain/rights_manager.py',
     'core/domain/rights_manager_test.py',
     'core/domain/role_services.py',
@@ -204,51 +147,30 @@
     'core/domain/skill_domain_test.py',
     'core/domain/skill_fetchers.py',
     'core/domain/skill_fetchers_test.py',
-    'core/domain/skill_jobs_one_off.py',
-    'core/domain/skill_jobs_one_off_test.py',
     'core/domain/skill_services.py',
     'core/domain/skill_services_test.py',
-    'core/domain/skill_validators.py',
-    'core/domain/skill_validators_test.py',
     'core/domain/state_domain.py',
     'core/domain/state_domain_test.py',
-    'core/domain/statistics_validators.py',
-    'core/domain/statistics_validators_test.py',
     'core/domain/stats_domain.py',
     'core/domain/stats_domain_test.py',
-    'core/domain/stats_jobs_continuous.py',
-    'core/domain/stats_jobs_continuous_test.py',
-    'core/domain/stats_jobs_one_off.py',
-    'core/domain/stats_jobs_one_off_test.py',
     'core/domain/stats_services.py',
     'core/domain/stats_services_test.py',
-    'core/domain/storage_model_audit_jobs_test.py',
     'core/domain/story_domain.py',
     'core/domain/story_domain_test.py',
     'core/domain/story_fetchers.py',
     'core/domain/story_fetchers_test.py',
-    'core/domain/story_jobs_one_off.py',
-    'core/domain/story_jobs_one_off_test.py',
     'core/domain/story_services.py',
     'core/domain/story_services_test.py',
-    'core/domain/story_validators.py',
-    'core/domain/story_validators_test.py',
     'core/domain/subscription_services.py',
     'core/domain/subscription_services_test.py',
     'core/domain/subtopic_page_domain.py',
     'core/domain/subtopic_page_domain_test.py',
     'core/domain/subtopic_page_services.py',
     'core/domain/subtopic_page_services_test.py',
-    'core/domain/subtopic_validators.py',
-    'core/domain/subtopic_validators_test.py',
-    'core/domain/suggestion_jobs_one_off.py',
-    'core/domain/suggestion_jobs_one_off_test.py',
     'core/domain/suggestion_registry.py',
     'core/domain/suggestion_registry_test.py',
     'core/domain/suggestion_services.py',
     'core/domain/suggestion_services_test.py',
-    'core/domain/suggestion_validators.py',
-    'core/domain/suggestion_validators_test.py',
     'core/domain/summary_services.py',
     'core/domain/summary_services_test.py',
     'core/domain/takeout_service.py',
@@ -259,40 +181,26 @@
     'core/domain/topic_domain_test.py',
     'core/domain/topic_fetchers.py',
     'core/domain/topic_fetchers_test.py',
-    'core/domain/topic_jobs_one_off.py',
-    'core/domain/topic_jobs_one_off_test.py',
     'core/domain/topic_services.py',
     'core/domain/topic_services_test.py',
-    'core/domain/topic_validators.py',
-    'core/domain/topic_validators_test.py',
     'core/domain/translatable_object_registry.py',
     'core/domain/translatable_object_registry_test.py',
     'core/domain/translation_fetchers.py',
     'core/domain/translation_fetchers_test.py',
     'core/domain/translation_services.py',
     'core/domain/translation_services_test.py',
-    'core/domain/translation_validators.py',
-    'core/domain/translation_validators_test.py',
     'core/domain/user_domain.py',
     'core/domain/user_domain_test.py',
-    'core/domain/user_jobs_one_off.py',
-    'core/domain/user_jobs_one_off_test.py',
     'core/domain/user_query_domain.py',
     'core/domain/user_query_domain_test.py',
-    'core/domain/user_query_jobs_one_off.py',
-    'core/domain/user_query_jobs_one_off_test.py',
     'core/domain/user_query_services.py',
     'core/domain/user_query_services_test.py',
     'core/domain/user_services.py',
     'core/domain/user_services_test.py',
-    'core/domain/user_validators.py',
-    'core/domain/user_validators_test.py',
     'core/domain/visualization_registry.py',
     'core/domain/visualization_registry_test.py',
     'core/domain/voiceover_services.py',
     'core/domain/voiceover_services_test.py',
-    'core/domain/wipeout_jobs_one_off.py',
-    'core/domain/wipeout_jobs_one_off_test.py',
     'core/domain/wipeout_service.py',
     'core/domain/wipeout_service_test.py',
     'core/platform/storage/cloud_storage_emulator.py',


Test patch:
diff --git a/scripts/linters/test_files/invalid_duplicate_prod_validation_jobs_one_off.py b/scripts/linters/test_files/invalid_duplicate_prod_validation_jobs_one_off.py
deleted file mode 100644
--- a/scripts/linters/test_files/invalid_duplicate_prod_validation_jobs_one_off.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# coding: utf-8
-#
-# Copyright 2019 The Oppia Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Python file with invalid syntax, used by scripts/linters/
-python_linter_test. This file contain duplicate prod one validation job.
-"""
-
-from __future__ import annotations
-
-import collections
-
-from core.platform import models
-
-(user_models,) = (models.Registry.import_models([models.NAMES.user]))
-datastore_services = models.Registry.import_datastore_services()
-
-
-class BaseModelValidator:
-    errors = collections.defaultdict(list)
-    external_instance_details = {}
-
-
-class BaseUserModelValidator(BaseModelValidator):
-    @classmethod
-    def _get_model_id_regex(cls, unused_item):
-        return '^\\d+$'
-
-
-class PendingDeletionRequestModelValidator(BaseUserModelValidator):
-    @classmethod
-    def _get_external_id_relationships(cls, item):
-        return {}
-
-
-MODEL_TO_VALIDATOR_MAPPING = {
-    user_models.PendingDeletionRequestModel: (
-        PendingDeletionRequestModelValidator)
-}
-
-
-class ProdValidationAuditOneOffJobMetaClass(type):
-    _MODEL_AUDIT_ONE_OFF_JOB_NAMES = set()
diff --git a/scripts/run_mypy_checks_test.py b/scripts/run_mypy_checks_test.py
--- a/scripts/run_mypy_checks_test.py
+++ b/scripts/run_mypy_checks_test.py
@@ -113,6 +113,13 @@ def mock_install_mypy_prerequisites(unused_ci):
             run_mypy_checks, 'install_mypy_prerequisites',
             mock_install_mypy_prerequisites)
 
+    def test_all_files_and_folders_in_not_fully_covered_files_exist(
+        self
+    ) -> None:
+        for path in run_mypy_checks.NOT_FULLY_COVERED_FILES:
+            self.assertTrue(
+                os.path.exists(path), msg='"%s" does not exist' % path)
+
     def test_install_third_party_libraries_with_skip_install_as_true(self):
         run_mypy_checks.install_third_party_libraries(True)