Skip to content

Fixes #27718: Generic and NUMERIC test definitions missing from the Add Test Case dropdown - #32996

Merged
TeddyCr merged 13 commits into
mainfrom
agent/issue-27718
Sep 18, 2026
Merged

TeddyCr merged 13 commits into
mainfrom
agent/issue-27718

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #27718

Two related defects that both made a test definition unreachable in the "Add test case" dropdown.

1. A definition with no supportedDataTypes was invisible everywhere.

TestDefinitionDAO's supportedDataType filter (listBefore/listAfter/listCount in TimeSeriesDAOs.java) required a positive JSON_CONTAINS / @> match, so the dropdown — which calls getListTestDefinitions({ supportedDataType: columnType }) — never returned generic definitions. The sibling supportedServices filter already implemented the "empty means all" convention; supportedDataTypes did not.

  • TimeSeriesDAOs.java — the filter now also matches an absent or empty supportedDataTypes, in all three query paths, mirroring the supportedService SQL.
  • test_case_runner.py — filter_incompatible_test_cases treated an empty list as "supports nothing" and raised TypeError: argument of type 'NoneType' is not iterable on an absent one. Both now mean "runs against any column".
  • TestDefinitionFormBody.tsx — removed the rule that made the field required whenever OpenMetadata was a selected platform, which directly contradicted the new default; replaced with the services field's helper text + "Leave empty to support all data types" placeholder.
  • Docs — the "empty means all" contract is now stated on testDefinition.json / createTestDefinition.json, the REST supportedDataType parameter, the MCP get_test_definitions description, and TestDefinitionForm.md.

2. No test could be added to a NUMERIC column beyond null/unique/missing-count.

NUMERIC is a distinct member of the column dataType enum and is what BigQuery, Postgres, Snowflake and DB2 numeric columns are ingested as, but ten of the seeded column test definitions listed NUMBER and DECIMAL and never NUMERIC. Because the listing filters on the column's exact dataType, mean / min / max / median / stddev / sum / between were unreachable on any NUMERIC column — only the three definitions that happened to list NUMERIC (columnValuesMissingCountToBeEqual, columnValuesToBeNotNull, columnValuesToBeUnique) showed up.

Reproduced on sample_data.ecommerce_db.shopify.dim_customer (every numeric column there is NUMERIC): the dropdown offered 4 options instead of 14.

  • Seeds — NUMERIC added to the ten column definitions that list NUMBER but not NUMERIC. The three string-only definitions (columnValuesLengthsToBeBetween, columnValuesToMatchRegex, columnValuesToNotMatchRegex) are deliberately untouched.
  • Migration (2.1.0, MySQL + Postgres) — backfills the same ten definitions. EntityRepository.initializeEntity returns early when the entity already exists, so editing the seed JSON only reaches fresh installs.

Type of change:

  • Bug fix

High-level design:

Why the two fixes ship together. They are the same user-visible symptom — "the test I want is not in the dropdown" — reached through the same supportedDataType filter, and the second was only found while verifying the first against a live instance.

Migration guards. The backfill is guarded two ways:

  • on NUMERIC being absent, so re-runs are a no-op;
  • on the supportedDataTypes array existing at all, so a definition that declares none — which after this PR means "every data type" — is not silently narrowed to exactly one.

It keys on the entity name, not the seed filename: columnValueToBeAtExpectedLocation.json defines an entity named columnValuesToBeAtExpectedLocation (plural).

Backward compatibility. Both changes only widen what the filter returns. No definition that was previously offered for a data type stops being offered.

Tests:

Use cases covered

  • A test definition created with no supportedDataTypes is offered when picking a test for a column of any type.
  • A test definition restricted to NUMBER is still not offered for a VARCHAR column.
  • Every seeded numeric aggregate definition (mean / min / max / median / stddev / sum) is offered for a NUMERIC column.
  • A string-only definition (columnValuesToMatchRegex) is still not offered for a NUMERIC column.
  • The ingestion runner accepts a test case whose definition declares an empty or absent supportedDataTypes, instead of rejecting it or raising TypeError.

Unit tests

  • ingestion/tests/unit/data_quality/test_test_case_runner.py (new) — match / mismatch / no-declaration for filter_incompatible_test_cases.
  • TestDefinitionFormBody.test.tsx — rewritten; previously asserted the required-field behaviour this PR removes.

Backend integration tests

  • openmetadata-integration-tests/.../TestDefinitionResourceIT.java
    • list_supportedDataTypeFilterKeepsDefinitionsWithoutDataTypes_200_OK — a definition without data types is returned for supportedDataType=VARCHAR while a NUMBER-only one is not.
    • list_supportedDataTypeNumericReturnsSeededAggregateDefinitions_200_OK — every seeded numeric aggregate is returned for NUMERIC, and columnValuesToMatchRegex is not (so a filter that degenerates into "return everything" fails too).

Ingestion integration tests

Not applicable — the ingestion change is a pure predicate, covered by the unit tests above.

