Skip to content

fix(ingestion): silence basedpyright McpConnection flake - #27834

Merged
pmbrull merged 1 commit into
mainfrom
fix/basedpyright-mcpconnection-flake
Apr 30, 2026
Merged

pmbrull merged 1 commit into
mainfrom
fix/basedpyright-mcpconnection-flake

Conversation

@IceS2

@IceS2 IceS2 commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Pin basedpyright==1.39.3 (was ~=1.39.0) to remove patch-version / typeshed drift as a future flake source.
  • Add # pyright: ignore[reportAttributeAccessIssue] on 35 access / assign sites surfaced by the failing CI run; deletes the diagnostics from each per-file stream so the baseline can no longer drift them.

Why

CI's Run Static Checks step intermittently fails with ~35 reportAttributeAccessIssue errors of the form Cannot access attribute X for class "McpConnection" (or CustomDriveConnection). The errors are not new code — the underlying type holes have always been there — but 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.

Inline ignores are position-stable: they delete the diagnostic from the stream entirely, so they survive future Union ordering shifts. The proper architectural fix (class-level service_connection: <X>Connection narrowing on each connector source class, plus long-path → self.service_connection refactors) is deferred — when narrowing succeeds, it exposes a second-order cascade of pre-existing Optional-chain issues that need their own audit.

reportUnnecessaryTypeIgnoreComment is already disabled in pyproject.toml (per the existing comment about cross-platform stub drift), so the ignores are inert on platforms where the union narrowing collapses differently and the errors don't fire (macOS arm64).

The 3 tableauserverclient library-export errors at pipeline/tableaupipeline/client.py:19,21,22 are a separate, unrelated issue (third-party packaging bug); deferred to that PR's owner.

Test plan

  • ruff check clean
  • ruff format --check clean (zero file changes from format pass)
  • basedpyright --baselinefile .basedpyright/baseline.json --baselinemode=discard --pythonplatform Linux produces an identical 62-error set before and after the changes — zero new errors introduced
  • basedpyright without baseline reports 0 mentions of for class "McpConnection" or for class "CustomDriveConnection" on Linux + Darwin platforms
  • CI's Run Static Checks (3.10) job passes on this PR

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.
Copilot AI review requested due to automatic review settings April 29, 2026 19:30
@IceS2
IceS2 requested a review from a team as a code owner April 29, 2026 19:30
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Apr 29, 2026
@gitar-bot

gitar-bot Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

Silences the basedpyright McpConnection flake by adjusting the type annotation. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes ingestion static type-checking by pinning the basedpyright dev dependency and adding targeted pyright inline ignores to prevent intermittent CI failures from baseline diagnostic stream drift.

Changes:

  • Pin basedpyright to an exact patch version (==1.39.3) in ingestion dev dependencies.
  • Add # pyright: ignore[reportAttributeAccessIssue] to specific attribute access/assignment sites that intermittently surface in CI due to union-narrowing/baseline ordering drift.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ingestion/src/metadata/workflow/ingestion.py Adds pyright ignores for supportsProfiler and custom connector class import access paths.
ingestion/src/metadata/utils/helpers.py Adds pyright ignore for hostPort reassignment in the Docker-host retry helper.
ingestion/src/metadata/profiler/source/database/mssql/profiler_source.py Adds pyright ignore for reading MSSQL connection scheme.
ingestion/src/metadata/ingestion/source/security/security_service.py Adds pyright ignore for normalizing hostPort via clean_uri.
ingestion/src/metadata/ingestion/source/database/vertica/query_parser.py Adds pyright ignores for reading/mutating database during multi-db iteration.
ingestion/src/metadata/ingestion/source/database/vertica/metadata.py Adds pyright ignore for reading configured database.
ingestion/src/metadata/ingestion/source/database/timescale/query_parser.py Adds pyright ignores for reading/mutating database during multi-db iteration.
ingestion/src/metadata/ingestion/source/database/snowflake/metadata.py Adds pyright ignore for reading configured database.
ingestion/src/metadata/ingestion/source/database/redshift/metadata.py Adds pyright ignores for ingestAllDatabases / database access in get_database_names.
ingestion/src/metadata/ingestion/source/database/postgres/query_parser.py Adds pyright ignores for reading/mutating database during multi-db iteration.
ingestion/src/metadata/ingestion/source/database/postgres/metadata.py Adds pyright ignores for ingestAllDatabases / database access in get_database_names.
ingestion/src/metadata/ingestion/source/database/mssql/metadata.py Adds pyright ignores for ingestAllDatabases / database access in get_database_names.
ingestion/src/metadata/ingestion/source/database/microsoftfabric/metadata.py Adds pyright ignores for ingestAllDatabases / database access in get_database_names.
ingestion/src/metadata/ingestion/source/database/greenplum/metadata.py Adds pyright ignores for ingestAllDatabases / database access in get_database_names.
ingestion/src/metadata/ingestion/source/database/cockroach/metadata.py Adds pyright ignores for ingestAllDatabases / database access in get_database_names.
ingestion/src/metadata/ingestion/source/database/azuresql/metadata.py Adds pyright ignores for ingestAllDatabases / database access in get_database_names.
ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py Adds pyright ignores for proxyURL access when building base URL.
ingestion/src/metadata/ingestion/source/dashboard/quicksight/metadata.py Adds pyright ignore for nested awsConfig.awsRegion access.
ingestion/src/metadata/ingestion/source/dashboard/mode/metadata.py Adds pyright ignores for workspaceName / filterQueryParam access.
ingestion/src/metadata/ingestion/source/api/rest/metadata.py Adds pyright ignores for OpenAPI connection/doc URL attribute access.
ingestion/src/metadata/automations/runner.py Adds pyright ignore for hostPort reassignment in docker-host fallback.
ingestion/setup.py Pins basedpyright to ==1.39.3 in the dev dependency set.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'open-metadata-ingestion'

