Skip to content

MINOR - feat(dq): accept multiple testCaseStatus values on testCases/search/list (2.0 backport) - #31831

Merged
ShaileshParmar11 merged 1 commit into
2.0from
backport-31498-2.0
Aug 20, 2026
Merged

ShaileshParmar11 merged 1 commit into
2.0from
backport-31498-2.0

Conversation

@ShaileshParmar11

@ShaileshParmar11 ShaileshParmar11 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

2.0 backport of #31498 (5722dfe1), cherry-picked with -x. Clean pick, no conflicts.

Why this is needed on 2.0

The UI half of the multi-select test case status filter — #31662 — was backported to 2.0 (34ffe490) but this backend half was not. SearchListFilter.java on 2.0 has not been touched since July, so it still builds a single-value clause:

// 2.0 today
conditions.add(String.format("{\"term\": {\"%s\": \"%s\"}}", FIELD_TEST_CASE_STATUS, status));

When the UI sends testCaseStatus=Success,Failed, that term query matches the literal string "Success,Failed", ES returns zero hits, and the test case list renders empty.

This is currently the only failing test in the 2.0 AUT nightly, on every lane:

Data Quality › TestCase filters @Observability:Data_Quality @ingestion
  src/openmetadata-ui/playwright/e2e/Features/DataQuality/DataQuality.spec.ts:966

Error: expect(locator).toBeVisible() failed
  Locator: [data-testid="pw_first_table_column_count_to_be_between_98d64686"]
  Error: element(s) not found
  at verifyFilterTestCase (DataQuality.spec.ts:1064)
  at DataQuality.spec.ts:1295

Failing runs (all on build 2.0-202608200745, failed on the run and both retries — deterministic, not flake):

Line 1295 is precisely the assertion #31662 added: select Success (list correctly empties), then add Failed, and expect the failed test cases back via testCaseStatus=Success,Failed.

Verification

  • Cherry-pick applied cleanly onto the current 2.0 tip (eb149723), 4 files, +226/−11.
  • Post-pick, getTestCaseCondition() calls getTestCaseStatusCondition(status), which splits on comma and emits {"terms": {"testCaseResult.testCaseStatus": ["Success", "Failed"]}} — the OR semantics the UI expects.
  • Every symbol the picked code needs resolves on 2.0: ArraySchema, java.util.Arrays, java.util.List, TestCaseStatus, and the static CommonUtil.nullOrEmpty are all imported in the file, and SearchListFilterTest exists on this branch.
  • I did not compile or run the suites locally — the unit test (SearchListFilterTest) and integration test (TestCaseResourceIT) that came with the pick, plus the 2.0 AUT nightly, are the real verification.

🤖 Generated with Claude Code

Greptile Summary

The PR backports multi-value test-case status filtering to the search/list endpoint.

  • Accepts repeated and comma-separated status parameters, validates them case-insensitively, and normalizes them to canonical enum values.
  • Emits an Elasticsearch/OpenSearch terms query so any selected status can match.
  • Adds unit and integration coverage for repeated, comma-separated, case-insensitive, single, and invalid status inputs.

Confidence Score: 4/5

The PR appears safe to merge functionally, with only non-blocking Java immutability and comment-policy cleanup requested.

The endpoint validates and canonicalizes status values before constructing the intended terms query, and the accepted concerns are limited to repository style requirements in the newly added Java code.

Files Needing Attention: openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java, openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java, openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TestCaseResourceIT.java

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java Changes the query parameter to a list and validates, canonicalizes, deduplicates, and joins repeated or comma-separated statuses; minor repository-style violations remain.
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java Replaces the single-value term clause with a multi-value terms clause; the behavior is covered, but added declarations and comments violate repository conventions.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TestCaseResourceIT.java Adds end-to-end coverage for multi-status OR semantics, case-insensitive values, single values, and invalid values.
openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/SearchListFilterTest.java Updates expected query output and covers multiple and blank status inputs at the filter layer.

Sequence Diagram

sequenceDiagram
  participant UI
  participant Resource as TestCaseResource
  participant Filter as SearchListFilter
  participant Search as Elasticsearch/OpenSearch
  UI->>Resource: "GET search/list?testCaseStatus=Failed&testCaseStatus=Aborted"
  Resource->>Resource: Split, trim, validate, normalize
  Resource->>Filter: "testCaseStatus="Failed,Aborted""
  Filter->>Search: terms testCaseResult.testCaseStatus [Failed, Aborted]
  Search-->>UI: Test cases matching either status
Loading

Reviews (1): Last reviewed commit: "MINOR - feat(dq): accept multiple testCa..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Context used (4)

…search/list (#31498)

`GET /v1/dataQuality/testCases/search/list` bound `testCaseStatus` to a single
String and built a single Elasticsearch `term` clause, so filtering on more than
one status was impossible. The parameter is now a `List<String>` that accepts
repeated params and/or comma separated values, is validated case-insensitively
against the `TestCaseStatus` enum, and is turned into a `terms` clause so the
statuses match as an OR.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Sriharsha Chintalapani <[email protected]>
(cherry picked from commit 5722dfe)
@ShaileshParmar11
ShaileshParmar11 requested a review from a team as a code owner August 20, 2026 12:04
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 20, 2026
@gitar-bot

gitar-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Clean 2.0 backport of #31498 that updates SearchListFilter to accept multiple comma-separated testCaseStatus values using terms queries, fixing nightly E2E test failures. No issues found.

Options

Display: compact → Showing less information.

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

Comment on lines +1478 to +1493
private static String validateTestCaseStatuses(List<String> statuses) {
String joinedStatuses = null;
if (!nullOrEmpty(statuses)) {
List<String> validStatuses =
statuses.stream()
.flatMap(status -> Arrays.stream(status.split(",")))
.map(String::trim)
.filter(status -> !status.isEmpty())
.map(TestCaseResource::toTestCaseStatus)
.map(TestCaseStatus::value)
.distinct()
.toList();
joinedStatuses = validStatuses.isEmpty() ? null : String.join(",", validStatuses);
}
return joinedStatuses;
}

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.

P2 Non-final Java declarations

The new status-normalization code and related filter and test helpers omit final from parameters and non-reassigned local variables. This conflicts with the repository's immutability convention and makes accidental reassignment easier during later maintenance; the same pattern also occurs in SearchListFilter.java and TestCaseResourceIT.java.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

return str.replace("\"", "\\\"");
}

/** Comma separated statuses are matched as an OR, a single status still matches exactly. */

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.

P2 Redundant private-method comments

This comment restates the splitting and OR behavior directly expressed by the following method, adding maintenance overhead without documenting a non-obvious constraint. The new private-method comments in TestCaseResource.java similarly narrate behavior already clear from the method names and implementations.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@ShaileshParmar11
ShaileshParmar11 merged commit 6186802 into 2.0 Aug 20, 2026
56 of 60 checks passed
@ShaileshParmar11
ShaileshParmar11 deleted the backport-31498-2.0 branch August 20, 2026 12:07

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

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants