Skip to content

fix: honor latest on time-series listings without a time range; qualify the incident listing deletion scoping (backport 2.0 #36594) - #36872

Merged
TeddyCr merged 1 commit into
open-metadata:2.0from
TeddyCr:backport/pr-36594-2.0-cc
Nov 2, 2026
Merged

TeddyCr merged 1 commit into
open-metadata:2.0from
TeddyCr:backport/pr-36594-2.0-cc

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes:

Backport of #36594 onto the 2.0 release branch, adapted to that branch's layout.

Original PR summary: fixes the incident listing 500s (testCaseEntityFQN unknown alias) and the WHERE deleted = FALSE failures, which shared a root cause — a time-series listing with latest=true and no startTs/endTs routed to the plain revision listing, voiding latest and running the base partitioned queries that bypass the test_case join. On 2.0 the incident time-series DAO lives in CollectionDAO.TestCaseResolutionStatusTimeSeriesDAO (not TimeSeriesDAOs.java, which doesn't exist here), so the port places the changes there:

  • EntityTimeSeriesDAO: no-range partitioned listing and count (one row per entityFQNHash), routed by latest-aware defaults (listWithOffset(filter, limit, offset, latest), listCount(filter, latest)); latest=false keeps the existing plain paths, so DAOs that override them and their callers of the plain path are unchanged.
  • EntityTimeSeriesRepository: the no-range branch of the total count passes latest through, so the total counts partitions when latest=true (2.0's base called listCount(filter, startTs, endTs, latest) unbranched; the port reproduces the PR's branched shape).
  • CollectionDAO.TestCaseResolutionStatusTimeSeriesDAO: overrides the no-range latest listing/count to keep the origin join and the outer record-status filter (status/assignee rank on each incident's latest record), exactly as the ranged templates do minus the BETWEEN; every incident path (ranged latest and plain) now routes through incidentCondition.
  • incidentCondition: every incident listing carries its test-case deletion scoping as a qualified predicate — tc.deleted = FALSE/TRUE riding the test_case join, which is added only when the originEntityFQN predicate needs its alias; otherwise an indexed EXISTS on test_case, so no request pays a join no predicate needs and no clause dangles on a column the time-series table lacks. include=all adds neither.
  • TestCaseResolutionStatusResource: include stays honored (default non-deleted, deleted, all all work) — recorded in docs/decisions/2026-10-29-incident-listing-test-case-deletion-scoping-is-qualified.md.
  • ListFilter: a null Include is normalized to an explicit ALL in the constructor, and getIncludeCondition is an exhaustive switch.
  • Legacy cleanup specific to 2.0: TestCaseResolutionStatusRepository.addOriginEntityFQNJoin (unqualified join-by-include-or-originEntityFQN) is removed and its five call sites rewired — 2.0 callers all lived in the incident paths this PR rewrites.
  • Port notes for 2.0: main's incidentAssignee/severity outer-filter params do not exist yet here, so LATEST_RECORD_PARAMS is ("testCaseResolutionStatusType", "assignee"); the unit tests call incidentCondition through CollectionDAO.TestCaseResolutionStatusTimeSeriesDAO with assignee.

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change
  • Documentation

Tests:

Use cases covered

  • Incident listing (GET /v1/dataQuality/testCases/testCaseIncidentStatus) with latest=true and no time range: one record per incident, the chain's latest record, page total equal to the partition count — previously a 500 (testCaseEntityFQN alias) or a bogus column.
  • The outer record-status filter ranks on the incident's latest record (a New-only request does not match through an earlier record), for listing and count.
  • The base time-series listing (workflow-instance table) with latest=true and no time range: latest not voided; total counts partitions, not revisions.
  • include on the incident listing is honored: soft-deleted test cases' incidents are hidden by default and listed under include=deleted/all.
  • The incident date-filter path (dateField + startTs/endTs, a stateId subquery on test_case_incident) rides the same condition path and is covered at DAO and REST level.
  • Every changed SQL shape executes against real MySQL and Postgres schemas.

Unit tests

  • I added unit tests for the new/changed logic.
    • EntityTimeSeriesRepositoryLatestListTest (5 tests — repo routing/count branching)
    • TestCaseResolutionStatusTimeSeriesDaoLatestTest (4 tests — no-range join/outer-filter routing, qualified scope with join rider, EXISTS-by-include routing)
    • TestCaseResolutionStatusRepositoryTest (addOriginEntityFQNJoin tests rewritten against incidentCondition)
    • ListFilterTest (2 tests — null include is an explicit ALL; no-arg default unchanged)

Local runs on the backport commit (this PR's head):

  • openmetadata-service install build: green.
  • Affected suites: 67/67 green (EntityTimeSeriesRepositoryLatestListTest 5, TestCaseResolutionStatusRepositoryTest 14, ListFilterTest 44, TestCaseResolutionStatusTimeSeriesDaoLatestTest 4).

Backend integration tests

  • I added integration tests in openmetadata-integration-tests/ (ported/extended from the original PR, adapted to 2.0's DAO API).
    • TestCaseResolutionStatusTimeSeriesListingIT (5 tests: base time-series latest-without-range, incident latest join + outer filter, soft-deleted test cases excluded by default, originEntityFQN scoping through the join, shared ranged shape).

🤖 Generated with Claude Code

…fy the incident listing deletion scoping (backport 2.0 open-metadata#36594)
@TeddyCr
TeddyCr requested a review from a team as a code owner November 2, 2026 18:54
@TeddyCr
TeddyCr requested review from sonika-shah and removed request for a team November 2, 2026 18:54
@github-actions

github-actions Bot commented Nov 2, 2026

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 Ingestion safe to test Add this label to run secure Github workflows on PRs labels Nov 2, 2026
@gitar-bot

gitar-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Changes latest time-series and incident deletion filtering, so incorrect partitioning or scoping could omit or expose incident records in listings.

Backports the time-series latest-without-range fix and incident listing test-case deletion scoping to the 2.0 branch, routing no-range latest listings and counts through partitioned queries and qualifying the incident listing deletion predicate. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@TeddyCr
TeddyCr enabled auto-merge (squash) November 2, 2026 18:59
@TeddyCr
TeddyCr merged commit 9dc49d6 into open-metadata:2.0 Nov 2, 2026
37 of 39 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

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.

2 participants