diff options
author | Moustafa Maher <m.maher@10gen.com> | 2021-06-10 23:55:29 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-14 22:50:10 +0000 |
commit | ac74f7de3c69eb0ba25a42634851c7e39c325f39 (patch) | |
tree | a2a9aece747a7d1a272063fb10276b8d97b798c1 | |
parent | d039e9ca846822b4413457fbbad541a88b5520cf (diff) | |
download | mongo-ac74f7de3c69eb0ba25a42634851c7e39c325f39.tar.gz |
SERVER-55203 Change the stable release tag to r5.0.0-rc0 while checking IDL compatibility
5 files changed, 9 insertions, 104 deletions
diff --git a/buildscripts/idl/checkout_idl_files_from_past_releases.py b/buildscripts/idl/checkout_idl_files_from_past_releases.py index 1e0fd100b1d..0757b027701 100644..100755 --- a/buildscripts/idl/checkout_idl_files_from_past_releases.py +++ b/buildscripts/idl/checkout_idl_files_from_past_releases.py @@ -35,8 +35,7 @@ from typing import List from packaging.version import Version -# TODO (SERVER-55203): Change FIRST_API_V1_RELEASE to r5.0.0-rc0. -FIRST_API_V1_RELEASE = '4.9.0-alpha5' +FIRST_API_V1_RELEASE = '5.0.0-rc0' LOGGER_NAME = 'checkout-idl' LOGGER = logging.getLogger(LOGGER_NAME) diff --git a/buildscripts/idl/idl_check_compatibility.py b/buildscripts/idl/idl_check_compatibility.py index 668a70d7e39..6e0e679720d 100644 --- a/buildscripts/idl/idl_check_compatibility.py +++ b/buildscripts/idl/idl_check_compatibility.py @@ -47,7 +47,7 @@ from typing import Dict, List, Set, Optional, Tuple, Union from idl import parser, syntax, errors, common from idl.compiler import CompilerImportResolver -from idl_compatibility_errors import IDLCompatibilityContext, IDLCompatibilityErrorCollection, dump_errors +from idl_compatibility_errors import IDLCompatibilityContext, IDLCompatibilityErrorCollection ALLOW_ANY_TYPE_LIST: List[str] = [ # This list if only used in unit-tests. @@ -875,9 +875,7 @@ def check_error_reply(old_basic_types_path: str, new_basic_types_path: str, old_idl_file, new_idl_file, old_basic_types_path, new_basic_types_path) - # TODO (SERVER-55203): Remove error_skipped logic. - ctxt.errors.remove_skipped_errors_and_dump_all_errors("ErrorReply", old_basic_types_path, - new_basic_types_path) + ctxt.errors.dump_errors() return ctxt.errors @@ -1030,9 +1028,7 @@ def check_compatibility(old_idl_dir: str, new_idl_dir: str, check_security_access_checks(ctxt, old_cmd.access_check, new_cmd.access_check, old_cmd, new_idl_file_path) - # TODO (SERVER-55203): Remove error_skipped logic. - ctxt.errors.remove_skipped_errors_and_dump_all_errors("Commands", old_idl_dir, new_idl_dir) - + ctxt.errors.dump_errors() return ctxt.errors diff --git a/buildscripts/idl/idl_compatibility_errors.py b/buildscripts/idl/idl_compatibility_errors.py index edf869c180f..5ae62ad9891 100644 --- a/buildscripts/idl/idl_compatibility_errors.py +++ b/buildscripts/idl/idl_compatibility_errors.py @@ -119,42 +119,6 @@ ERROR_ID_COMMAND_DESERIALIZER_NOT_EQUAL = "ID0074" ERROR_ID_COMMAND_PARAMETER_DESERIALIZER_NOT_EQUAL = "ID0075" ERROR_ID_REPLY_FIELD_DESERIALIZER_NOT_EQUAL = "ID0076" -# TODO (SERVER-55203): Remove SKIPPED_COMMANDS logic. -# Any breaking changes added to API V1 before releasing 5.0 should be added to SKIPPED_COMMANDS to -# be skipped from compatibility checking. -SKIPPED_COMMANDS = { - "abortTransaction": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "aggregate": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "authenticate": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "collMod": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD, ERROR_ID_REMOVED_COMMAND_PARAMETER], - "commitTransaction": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "create": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "createIndexes": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "delete": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "drop": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "dropDatabase": [ERROR_ID_NEW_REPLY_FIELD_MISSING, ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "dropIndexes": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "endSessions": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "explain": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "find": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "findAndModify": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "hello": [ - ERROR_ID_ADDED_ACCESS_CHECK_FIELD, - ERROR_ID_OLD_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY - ], - "insert": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "invalidReplySkippedCommand": [ERROR_ID_NEW_REPLY_FIELD_MISSING], - "killCursors": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "listCollections": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "listDatabases": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "listIndexes": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "ping": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "refreshSessions": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "saslContinue": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "saslStart": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], - "update": [ERROR_ID_ADDED_ACCESS_CHECK_FIELD], -} - class IDLCompatibilityCheckerError(Exception): """Base class for all IDL Compatibility Checker exceptions.""" @@ -200,15 +164,6 @@ class IDLCompatibilityError(object): return msg -def dump_errors(header_msg: str, errors: List[IDLCompatibilityError]) -> None: - """Print the list of errors.""" - error_list = [str(error) for error in errors] - print(header_msg + "\n: %s errors:" % (len(error_list))) - for error_msg in error_list: - print("%s\n\n" % error_msg) - print("------------------------------------------------") - - class IDLCompatibilityErrorCollection(object): """Collection of IDL compatibility errors with source context information.""" @@ -258,40 +213,17 @@ class IDLCompatibilityErrorCollection(object): """Get all the errors in the error collection with the command command_name.""" return [a for a in self._errors if a.command_name == command_name] - def extract_skipped_errors(self) -> List[IDLCompatibilityError]: - """Remove all the errors in the error collection that are skipped and return them.""" - skipped_errors = [ - c for c in self._errors - if c.command_name in SKIPPED_COMMANDS and c.error_id in SKIPPED_COMMANDS[c.command_name] - ] - self._errors = [ - c for c in self._errors if not (c.command_name in SKIPPED_COMMANDS - and c.error_id in SKIPPED_COMMANDS[c.command_name]) - ] - return skipped_errors - def to_list(self) -> List[str]: """Return a list of formatted error messages.""" return [str(error) for error in self._errors] def dump_errors(self) -> None: """Print the list of errors.""" - dump_errors("Errors found while checking IDL compatibility", self._errors) - - def remove_skipped_errors_and_dump_all_errors(self, checking_target: str, old_path: str, - new_path: str) -> None: - """Remove skipped errors from errors list and dump skipped and found errors.""" - skipped_errors = self.extract_skipped_errors() - suffix_msg = "for (%s) between old directory (%s) and the new directory (%s)" % ( - checking_target, old_path, new_path) - dump_errors( - "(Note: Skipped errors should be fixed before 5.0 release as it won't be skipped" + - " after.)\n" + "Errors skipped while checking IDL compatibility " + suffix_msg, - skipped_errors) - dump_errors("Errors found while checking IDL compatibility " + suffix_msg, self._errors) - print("(Note: Any breaking changes added to API V1 before releasing 5.0 should be added to " - + "SKIPPED_COMMANDS list at (/buildscripts/idl/idl_compatibility_errors.py) to be " + - "skipped from compatibility checking.)") + error_list = self.to_list() + print("Errors found while checking IDL compatibility: %s errors:" % (len(error_list))) + for error_msg in error_list: + print("%s\n\n" % error_msg) + print("------------------------------------------------") def count(self) -> int: """Return the count of errors.""" diff --git a/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl b/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl index 01da70b3e8c..21aa946f117 100644 --- a/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl +++ b/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl @@ -2274,17 +2274,6 @@ commands: type: array<StructType> reply_type: ArrayTypeStruct - # TODO (SERVER-55203): Remove InvalidReplySkippedCommand. - InvalidReplySkippedCommand: - description: "new command should fail because it has invalid reply, but this command will - be added to skipped command list." - command_name: invalidReplySkippedCommand - namespace: ignored - cpp_name: InvalidReplySkippedCommand - strict: true - api_version: "1" - reply_type: OkReply - accessCheckTypeChange: description: "new command fails because the access check type has changed" command_name: accessCheckTypeChange diff --git a/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl b/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl index dabaeccbddc..e378d846b26 100644 --- a/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl +++ b/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl @@ -2347,17 +2347,6 @@ commands: type: array<ArrayTypeStruct> reply_type: ArrayTypeStruct - # TODO (SERVER-55203): Remove InvalidReplySkippedCommand. - InvalidReplySkippedCommand: - description: "new command should fail because it has invalid reply, but this command will - be added to skipped command list." - command_name: invalidReplySkippedCommand - namespace: ignored - cpp_name: InvalidReplySkippedCommand - strict: true - api_version: "1" - reply_type: NotStructFieldReply - accessCheckTypeChange: description: "new command fails because the access check type has changed" command_name: accessCheckTypeChange |