We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Detecting and alerting of duplication keys/components/entries in YAML file
### Is your feature request related to a problem? Please describe

it was found in release 1.3.11 , a PR to update [manifest](https://github.com/opensearch-project/opensearch-build/blob/main/manifests/1.3.11/opensearch-1.3.11.yml) has duplicated components name.
It would cause the resource wasted on CI to rebuild the duplicated components 

### Describe the solution you'd like

We want to have a check to detect if there is any duplication entries based on keys/components/names and probably fail the GitHub check

### Describe alternatives you've considered

Manually check for duplicate values

### Acceptance Criteria
* The manifest check should fail at CI level for components with duplicate components.name values in opensearch and opensearch-dashboard as well as test manifests. See what are [manifests](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution#what-are-manifests)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/ci_workflow/ci_manifests.py`
Content:
```
1 # Copyright OpenSearch Contributors
2 # SPDX-License-Identifier: Apache-2.0
3 #
4 # The OpenSearch Contributors require contributions made to
5 # this file be licensed under the Apache-2.0 license or a
6 # compatible open source license.
7 
8 
9 import re
10 from collections import Counter
11 from io import TextIOWrapper
12 from typing import Type, Union
13 
14 import yaml
15 
16 from ci_workflow.ci_args import CiArgs
17 from ci_workflow.ci_input_manifest import CiInputManifest
18 from ci_workflow.ci_test_manifest import CiTestManifest
19 
20 
21 class CiManifests:
22     @staticmethod
23     def __klass(filename: str) -> Union[Type[CiTestManifest], Type[CiInputManifest]]:
24         if re.search("-test.yml$", filename):
25             return CiTestManifest
26         else:
27             return CiInputManifest
28 
29     @staticmethod
30     def __get_duplicate_component_names(count_component_names: Counter) -> list:
31         duplicate_component_names = []
32         for component_name, count in count_component_names.items():
33             if count > 1:
34                 duplicate_component_names.append(component_name)
35         return duplicate_component_names
36 
37     @staticmethod
38     def __check_duplicate_component_names(file: TextIOWrapper) -> None:
39         yaml_dict = yaml.safe_load(file)
40         component_names = []
41         for component in yaml_dict['components']:
42             component_names.append(component['name'])
43         count_component_names = Counter(component_names)
44 
45         if set(count_component_names.values()) != set([1]):
46             duplicate_component_names = CiManifests.__get_duplicate_component_names(count_component_names)
47             duplicate_component_names_string = ', '.join(duplicate_component_names)
48             raise ValueError(f"Found {duplicate_component_names_string} as a duplicate component(s) in manifest {file.name}. ")
49         file.seek(0)
50 
51     @classmethod
52     def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Union[CiTestManifest, CiInputManifest]:
53         cls.__check_duplicate_component_names(file)
54         return cls.__klass(file.name)(file, args)
55
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/ci_workflow/ci_manifests.py b/src/ci_workflow/ci_manifests.py
--- a/src/ci_workflow/ci_manifests.py
+++ b/src/ci_workflow/ci_manifests.py
@@ -26,25 +26,16 @@
         else:
             return CiInputManifest
 
-    @staticmethod
-    def __get_duplicate_component_names(count_component_names: Counter) -> list:
-        duplicate_component_names = []
-        for component_name, count in count_component_names.items():
-            if count > 1:
-                duplicate_component_names.append(component_name)
-        return duplicate_component_names
-
     @staticmethod
     def __check_duplicate_component_names(file: TextIOWrapper) -> None:
         yaml_dict = yaml.safe_load(file)
         component_names = []
         for component in yaml_dict['components']:
             component_names.append(component['name'])
-        count_component_names = Counter(component_names)
 
-        if set(count_component_names.values()) != set([1]):
-            duplicate_component_names = CiManifests.__get_duplicate_component_names(count_component_names)
-            duplicate_component_names_string = ', '.join(duplicate_component_names)
+        duplicate_component_names = [comp for comp, count in Counter(component_names).items() if count > 1]
+        duplicate_component_names_string = ', '.join(duplicate_component_names)
+        if len(duplicate_component_names) > 0:
             raise ValueError(f"Found {duplicate_component_names_string} as a duplicate component(s) in manifest {file.name}. ")
         file.seek(0)

{"golden_diff": "diff --git a/src/ci_workflow/ci_manifests.py b/src/ci_workflow/ci_manifests.py\n--- a/src/ci_workflow/ci_manifests.py\n+++ b/src/ci_workflow/ci_manifests.py\n@@ -26,25 +26,16 @@\n         else:\n             return CiInputManifest\n \n-    @staticmethod\n-    def __get_duplicate_component_names(count_component_names: Counter) -> list:\n-        duplicate_component_names = []\n-        for component_name, count in count_component_names.items():\n-            if count > 1:\n-                duplicate_component_names.append(component_name)\n-        return duplicate_component_names\n-\n     @staticmethod\n     def __check_duplicate_component_names(file: TextIOWrapper) -> None:\n         yaml_dict = yaml.safe_load(file)\n         component_names = []\n         for component in yaml_dict['components']:\n             component_names.append(component['name'])\n-        count_component_names = Counter(component_names)\n \n-        if set(count_component_names.values()) != set([1]):\n-            duplicate_component_names = CiManifests.__get_duplicate_component_names(count_component_names)\n-            duplicate_component_names_string = ', '.join(duplicate_component_names)\n+        duplicate_component_names = [comp for comp, count in Counter(component_names).items() if count > 1]\n+        duplicate_component_names_string = ', '.join(duplicate_component_names)\n+        if len(duplicate_component_names) > 0:\n             raise ValueError(f\"Found {duplicate_component_names_string} as a duplicate component(s) in manifest {file.name}. \")\n         file.seek(0)\n", "issue": "Detecting and alerting of duplication keys/components/entries in YAML file\n### Is your feature request related to a problem? Please describe\r\n\r\nit was found in release 1.3.11 , a PR to update [manifest](https://github.com/opensearch-project/opensearch-build/blob/main/manifests/1.3.11/opensearch-1.3.11.yml) has duplicated components name.\r\nIt would cause the resource wasted on CI to rebuild the duplicated components \r\n\r\n### Describe the solution you'd like\r\n\r\nWe want to have a check to detect if there is any duplication entries based on keys/components/names and probably fail the GitHub check\r\n\r\n### Describe alternatives you've considered\r\n\r\nManually check for duplicate values\r\n\r\n### Acceptance Criteria\r\n* The manifest check should fail at CI level for components with duplicate components.name values in opensearch and opensearch-dashboard as well as test manifests. See what are [manifests](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution#what-are-manifests)\n", "before_files": [{"content": "# Copyright OpenSearch Contributors\n# SPDX-License-Identifier: Apache-2.0\n#\n# The OpenSearch Contributors require contributions made to\n# this file be licensed under the Apache-2.0 license or a\n# compatible open source license.\n\n\nimport re\nfrom collections import Counter\nfrom io import TextIOWrapper\nfrom typing import Type, Union\n\nimport yaml\n\nfrom ci_workflow.ci_args import CiArgs\nfrom ci_workflow.ci_input_manifest import CiInputManifest\nfrom ci_workflow.ci_test_manifest import CiTestManifest\n\n\nclass CiManifests:\n    @staticmethod\n    def __klass(filename: str) -> Union[Type[CiTestManifest], Type[CiInputManifest]]:\n        if re.search(\"-test.yml$\", filename):\n            return CiTestManifest\n        else:\n            return CiInputManifest\n\n    @staticmethod\n    def __get_duplicate_component_names(count_component_names: Counter) -> list:\n        duplicate_component_names = []\n        for component_name, count in count_component_names.items():\n            if count > 1:\n                duplicate_component_names.append(component_name)\n        return duplicate_component_names\n\n    @staticmethod\n    def __check_duplicate_component_names(file: TextIOWrapper) -> None:\n        yaml_dict = yaml.safe_load(file)\n        component_names = []\n        for component in yaml_dict['components']:\n            component_names.append(component['name'])\n        count_component_names = Counter(component_names)\n\n        if set(count_component_names.values()) != set([1]):\n            duplicate_component_names = CiManifests.__get_duplicate_component_names(count_component_names)\n            duplicate_component_names_string = ', '.join(duplicate_component_names)\n            raise ValueError(f\"Found {duplicate_component_names_string} as a duplicate component(s) in manifest {file.name}. \")\n        file.seek(0)\n\n    @classmethod\n    def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Union[CiTestManifest, CiInputManifest]:\n        cls.__check_duplicate_component_names(file)\n        return cls.__klass(file.name)(file, args)\n", "path": "src/ci_workflow/ci_manifests.py"}], "after_files": [{"content": "# Copyright OpenSearch Contributors\n# SPDX-License-Identifier: Apache-2.0\n#\n# The OpenSearch Contributors require contributions made to\n# this file be licensed under the Apache-2.0 license or a\n# compatible open source license.\n\n\nimport re\nfrom collections import Counter\nfrom io import TextIOWrapper\nfrom typing import Type, Union\n\nimport yaml\n\nfrom ci_workflow.ci_args import CiArgs\nfrom ci_workflow.ci_input_manifest import CiInputManifest\nfrom ci_workflow.ci_test_manifest import CiTestManifest\n\n\nclass CiManifests:\n    @staticmethod\n    def __klass(filename: str) -> Union[Type[CiTestManifest], Type[CiInputManifest]]:\n        if re.search(\"-test.yml$\", filename):\n            return CiTestManifest\n        else:\n            return CiInputManifest\n\n    @staticmethod\n    def __check_duplicate_component_names(file: TextIOWrapper) -> None:\n        yaml_dict = yaml.safe_load(file)\n        component_names = []\n        for component in yaml_dict['components']:\n            component_names.append(component['name'])\n\n        duplicate_component_names = [comp for comp, count in Counter(component_names).items() if count > 1]\n        duplicate_component_names_string = ', '.join(duplicate_component_names)\n        if len(duplicate_component_names) > 0:\n            raise ValueError(f\"Found {duplicate_component_names_string} as a duplicate component(s) in manifest {file.name}. \")\n        file.seek(0)\n\n    @classmethod\n    def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Union[CiTestManifest, CiInputManifest]:\n        cls.__check_duplicate_component_names(file)\n        return cls.__klass(file.name)(file, args)\n", "path": "src/ci_workflow/ci_manifests.py"}]}