Skip to content

Add OpenLineage system tests for the emission policy - #75678

Merged
mobuchowski merged 13 commits into
apache:mainfrom
kacpermuda:ol-system-tests-exclude-datasets
Oct 29, 2026
Merged

mobuchowski merged 13 commits into
apache:mainfrom
kacpermuda:ol-system-tests-exclude-datasets

Conversation

@kacpermuda

@kacpermuda kacpermuda commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Adds OpenLineage system and e2e tests for the emission policy: dataset exclusion (every rule tier, lineage source, authoring override and lock) and the other controls in conf, authoring and locked rules. The tests also check the emits_ol_events the scheduler reports in the Dag run START event, and that emit_dataset_lineage and emit_query_lineage emit nothing under emit: false.

related: #71312

Also in this PR:

  • OpenLineageTestOperator now logs every reason a check fails with the validation error tag and the event key, including runId integrity problems, errors other than a template mismatch and an unreadable expected events file. The e2e job output shows only the tagged lines, so some failures used to show up there without a reason.
  • openlineage_defer_simple_dag.json is renamed to openlineage_defer_simple_dag__af2.json. Airflow 3 has its own files for this Dag, so the unsuffixed file was only used on Airflow 2, which its name didn't say.

Not covered, because the e2e Dags share one deployment and these would change or block every other test:

  • global (scope: {}) conf rules and locked global rules, except for exclude_datasets, which only matches the dataset names of these tests (a locked global rule would block authoring everywhere)
  • include_source_code at operator scope, and operator rules on built-in operators other than SmoothOperator, which no other test uses (a custom operator is used, and it has no extractor that produces source code)
  • legacy options (disabled_for_operators, selective_enable, disable_source_code, include_full_task_info), which are global config
  • an invalid regex in an authored list (fails at Dag parse; unit tested) and the audit logging of rules (log only)

Not covered for other reasons:

  • manual task state changes and executor-reported failures, which need the manual state change test helpers that are not on main yet
  • mapped tasks with more than one instance: parallel instances overwrite each other's events in the test transport, so the mapped tasks expand to one instance

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Sonnet 5.5, Opus 5.5)

Generated-by: Claude Code (Sonnet 5.5, Opus 5.5) following the guidelines

🤖 Generated with Claude Code

@kacpermuda

Copy link
Copy Markdown
Collaborator Author

@ramitkataria Would you mind checking if those OL tests showcase what you'd expect from this recently merged feature ? Trying to cover all possible scenarios here, so that we are sure they work well end to end.

@kacpermuda kacpermuda added the full tests needed We need to run full set of tests for this PR to merge label Oct 27, 2026
@kacpermuda
kacpermuda force-pushed the ol-system-tests-exclude-datasets branch from 6eae59d to 4fd635c Compare October 27, 2026 12:44
@kacpermuda kacpermuda changed the title Add OpenLineage system tests for dataset exclusion policy Add OpenLineage system tests for the emission policy Oct 27, 2026
@kacpermuda
kacpermuda force-pushed the ol-system-tests-exclude-datasets branch 3 times, most recently from 70d614a to 26d2f08 Compare October 28, 2026 13:22
@kacpermuda
kacpermuda marked this pull request as ready for review October 28, 2026 13:22
@kacpermuda
kacpermuda force-pushed the ol-system-tests-exclude-datasets branch from 26d2f08 to d3cc5cd Compare October 28, 2026 16:39

@ramitkataria ramitkataria 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.

Thanks a lot - this looks like a great set of tests! Added a couple of nits inline that my agent found. Also:

t_identity caught something on my side: the identity is namespace + "/" + name, and file dataset names start with /, so file://host1/x matches as file://host1//x. Since it isn't released yet, I'll open a small follow-up to drop the doubled slash. That would change t_identity's pattern to file://host1/slash_.*, so happy to go with whichever order suits you.

If you feel like it, two more cases are safe in the shared deployment: an invalid hook-scoped rule (e.g. with emit) to show it's skipped, and two same-tier exclude_datasets rules to show the last one wins. Totally optional though!

@ramitkataria

Copy link
Copy Markdown
Contributor

Here's the PR I just opened: #75921

kacpermuda and others added 6 commits October 29, 2026 10:01
The exclusion control and hook scope added to the emission policy resolve
per dataset across many rule tiers and authoring overrides. Without system
tests, a regression in tier precedence, locking or authoring would pass
unnoticed.

