Repository navigation
ci(lint): type-check the ADF SDK and generated schema classes in lint jobs - #21881
shirshanka wants to merge 1 commit into
Conversation
… jobs python-lint's [dev] venv did not install azure-mgmt-datafactory, so mypy (ignore_missing_imports) treated the Azure Data Factory SDK as Any and missed type errors in the source and its tests. Add azure-data-factory to the dev plugin list, plus the cheap debug-recording and montecarlo SDKs. smoke-test pythonLint did not run metadata-ingestion codegen, so the generated schema_classes were missing and also Any. Make pythonLint and pythonLintFix depend on :metadata-ingestion:codegen.
PR SummaryOverview For metadata-ingestion lint, the For smoke-test lint, The actual mypy fixes are expected in a stacked PR; on Reviewed by Cursor Bugbot for commit eabf93a. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Smart test selectionpytest smoke testsMode: active. Only the selection below runs for the pytest smoke tests on this PR (applied:
Selected scopes (19 files or classes, 74 tests)
Add the commit |
Connector Tests ResultsAll connector tests passed for commit To skip connector tests, add the Autogenerated by the connector-tests CI pipeline. |
Summary
Two CI lint jobs type-check code against packages that are not installed, so mypy (with
ignore_missing_imports) sees that code asAnyand real type errors pass. This PR closes both gaps.python-lint/:metadata-ingestion:lint: the[dev]venv did not installazure-mgmt-datafactory, so the whole Azure Data Factory source and its unit tests were checked againstAny. 85 errors inadf_probe.pyandtests/unit/azure_data_factory/test_adf_source.pywere invisible. This adds theazure-data-factoryplugin to the plugin list inbase_dev_requirements, the same place every other type-checked plugin's SDK is installed.smoke-test-lint/:smoke-test:pythonLint: the task did not depend on:metadata-ingestion:codegen, sodatahub.metadata.schema_classesdid not exist in a fresh CI checkout and every generated aspect class wasAny. That hid an error insmoke-test/tests/e2e/knowledge/test_okf_reimport.py:127.pythonLintandpythonLintFixnow depend on codegen, likestackFreePytestalready does.The errors themselves are fixed in #21880. This PR is stacked on #21880 so its CI stays green for review; once #21880 merges it retargets to
master. Onmasteralone, this change would turn both lint jobs red until #21880 lands.Other plugins with the same gap
To find them, I ran mypy over
metadata-ingestionwithignore_missing_imports = noin the[dev]venv and kept the imports that do not resolve. Then I installed each candidate's SDK and re-ran the normal lint to count the errors it uncovers onmaster:azure-data-factory(azure-mgmt-datafactory)debug-recording(vcrpy,pyzipper,responses)montecarlo(pycarlo)db2(ibm_db_sa)onnx-embeddings(onnxruntime,tokenizers)sso(playwright)memray(debug requirement)sqlmeshCIRCULAR_EXTRAS, cannot coexist in the lockdebug-recordingandmontecarloare clean today, but their sources import their SDKs in several places, so they are added to stop the next error from hiding. The heavy ones touch one import each and are left out.Not fixable through extras (left as is): optional imports that no extra declares (
pgvector,requests_kerberos,sqllineage,google.cloud.datacatalog_lineage,black), JPype'sjava.utilinkafka_connect, and helper scripts or integration-test setup files (pyspark,pyflink,pydeequ,pydot).CI time cost
python-lint: the extra packages add ~55 MB to a cold uv cache and well under 5 s to the install (oneuv pip installwith a warm cache finishes in under a second). mypy with no cache took 156–165 s with the new SDKs and 156–181 s without (two runs each), so the difference is within run-to-run noise. The uv cache key already hashessetup.py/uv.lock, so theci-cache-warmup.ymlentry picks the new packages up on the next push tomaster.smoke-test-lint: codegen now runs before lint. From a fresh worktree,./gradlew :metadata-ingestion:codegentook 18 s with the Gradle build cache and 36 s with--no-build-cache. That covers themxe-schemasbuild, a basemetadata-ingestionvenv and the codegen script. Expect roughly 30–60 s more on a CI runner. The job already sets up Java and Gradle caching throughsetup-toolchain.Failing before, passing after
All runs use the Gradle tasks CI runs, on this branch (with the
[dev]venv rebuilt from scratch):./gradlew :metadata-ingestion:lintwith this PR's dependencies:master'sadf_probe.pyandtest_adf_source.py: fails, 85 errors (3 inadf_probe.py, 82 intest_adf_source.py)Success: no issues found in 3802 source files./gradlew :smoke-test:pythonLint(now runs codegen first):master'stest_okf_reimport.py: fails,test_okf_reimport.py:127and:128,"DictWrapper" has no attribute "attribution" [attr-defined]Success: no issues found in 373 source filesmasterfile with the generatedschema_classesremoved (what CI had before):Success, the gap this PR closesChecklist
🤖 Opened with cclaude on behalf of @shirshanka