Repository navigation
Honor latest on time-series listings without a time range; qualify the incident listing deletion scoping - #36594
Conversation
Time-series listings that passed latest=true without startTs/endTs routed to the plain revision listing, voiding the flag: every revision was paginated and the total counted revisions instead of partitions. The base EntityTimeSeriesDAO now has a no-range partitioned listing and count, and TestCaseResolutionStatusTimeSeriesDAO overrides them to keep the origin test_case join (the originEntityFQN predicate reads the testCaseEntityFQN alias it introduces) and the outer record-status filter. ListFilter now normalizes a null include to an explicit ALL so no consumer observes null, and getIncludeCondition is an exhaustive switch.
…lude The deleted scoping on the incident listing only ever resolved because the test_case join happened to carry it; the reshaped listings must not depend on an include clause riding an implicit join. addOriginEntityFQNJoin now joins unconditionally and appends tc.deleted = FALSE — the same scoping the incidentGroups summary SQL hardcodes — and the flat listing's include parameter is deprecated (OpenAPI deprecated, RFC 9745 Deprecation header, server warning when explicitly passed) per ADR:2026-10-29-incident-listing-include-deprecated. The listing IT now also drives the endpoint over REST with latest and no time range.
…otherwise The unconditional join carried a cost every request paid. Keep the intent the old condition aimed for, without its tautology: the join is added only when originEntityFQN is present (its testCaseEntityFQN alias is the only thing the join is for, with tc.deleted = FALSE riding it), and the always-on non-deleted test-case scoping pays an indexed EXISTS instead when the join is not there. ADR:2026-10-29-incident-listing-include-deprecated states the reindex consequence: incident listings now also exclude soft-deleted test cases, matching the search twin's default.
The incident DAO's keyset/cursor readers build their condition without the join; they are unwired today, and the record now states what wiring them requires instead of claiming they cannot dangle.
…ified Scoping incidents to non-deleted test cases unconditionally made include=deleted/all unrepresentable — incidents of a soft-deleted test case were no longer listable. The include parameter is honored again, its scope re-expressed as a tc-qualified predicate riding the join when the originEntityFQN predicate needs it, or an indexed EXISTS when the join is not needed — never the unqualified clause whose resolution depended on an implicit join. ADR:2026-10-29-incident-listing-test-case-deletion-scoping-is-qualified replaces the unshipped deprecation decision.
The listing IT now also seeds the test_case_incident row the date filters' stateId subquery reads and asserts the dateField shapes at DAO level and over REST; each contract assertion was red-checked against the hardcoded-scope design it replaces.
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
Code Review ✅ Approved 2 closed / 2 findings🟡 Medium risk · Changing latest time-series queries and incident deletion filters could return incomplete or miscounted listings if partitioning or scoping is wrong. Fixes ✅ 2 closed✅ Quality: Deprecation WARN fires on every UI incident listing request
Closed: Quality: No decision record for latest=true without a time range
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
…ager (#36690) * Fixes 34616: List every open incident and hide incidents of deleted test cases - Latest incident listings keep the latest record of each incident (stateId) instead of each test case, so a group's drill-down, drawer and bulk actions match the group count when a test case holds two open incidents. - The search listing scopes include on the embedded testCase.deleted, and a soft delete or restore of a test case or any parent updates that flag on the incident documents under it. - The latest aggregation's scope filter carries the caller's include. * Send the incident deleted flag synchronously and cover restore - The testCase.deleted update goes through the same synchronous update as the soft-delete cascade, so a failure reaches the retry queue and a quick restore cannot race it. - TestCaseSoftDeleteSearchIT restores the table and checks the incident returns. - The decision record states that the classic search listing stays per test case. * Note that a failed incident flag update needs a reindex * Expect the incident DAO's latest listing to partition by stateId after #36594 * Index incidents under every ancestor a soft delete matches and reach the staged index - TestCaseResolutionStatusIndex rebuilt the test case without its test suite and then read the suite from the rebuilt copy, so testSuite, database, databaseSchema and service were never written. The doc now carries them all (from the resolved table and the original suite reference), and the strict read strips them and certification. - The incident testCase.deleted update goes through getWriteFanoutTargets, so a reindex's staged index gets it too. - TestCaseSoftDeleteSearchIT soft-deletes and restores the basic test suite. * Apply an incident status to the incident it names, not the test case's latest A test case can hold more than one open incident, and the grouped view now lists each of them, but a status write was keyed by test case alone: a bulk change picked from an older incident updated the newer one. The create request takes an optional stateId; the server applies the status to that incident, after checking it belongs to the request's test case, and rejects one sent with New. A status for an incident without its own task no longer moves the open task of another incident. The grouped view's bulk actions and the reopen action send the incident's stateId. * Let a bulk severity change name a New incident A severity change re-sends the incident's current status, now with its stateId, so an incident still in New sent New plus a stateId, which the previous commit rejected before the severity path ran. New is now rejected only when it names a resolved incident, where it would start a new incident under the old stateId; on an open incident it only restates the status. * Keep one open incident per test case; declare each index's deleted field A test case could hold two open incidents: a failing test reused only an open incident task, so an open incident started through the status API got a second chain, and POST /tasks could start one at any time. Refuse a new incident task while the test case has another open incident, and let a failure join an open incident that has no task. This replaces the per-stateId listing and the stateId on status writes, which are reverted. Each search index now declares the field that marks its documents deleted on its EntityIndexCapability (incidents: testCase.deleted). Soft-delete propagation and the search list include filter both read it, replacing the incident-specific code in SearchRepository and SearchListFilter. * Keep the deleted filter on time series that carry their own deleted flag The include filter now reads the deleted field from the entity's index capability. Time series registered with none, so agent and MCP executions, whose schemas have a deleted field, lost their filter. Declare deleted for any time series whose schema has it. * Format IncidentTaskIntegrationIT * Leave the one-open-incident rule out of this change Review asked to ship without it until the workflow-based incident code is checked for what it already enforces. Reverts the TaskRepository guard, the getOrCreateIncident join and their ITs; the ADR keeps the deleted-flag scoping only.



Describe your changes:
Fixes the incident listing 500s (
testCaseEntityFQNunknown alias) and theWHERE deleted = FALSEfailures that shared a root cause.A time-series listing that passed
latest=truewithoutstartTs/endTsrouted to the plain revision listing, silently voiding thelatestflag: every revision was paginated and the total counted revisions instead of partitions. The reshaped listings then exposed two latent SQL-shape bugs in the incident time-series code:test_casejoin — theoriginEntityFQNpredicate references thetestCaseEntityFQNalias only that join introduces → unknown-alias SQL error;deletedscoping only ever resolved because thetest_casejoin happened to be in the same statement —deleted = FALSEdangled on a column the time-series table does not have.Changes:
EntityTimeSeriesDAO: no-range partitioned listing and count (one row perentityFQNHash), routed by new latest-aware defaults (listWithOffset(filter, limit, offset, latest),listCount(filter, latest));latest=falsekeeps the existing plain paths, so DAOs that override them (TestCaseResolutionStatusTimeSeriesDAO) and their callers of the plain path are unchanged.EntityTimeSeriesRepository: the no-range branch passeslatestthrough for both the rows and the total, the total counting partitions whenlatest=true.TimeSeriesDAOs.TestCaseResolutionStatusTimeSeriesDAO: overrides the no-rangelatestlisting/count to keep the origin join and the outer record-status filter (status/assignee/severity rank on each incident's latest record), exactly as the ranged templates do minus theBETWEEN.incidentCondition: every incident listing carries its test-case deletion scoping as a qualified predicate —tc.deleted = FALSE/TRUEriding thetest_casejoin, which is added only when theoriginEntityFQNpredicate needs its alias; otherwise an indexedEXISTSontest_caseinstead, so no request pays a join no predicate needs and no clause dangles on a column the table lacks.include=alladds neither.TestCaseResolutionStatusResource:includestays honored (defaultnon-deleted,deleted,allall work — incidents of a soft-deleted test case remain listable underinclude=deleted/all); recorded indocs/decisions/2026-10-29-incident-listing-test-case-deletion-scoping-is-qualified.md.ListFilter: anullIncludeis normalized to an explicitALLin the constructor (before, "no deleted clause" was an accidental fall-through of an==chain), andgetIncludeConditionis an exhaustive switch, soALL's empty clause is a named decision a refactor cannot undo silently.Type of change:
High-level design:
The repository no longer drops
latestwhen there is no time range: the base DAO gainspartition-windowed (no-range) listing/count SQL and latest-aware defaults, and the incident DAO
re-shapes the no-range latest query the same way it shapes the ranged one (origin join + outer
record-status filter, minus the timestamp window). Deletion scoping for incidents becomes an
explicit, qualified property of the conditions instead of an accident of unqualified column-name
resolution, with the join paid only when a predicate needs it and an indexed
EXISTSotherwise.The contract decision (honored
include, qualified scoping, the reindex consequence) is recordedas ADR:2026-10-29-incident-listing-test-case-deletion-scoping-is-qualified.
Rejected alternative: normalizing timestamps to sentinels (0 / MAX) at the repository level —
that keeps the ranged queries serving the no-range case but changes
BETWEENsemantics andindex behavior; the dedicated no-range queries keep the plain listing identical to before.
Tests:
Use cases covered
GET /v1/dataQuality/testCases/testCaseIncidentStatus) withlatest=trueand no time range: one record per incident, the chain's latest record, page total equal to the partition count — previously a 500 (testCaseEntityFQNalias) or a bogus column.New-only request does not match through an earlier record), for listing and count.latest=trueand no time range: latest not voided; total counts partitions, not revisions.includeon the incident listing is honored: soft-deleted test cases' incidents are hidden by default and listed underinclude=deleted/all, consistent withincidentGroups.dateField+startTs/endTs, astateIdsubquery ontest_case_incident) rides the same condition path and is covered at DAO and REST level.Unit tests
openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/EntityTimeSeriesRepositoryLatestListTest.java(5 tests — repo routing/count branching; each mapping RED-checked by reverting the fix)openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusTimeSeriesDaoLatestTest.java(4 tests — no-range join/outer-filter routing, the qualified scope with join rider, the EXISTS-by-include routing without join; RED-checked)openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepositoryTest.java(theaddOriginEntityFQNJointests rewritten againstincidentCondition: join-rider scope, EXISTS-by-include, honored deleted/all)openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/ListFilterTest.java(2 tests — null include is an explicit ALL; no-arg default unchanged)openmetadata-serviceunit suite ran green; jacoco not run — the changed classes are covered by the listed suites.Backend integration tests
openmetadata-integration-tests/for new/changed API endpoints.openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TestCaseResolutionStatusTimeSeriesListingIT.java(3 tests).Runs on the final commit (
b6c028ad):TestCaseResolutionStatusTimeSeriesListingIT3/3,IncidentGroupsIT65/65,IncidentPaginationIT10/10,TestCaseLatestStatusIT1/1 — all green.-DdatabaseType=mysql):TestCaseResolutionStatusTimeSeriesListingIT3/3 green.python3 .github/scripts/plan_local_java_tests.py --check-branch→ "this branch leaves the map complete".Ingestion integration tests
Playwright (UI) tests
Manual testing performed
testCaseEntityFQNunknown alias) with the pre-fix code on-DdatabaseType=postgresfrom the incident listing count withoriginEntityFQNand no time range.tc.deletedprobe (SELECT deleted FROM test_case) to distinguish scoping from a vanished row.UI screen recording:
Not applicable — backend-only change (SQL/query routing + parameter semantics); no UI feature or behavior added.
Checklist:
I have read the CONTRIBUTING document.
My PR title is descriptive (no linked issue; carrying the
skip-pr-checkslabel per author decision).Not linked to a GitHub issue — per author decision this PR carries the
skip-pr-checkslabel instead.I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: not applicable (no schema changes).
For a UI feature or feature task: not applicable (no UI changes).
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: reviewed the final diff against
REVIEW.mdvia thepr-checklistprocess (three passes, every 🔴 fixed; pass 3 verified the final design with no 🔴 and its 🟡s either fixed (ADR scoping, keyset caveat) or deferred below; RED-checks recorded per fix→test mapping, including theinclude=deletedcontract pinned against the interim hardcoded-scope design).Decision check:
docs/decisions/2026-10-29-incident-listing-test-case-deletion-scoping-is-qualified.mdadded in this PR.I have added a test that covers the exact scenario we are fixing.
Known follow-ups deliberately out of scope here:
LIMIT/OFFSETwith no outer-levelORDER BY— the same gap the pre-existing ranged-latest twin already paginates with (derived-table order not guaranteed by the engine on later pages). One fix at the root would close all four partitioned shapes; changing those pre-existing shapes is left out of this bug fix.listAfterKeyset/listBeforeKeyset/getCursorAtOffset) build their conditions without the new shaping; none is wired to an incident listing today (documented in the ADR for whoever wires them).🤖 Generated with Claude Code