Co-Authored-By: Claude <noreply@anthropic.com>
The provider docs include the system test Dags, so markdown fences and
indented lists in their docstrings broke the docs build and made the
spellcheck flag the stand-in class names.

Co-Authored-By: Claude <noreply@anthropic.com>
The policy grew to a single unreadable line. A folded block keeps the
value a single JSON line while letting each rule sit on its own line.

Co-Authored-By: Claude <noreply@anthropic.com>
… tests

The exclusion tests only checked a few scopes, and the existing policy Dags
checked each control once through authoring and, in conf, only the source
code. Rule tiers, every lineage source, locks, and the remaining controls
could change behaviour without any test noticing.

Co-Authored-By: Claude <noreply@anthropic.com>
A Dag run's own COMPLETE and FAIL come after its checking task, so no test
could tell whether the success and failed handlers apply the policy. Child
Dags finish before the parent's checking task and make them observable.

Co-Authored-By: Claude <noreply@anthropic.com>
Runtime AssetAlias outlets are reported only since Airflow 3.1 and the hook
lineage collector cap exists only since 3.2, so the OpenLineage e2e compat
runs on 3.0 and 3.1 failed on the shared Dag. A separate Dag lets each version
have its own expected events.

Co-Authored-By: Claude <noreply@anthropic.com>
kacpermuda and others added 7 commits October 29, 2026 10:01
The previous commit moved the runtime AssetAlias outlets and collector cap
checks out of the shared sources Dag, but the Dag meant to hold them was never
added, so the conf rule and the collector cap setting pointed at nothing and
neither behaviour was tested.

Co-Authored-By: Claude <noreply@anthropic.com>
The scheduler resolves the policy for the emits_ol_events field of the Dag run
START event from the serialized Dag, and the skipped-task handler and the
dataset and query lineage APIs check it on their own, so none of them was
exercised by the existing tests. Task groups, mapped and TaskFlow tasks, regex
and exact scopes, same-tier conflicts, the order of authoring calls and authored
lists over hook-scoped hook_lineage rules were not tested either.

Co-Authored-By: Claude <noreply@anthropic.com>
… on Airflow 3.0

Airflow 3.0 calls no listener when a task skips itself, so the skipped-task checks failed there.

Co-Authored-By: Claude <noreply@anthropic.com>
The policy tests repeated the same scenarios in several one-task Dags and kept near-full copies of expected events for small version differences, which made them slow to review and easy to let drift from the e2e policy config.

Co-Authored-By: Claude <noreply@anthropic.com>
Reviewers could not tell from the Dag code alone which rules and authoring calls a task exercises or why an event is expected to be missing, and some tasks only proved that a facet was absent, which would also pass if lineage were broken entirely.

Co-Authored-By: Claude <noreply@anthropic.com>
On Airflow 3.0 a self-skipping task still sends START, so the 3.0 expected
events check it, and the runId check, which needs a terminal event for every
START, is turned off there for that Dag only. The trigger tasks defer while
waiting, so ten waits no longer hold worker slots in the shared e2e batch.
The e2e config now warns that the SmoothOperator rule applies to every Dag,
and describes the collector cap correctly.

Co-Authored-By: Claude <noreply@anthropic.com>
…ests

Exclusion now matches file datasets without a doubled slash, so the identity
test pattern follows. Ignored invalid hook-scoped rules and last-wins between
same-tier exclude lists were untested. The test operator now tags every
reason a check fails, as the e2e output shows only tagged lines, and the
Airflow 2 expected events of the deferral Dag say which version they are for.

Co-Authored-By: Claude <noreply@anthropic.com>
@kacpermuda
kacpermuda force-pushed the ol-system-tests-exclude-datasets branch from d3cc5cd to e869a48 Compare October 29, 2026 09:25
@kacpermuda

Copy link
Copy Markdown
Collaborator Author

Thanks for the fix PR, rebased and included this in tests already

@mobuchowski
mobuchowski merged commit b394b88 into apache:main Oct 29, 2026
152 checks passed
@kacpermuda
kacpermuda deleted the ol-system-tests-exclude-datasets branch October 29, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:e2e-tests area:providers full tests needed We need to run full set of tests for this PR to merge provider:openlineage AIP-53

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants