Repository navigation
chore(python): modernize typing and enforce lazy logging - #31643
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
✅ Playwright Results — workflow succeededValidated commit ✅ 616 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 56m 22s ⏱️ Max setup 4m 36s · max shard execution 15m 27s · max shard-job elapsed before upload 19m 44s · reporting 6s 🌐 220.61 requests/attempt · 2.75 app boots/UI scenario · 7.12% common-shard skew Optimization targets still in progress:
🟡 2 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
|
Too many files changed for review (987 files, 100 file limit). |
…n-typing-logging # Conflicts: # ingestion/src/metadata/ingestion/models/topology.py # ingestion/src/metadata/ingestion/ometa/mixins/feed_mixin.py # ingestion/src/metadata/ingestion/source/api/rest/metadata.py # ingestion/src/metadata/ingestion/source/dashboard/tableau/client.py # ingestion/src/metadata/ingestion/source/database/db2/utils.py # ingestion/src/metadata/ingestion/source/database/glue/metadata.py # ingestion/src/metadata/ingestion/source/database/oracle/connection.py # ingestion/src/metadata/ingestion/source/database/trino/metadata.py # ingestion/src/metadata/ingestion/source/mlmodel/mlflow/metadata.py # ingestion/src/metadata/ingestion/source/pipeline/databrickspipeline/kafka_parser.py # ingestion/src/metadata/ingestion/source/pipeline/databrickspipeline/metadata.py # ingestion/src/metadata/ingestion/source/pipeline/databrickspipeline/models.py # ingestion/src/metadata/pii/scanners/ner_scanner.py # ingestion/src/metadata/pii/tag_analyzer.py # ingestion/src/metadata/profiler/interface/pandas/profiler_interface.py # ingestion/tests/integration/profiler/test_sqa_profiler.py
…n-typing-logging # Conflicts: # ingestion/src/metadata/ingestion/source/pipeline/kafkaconnect/client.py # ingestion/src/metadata/ingestion/source/pipeline/kafkaconnect/metadata.py # ingestion/src/metadata/pii/algorithms/classifiers.py # ingestion/src/metadata/pii/algorithms/preprocessing.py
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
There was a problem hiding this comment.
🟡 Changes recommended
There are at least CI-blocking typing issues in the updated annotations (e.g., a non-optional list[...] field defaulting to None) that should be corrected before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
ingestion/src/metadata/ingestion/ometa/ttl_cache.py:28
TTLCacheuses an unbounded dict and only prunes expired entries on__contains__. If many distinct keys are added without being checked again, this can grow without bound. Add eager expiry pruning onadd()and a hard max size to keep memory bounded.
- Files reviewed: 298/987 changed files
- Comments generated: 1
- Review effort level: Lite
| raise InvalidWorkflowException("Missing type in the serviceConnection config") | ||
|
|
||
| logger.debug(f"Error parsing the Workflow Configuration for {source_type} ingestion") | ||
| logger.debug("Error parsing the Workflow Configuration for %s ingestion", source_type) | ||
|
|
||
| service_type = get_service_type(source_type) |
There was a problem hiding this comment.
🔵 Needs a closer look
A few updated type hints are internally inconsistent with runtime behavior (e.g., Flink client return type, DynamoDB response model, and an integration-test dataclass default), which will break type-checking and can cause runtime errors.
Review details
- Files reviewed: 298/987 changed files
- Comments generated: 0 new
- Review effort level: Lite
|


Describe your changes:
Modernizes Python annotations covered by
UP006,UP007,UP035, andUP045, including generated Pydantic classes duringmake generate. CI now rejects both violations and new# noqasuppressions for those rules.Enables only
G004in Ruff's selected rules. The current baseline of 2,536 logging f-string violations across 416 files is preserved with targeted# noqa: G004directives, while new logging f-strings fail lint and must use lazy%-style formatting.Type of change:
High-level design:
make generate.--ignore-noqaplus an explicit directive scan so suppressions cannot bypass CI.G004globally and grandfather the current baseline with targeted directives so future logging code must be lazy-formatted.This is a mechanical migration; it does not change supported Python versions or public APIs.
Tests:
Use cases covered
UP006,UP007,UP035, orUP045violations, including suppressed violations.Unit tests
python -m compileall -q ingestion/src openmetadata-airflow-apismake py_format_checkF401,UP006,UP007,UP035,UP045The complete unit-test tree could not be collected in the reused local environment because optional connector dependencies are absent and its installed spaCy/Thinc build is binary-incompatible with NumPy.
Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>.Fixes #<issue-number>above.