Playwright (UI) tests

  • playwright/e2e/Features/DataQuality/TestLibrary.spec.ts — rewritten; previously asserted the required-field behaviour this PR removes.

Manual testing performed

Against a local Docker stack (MySQL + Elasticsearch), on sample_data.ecommerce_db.shopify.dim_customer:

  1. Opened Add Test case → Column Level → average_order_size (NUMERIC) and captured the request the UI issues:
    GET /api/v1/dataQuality/testDefinitions?limit=1000&entityType=COLUMN
        &testPlatform=OpenMetadata&supportedDataType=NUMERIC&supportedService=BigQuery
    
    Before the seed fix the dropdown listed 4 options; after it lists 14, including Mean / Min / Max / Median / Std Dev / Sum To Be Between.
  2. Confirmed the DAO change is strictly additive by running the pre-change predicate and the post-change predicate side by side against the same database — 3 rows vs 4, the extra row being a definition with an empty supportedDataTypes.
  3. MySQL migration — applied to a populated database: 10 rows changed on the first run, 0 on the second (idempotent).
  4. Postgres migration — applied in a disposable postgres:16 container over a fixture covering all four cases: appends where NUMERIC is missing, skips where already present, skips a definition with no supportedDataTypes array, skips out-of-scope names; 0 rows on re-run.
  5. Confirmed supportedDataType=VARCHAR (10) and supportedDataType=BOOLEAN (6) return exactly what they did before.

UI screen recording / screenshots:

The UI change is the removal of a validation rule plus a placeholder/helper-text change on the Test Definition form; the user-visible effect of the rest of the PR is which entries appear in the Test Type dropdown, covered by the manual steps above.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing.

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because the outstanding supportedDataType filter behavior can return table-level definitions to callers that omit entityType.

Findings

  1. P1 Table Tests Match Column Filter ▶
Summary

The PR makes test definitions without supported data types generic and adds NUMERIC support to applicable seeded column tests.

  • Updates all test-definition DAO pagination and count predicates to include absent or empty supportedDataTypes.
  • Updates ingestion compatibility checks and the UI form to honor the “empty means all” contract.
  • Adds NUMERIC to relevant seed definitions and backfills existing MySQL and PostgreSQL installations.
  • Adds backend, ingestion, UI, and Playwright coverage and updates API/schema documentation.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Column selected] --> B[Request test definitions]
  B --> C{supportedDataTypes}
  C -->|Absent or empty| D[Generic definition matches]
  C -->|Contains exact column type| E[Typed definition matches]
  C -->|Does not contain type| F[Definition excluded]
  D --> G[Add Test Case dropdown]
  E --> G
Loading

Reviews (4) · Last reviewed commit: "Merge branch 'main' into agent/issue-277..."

A test definition that declares no `supportedDataTypes` places no restriction on
the columns it can run against, so it should be offered for every column type —
the same convention `supportedServices` already follows. Instead, the
`supportedDataType` listing filter required a positive match, so those
definitions were missing from the dropdown that maps a test case to a column and
could not be used at all.

- Listing (`TimeSeriesDAOs.TestDefinitionDAO`): let definitions with an absent or
  empty `supportedDataTypes` through the filter, mirroring `supportedService`.
- Ingestion (`filter_incompatible_test_cases`): an empty list no longer rejects
  every column; previously an absent list also raised a `TypeError`.
- UI: drop the rule that made the field required on the OpenMetadata platform,
  and say "leave empty to support all data types" like the services field does.
- Document the "empty means all" contract on the schema, the REST parameter and
  the MCP tool description.

Closes #27718

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 8, 2026 22:36

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 1 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 1 warning(s) across 1 changed file(s).

Count Rule
1 react-hooks/exhaustive-deps
All findings
Location Rule Message
🟡 src/components/TestLibrary/TestDefinitionForm/TestDefinitionFormBody.tsx:346:5 react-hooks/exhaustive-deps React Hook useMemo has an unnecessary dependency: 'form'. Either exclude it or remove the dependency array.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 72%
72.92% (102597/140694) 57.86% (62361/107774) 58.94% (20403/34615)

…ary.spec.ts

The merge of upstream/main into this branch dropped the import while keeping
both call sites. This PR had removed the only usage it knew about along with the
import; main had meanwhile added two more (#33122, #32071), and the resolution
kept those without bringing the import back. Every test in the file that reaches
selectEntityType then died with `ReferenceError: selectOptionWithRetry is not
defined` -- 5 failures in the chromium-07 shard.

The helper itself is unchanged in utils/common.ts; only the import was missing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

harshach
harshach previously approved these changes Sep 17, 2026

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Fixes generic data quality test definitions missing for unspecified data types by implementing an "empty means all" convention for supportedDataTypes, mirroring the existing supportedServices filter. Changes span the DAO query logic, test case runner filtering, UI form validation, and documentation across multiple languages, with new test coverage added. No issues found.

Review coverage

Rules No rules evaluated

Functional validation Not enabled · Set up

Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
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.

Generic DQ test definitions missing for unspecified data types in Collate

5 participants