Failed conditions
40.0% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (11 flaky)

✅ 3987 passed · ❌ 0 failed · 🟡 11 flaky · ⏭️ 86 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 297 0 2 4
🟡 Shard 2 751 0 3 8
🟡 Shard 3 745 0 1 7
🟡 Shard 4 774 0 1 18
✅ Shard 5 687 0 0 41
🟡 Shard 6 733 0 4 8
🟡 11 flaky test(s) (passed on retry)
  • Pages/AuditLogs.spec.ts › should apply both User and EntityType filters simultaneously (shard 1, 1 retry)
  • Pages/Bots.spec.ts › Bots Page should work properly (shard 1, 1 retry)
  • Features/ActivityAPI.spec.ts › Activity event is created when description is updated (shard 2, 1 retry)
  • Features/ActivityAPI.spec.ts › Activity event shows the actor who made the change (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Table (shard 2, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Pages/DataProductAndSubdomains.spec.ts › Add assets to data product and verify count (shard 4, 1 retry)
  • Pages/Glossary.spec.ts › Column dropdown drag-and-drop functionality for Glossary Terms table (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/Users.spec.ts › Check permissions for Data Steward (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@pmbrull
pmbrull merged commit 4bb3573 into main Apr 30, 2026
52 of 53 checks passed
@pmbrull
pmbrull deleted the fix/basedpyright-mcpconnection-flake branch April 30, 2026 05:35
jatinmasaram pushed a commit to jatinmasaram/OpenMetadata that referenced this pull request May 2, 2026
…ake (open-metadata#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.
jaya6400 pushed a commit to jaya6400/OpenMetadata that referenced this pull request May 4, 2026
…ake (open-metadata#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.
pmbrull pushed a commit that referenced this pull request Aug 28, 2026
* fix(ci): restore the python pipeline on 1.13

PRs targeting 1.13 are validated by main's workflow definitions: the
`pull_request_target` event resolves workflows from the default branch,
while `actions/checkout` puts the 1.13 tree on disk. main's
`py-tests-shared.yml` therefore runs against a checkout that is missing
files it depends on, and every python job goes red regardless of the
diff -- #32154, a Java-only backport, failed identically to #32166.

Three gaps are fixable from this branch:

* `.github/scripts/` does not exist on 1.13 at all. `classify_test_outcome.py`
  exits 2 *after* the tests pass (a postgres shard logged `101 passed` and
  `nox > Session integration-tests was successful`, then failed the job), and
  `configure_docker_storage.sh` exits 127, killing shards 2 and 3 before they
  download anything. Both scripts are copied verbatim from main; they are
  stdlib-only Python and plain bash with no new dependencies. The globs they
  read resolve here -- noxfile.py writes junit/test-results-unit.xml and
  junit/test-results-integration.xml.

* `basedpyright~=1.39.0` floats onto 1.39.10 (released 2026-08-13), which
  reports ~428 errors against this branch's baseline. main pinned
  `==1.39.3` in #27834 to stop exactly this; only the pin is taken here,
  since the rest of that commit conflicts across seven files.

* tests/unit/source/pipeline/openlineage/ is not a package, so its
  test_connection.py collides with the one under
  tests/unit/metadata/ingestion/connections/ and pytest intermittently
  reports `import file mismatch`. main disambiguates with __init__.py.
  Only the leaf marker is added -- enough to make the module name unique
  without renaming every module under tests/unit/source/.

The spaCy 3.8 model mismatch and the ruff-only checkstyle install cannot
be fixed from here; both need main's workflows to probe the checkout.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(integration): make the airflow, alationsink and ometa tests self-sufficient

Backport of the test half of #32145 (2.0, c1e9302). PRs based on 1.13 are
validated by main's py-tests-shared.yml, which brings the stack up with
`-i false` — no openmetadata_ingestion container, so no Airflow on :8080 and
no sample-data DAGs. These three suites still depended on both and failed
deterministically: four alationsink cases on shard-2, three
test_airflow_lineage cases plus test_es_search_from_name on shard-3, across
every Python version.

 - airflow: a conftest that builds and runs Airflow in a testcontainer joined
   to ometa_network, so the suite owns its DAGs and connection. apache-airflow
   3.3.0 matches this branch's setup.py, the same pin 2.0 uses.
 - alationsink: build the service, database, schema and tables under test
   instead of reading sample_data.ecommerce_db.
 - ometa: a test_team_data fixture creating the "Data" team that
   test_es_search_from_name asserts on.

.dockerignore keeps the airflow image's build context to src/, and only
applies to builds whose context is ingestion/ — every other image builds from
the repository root with the top-level ignore file.

The upstream commit's ingestion/src changes are deliberately omitted: its
PLC0415 annotations and dbt/dbtcloud/vertica suppressions target 2.0's ruff
and 2.0's basedpyright baseline, neither of which applies here. Its
test_ometa_user_api reformatting is also dropped — only the fixture is taken,
so the file stays black-conformant on this branch.

Does not address shard-2's datalake failures (a 400 on recursive service
delete when Airflow is absent), shard-3's trino NO_NODES_AVAILABLE errors, or
test_s3_ingestion.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(integration): fix the trino readiness race and a stale s3 assertion

trino (shard-3, 38 errors): the container readiness probe queried
system.runtime.nodes, which the system connector answers on every active node
before any catalog can be scheduled. The fixture proceeded and the first
ANALYZE failed with NO_NODES_AVAILABLE, erroring every test in the package.
Probe a real catalog instead, and replace the flat sleep(1) between write and
ANALYZE with a read-back that retries while the hive split is still lagging.
Pin the hive-metastore image by digest so :latest cannot drift under a
maintenance branch.

Only the readiness half of main's trino rework is taken. Its move of drop_stats
into a reset_trino_table_statistics fixture, the folding of test_no_statistics
into test_profiler, and the removal of test_empty_table_with_dropped_stats_falls_back
are a coverage redesign rather than a CI fix, so this branch keeps its global
drop_stats call and all three tests unchanged. Nothing in the trino connector
source is touched.

s3 (shard-3, 1 failed): the container payload no longer inlines children, so
`assert 7 == len(bucket.children.root)` raised AttributeError. The next line
already asserts the same count through list_container_children. The
"Invalid STS API version" logged nearby is the non-mandatory GetMetrics step of
the S3 test connection and fails nothing.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(tests): profile in setUpClass so test_list_entity_profiles has data (#31882)

pytest orders unittest TestCase methods alphabetically, so
test_list_entity_profiles runs first -- before test_profiler_workflow has
created any profile. The module sets TestLoader.sortTestMethodsUsing = None
to force definition order, but that only affects unittest's own loader:
pytest collects TestCase methods itself and ignores it. Verified against an
unmodified checkout -- collection still yields list_entity_profiles first
with that line in place, so it has never had any effect here.

The test still passed, because it asserts on a global 24h window across
every table rather than on data it owns, and hard-deleted tables used to
leak their profiler rows into that window. #31556 stopped that leak (issue
"0 not greater than 0" on every PR that actually runs the ingestion
integration matrix, blocking the merge queue. PRs that do not touch
ingestion skip the matrix and report green, which is why this looked
branch-specific rather than repo-wide.

Run the profiler in setUpClass, where fixture data belongs, so no test
depends on another's ordering. Drop the ineffective loader hack, and turn
the `if profiles_all.entities:` guard into an assertion -- that guard
swallowed an empty unfiltered listing and hid which of the two calls was
actually empty, which is the signal needed to diagnose this.

* fix(ci): stabilize remaining 1.13 Python checks

* fix(ci): align 1.13 Python tests with CI

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: IceS2 <[email protected]>
Co-authored-by: Himanshu Khairajani <[email protected]>
Co-authored-by: Pablo Takara <[email protected]>

This branch was previously deployed

1 inactive deployment
test — 42676498 Deployed Apr 29, 2026 by IceS2 via playwright-ci-postgresql (2, 6) #44964
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants