Isolate openlineage extractor test from hook lineage collector pollution#67057
Merged
Conversation
The hook lineage collector is a process-wide singleton. Tests that exercise ObjectStoragePath operations (notably providers/common/ai/.../durable/ test_storage.py) populate it, and ExtractorManager.extract_metadata falls through to that collector when the extractor returns an unusable lineage class. That leaks the polluting test's datasets into the openlineage assertion when both run in the same pytest session - the deterministic failure mode on the Compat 3.0.6/3.1.8 provider-distributions jobs. Pin a fresh HookLineageCollector for the duration of the test to isolate it. The broader fix - clearing the collector in teardown for any test that exercises ObjectStoragePath - is tracked separately at apache#67044.
eladkal
approved these changes
May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
providers/openlineage/tests/unit/openlineage/extractors/test_base.py::test_default_extractor_uses_wrong_operatorlineage_classdeterministically fails on theCompat 3.0.6:P3.10andCompat 3.1.8:P3.10provider-distributions jobs (e.g. this run) because the process-wide singleton hook lineage collector gets populated byObjectStoragePathoperations fromproviders/common/ai/.../durable/test_storage.pyrunning earlier in the same pytest session.ExtractorManager.extract_metadata(providers/openlineage/src/airflow/providers/openlineage/extractors/manager.py:130-135) falls through toget_hook_lineage()whenever the extractor's lineage is unusable, so the polluted singleton's datasets get merged into the assertion and== OperatorLineage()fails.This is invisible on
mainbecause the local SDK returns aNoOpCollectorwhen no hook lineage reader plugin is installed, and the scheduled CI only runs Compat 2.10.5/3.0.0 (wherecommon.aiisn't installed). The regression dates from #64199 (durable execution forAgentOperator).Fix
Patch
get_hook_lineage_collectorwith a freshHookLineageCollector()for the duration of the test. Minimal, scoped to the one assertion, no changes to the polluting tests.Full root cause and the durable fix (resetting the collector in teardown for tests that exercise
ObjectStoragePath) tracked at #67044.Test plan
uv run --project providers/openlineage pytest providers/openlineage/tests/unit/openlineage/extractors/test_base.py— all 36 tests pass.prekhooks pass on the changed file.related: #67044, #66825 (rebase blocked on this fix)
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.7) following the guidelines