Skip to content

Commit 4bb3573

Browse files
authored
fix(ingestion): silence basedpyright McpConnection union narrowing flake (#27834)
The static-checks job intermittently fails with ~35 reportAttributeAccessIssue errors of the form "Cannot access attribute X for class McpConnection" (or CustomDriveConnection). Root cause: basedpyright's --baselinemode=discard matches baseline entries by per-file diagnostic stream order with no line numbers, so any schema regen that shifts a Union arm's narrowing cascade-misaligns downstream baseline matches and surfaces them as new errors. Defer the architectural fix and silence the flake at source: * Pin basedpyright to ==1.39.3 (was ~=1.39.0) so CI no longer pulls a different patch version with a different typeshed bundle on each run. * Add # pyright: ignore[reportAttributeAccessIssue] on the 35 access / assign sites surfaced by the failing CI run. Inline ignores delete the diagnostic from the per-file stream entirely, so they're immune to ordering shifts. reportUnnecessaryTypeIgnoreComment is already disabled in pyproject.toml, so the ignores are inert on platforms where the union narrowing collapses differently and the errors don't fire (macOS arm64). Tableau pipeline client.py library-export errors deferred to that PR's owner; unrelated to this flake.
1 parent 048a15e commit 4bb3573

22 files changed

Lines changed: 36 additions & 36 deletions

File tree

ingestion/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@
401401
"mypy-boto3-glue",
402402
"nox",
403403
"pre-commit",
404-
"basedpyright~=1.39.0",
404+
"basedpyright==1.39.3",
405405
# For publishing
406406
"twine",
407407
"build",

ingestion/src/metadata/automations/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _(
5858

5959
host_port_type = type(request.connection.config.hostPort)
6060
docker_host_port_str = host_port_str.replace("localhost", "host.docker.internal")
61-
request.connection.config.hostPort = host_port_type(docker_host_port_str)
61+
request.connection.config.hostPort = host_port_type(docker_host_port_str) # pyright: ignore[reportAttributeAccessIssue]
6262

6363
_ = _test_connection(metadata, request.connection.config, automation_workflow)
6464

ingestion/src/metadata/ingestion/source/api/rest/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@ def _prepare_endpoint_data(self, path, method_type, info, collection) -> Optiona
210210

211211
def _get_fallback_url(self) -> Optional[AnyUrl]: # noqa: UP045
212212
"""Return openAPISchemaURL if available, otherwise None."""
213-
schema_conn = self.config.serviceConnection.root.config.openAPISchemaConnection
213+
schema_conn = self.config.serviceConnection.root.config.openAPISchemaConnection # pyright: ignore[reportAttributeAccessIssue]
214214
if isinstance(schema_conn, OpenAPISchemaURL):
215215
return schema_conn.openAPISchemaURL
216216
return None
217217

218218
def _generate_collection_url(self, collection_name: str) -> Optional[AnyUrl]: # noqa: UP045
219219
"""generate collection url"""
220220
try:
221-
base_url = self.config.serviceConnection.root.config.docURL
221+
base_url = self.config.serviceConnection.root.config.docURL # pyright: ignore[reportAttributeAccessIssue]
222222
if not base_url:
223223
logger.debug(f"Could not generate collection url for {collection_name} because docURL is not present")
224224
return self._get_fallback_url()

ingestion/src/metadata/ingestion/source/dashboard/mode/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def __init__(
6262
metadata: OpenMetadata,
6363
):
6464
super().__init__(config, metadata)
65-
self.workspace_name = config.serviceConnection.root.config.workspaceName
66-
self.filter_query_param = config.serviceConnection.root.config.filterQueryParam
65+
self.workspace_name = config.serviceConnection.root.config.workspaceName # pyright: ignore[reportAttributeAccessIssue]
66+
self.filter_query_param = config.serviceConnection.root.config.filterQueryParam # pyright: ignore[reportAttributeAccessIssue]
6767
self.data_sources = self.client.get_all_data_sources(self.workspace_name)
6868

6969
@classmethod

ingestion/src/metadata/ingestion/source/dashboard/quicksight/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(self, config: WorkflowSource, metadata: OpenMetadata):
9191
super().__init__(config, metadata)
9292
self.aws_account_id = self.service_connection.awsAccountId
9393
self.dashboard_url = None
94-
self.aws_region = self.config.serviceConnection.root.config.awsConfig.awsRegion
94+
self.aws_region = self.config.serviceConnection.root.config.awsConfig.awsRegion # pyright: ignore[reportAttributeAccessIssue]
9595
self.default_args = {
9696
"AwsAccountId": self.aws_account_id,
9797
"MaxResults": QUICKSIGHT_MAX_RESULTS,

ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,6 @@ def get_base_url(self) -> str:
11171117
"""
11181118
Get the proxy url for the tableau server
11191119
"""
1120-
if self.config.serviceConnection.root.config.proxyURL:
1121-
return str(self.config.serviceConnection.root.config.proxyURL)
1120+
if self.config.serviceConnection.root.config.proxyURL: # pyright: ignore[reportAttributeAccessIssue]
1121+
return str(self.config.serviceConnection.root.config.proxyURL) # pyright: ignore[reportAttributeAccessIssue]
11221122
return str(self.config.serviceConnection.root.config.hostPort)

ingestion/src/metadata/ingestion/source/database/azuresql/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def get_database_names_raw(self) -> Iterable[str]:
7575
yield from self._execute_database_query(AZURE_SQL_GET_DATABASES)
7676

7777
def get_database_names(self) -> Iterable[str]:
78-
if not self.config.serviceConnection.root.config.ingestAllDatabases:
79-
configured_db = self.config.serviceConnection.root.config.database
78+
if not self.config.serviceConnection.root.config.ingestAllDatabases: # pyright: ignore[reportAttributeAccessIssue]
79+
configured_db = self.config.serviceConnection.root.config.database # pyright: ignore[reportAttributeAccessIssue]
8080
self.set_inspector(database_name=configured_db)
8181
yield configured_db
8282
else:

ingestion/src/metadata/ingestion/source/database/cockroach/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def get_database_names_raw(self) -> Iterable[str]:
186186
yield from self._execute_database_query(COCKROACH_GET_DB_NAMES)
187187

188188
def get_database_names(self) -> Iterable[str]:
189-
if not self.config.serviceConnection.root.config.ingestAllDatabases:
190-
configured_db = self.config.serviceConnection.root.config.database
189+
if not self.config.serviceConnection.root.config.ingestAllDatabases: # pyright: ignore[reportAttributeAccessIssue]
190+
configured_db = self.config.serviceConnection.root.config.database # pyright: ignore[reportAttributeAccessIssue]
191191
self.set_inspector(database_name=configured_db)
192192
self.set_schema_description_map()
193193
yield configured_db

ingestion/src/metadata/ingestion/source/database/greenplum/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def get_database_names_raw(self) -> Iterable[str]:
128128
yield from self._execute_database_query(GREENPLUM_GET_DB_NAMES)
129129

130130
def get_database_names(self) -> Iterable[str]:
131-
if not self.config.serviceConnection.root.config.ingestAllDatabases:
132-
configured_db = self.config.serviceConnection.root.config.database
131+
if not self.config.serviceConnection.root.config.ingestAllDatabases: # pyright: ignore[reportAttributeAccessIssue]
132+
configured_db = self.config.serviceConnection.root.config.database # pyright: ignore[reportAttributeAccessIssue]
133133
self.set_inspector(database_name=configured_db)
134134
yield configured_db
135135
else:

ingestion/src/metadata/ingestion/source/database/microsoftfabric/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def get_database_names(self) -> Iterable[str]:
123123
124124
In Microsoft Fabric, each Warehouse and Lakehouse appears as a database.
125125
"""
126-
if not self.config.serviceConnection.root.config.ingestAllDatabases:
127-
configured_db = self.config.serviceConnection.root.config.database
126+
if not self.config.serviceConnection.root.config.ingestAllDatabases: # pyright: ignore[reportAttributeAccessIssue]
127+
configured_db = self.config.serviceConnection.root.config.database # pyright: ignore[reportAttributeAccessIssue]
128128
self.set_inspector(database_name=configured_db)
129129
yield configured_db
130130
else:

0 commit comments

Comments
 (0)