Repository navigation
fix(dq): delete incident summary rows with their incident history - #37054
Conversation
Code Review ✅ Approved🔴 High risk · Deleting incident summaries when history disappears and filtering migration backfills changes stored data, potentially losing summaries for incidents with missing links. Deletes incident summary rows together with their incident history, so orphaned summaries no longer resurface when a test case with the same name is recreated. Summary rows are cleaned up on each history delete and swept by Data Retention, and the 2.1.0 backfill skips incidents without a test case. No issues found. 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 |
…e service-connection wipe, the parallel-lane timeout (#37725) * test(it): fix 13 integration tests main has failed since merges skipped ITs Each test was broken by a later PR whose behaviour change is intended and recorded, but merged without the integration lanes running: - IncidentGroupsIT x3, MetricMigrationIT: the 2.1.0 incident backfill now requires a testCase parentOf row (#37054); seed it like the write path does. - TeamResourceIT x2: only admins add team roles (ADR 2026-10-30) and every CSV row needs EDIT_ALL on its own team (ADR 2026-11-02). - DomainMoveApprovalAuthorizationIT, DomainReassignmentAuthorizationIT: a JSON Patch on the document root is refused with 400 (ADR 2026-11-03). - AIContextMcpIT: a metric child the caller cannot view is dropped (ADR 2026-10-31); amend the 2026-10-29 record that said otherwise. - OntologyDraftQueryIT: the release scope needs an active release first. - TaskResourceIT: field paths end in tags/description (#37051). - OntologyBulkIT: the two glossaries of one test shared a name. - DataContractResourceIT x2: unknown imported fields are carried as source metadata, and an imported numeric-unsafe rule is stored as an embedded custom rule (ADR 2026-11-09). * test(it): address self-review on the main IT fixes Tighten the DataContract export assertion to the exporter's message, drop the TeamResourceIT Javadoc clause the removed step proved, and note in the metric ADR amendment that the VIEW_ALL expression filter has no caller in the suite that can reach it. * fix: keep a service's connection on a PUT that omits it; unblock the IT lanes - ServiceEntityRepository: a PUT without `connection` now keeps the stored connection, as #32920 and issue #29494 intend and DatabaseServiceResourceIT.put_updateWithoutConnection_preservesExistingConnection_200 asserts. Each generated service types its own setter, so the stored connection is copied in place through its JSON form. Stored ciphertext and vault references pass through storage unchanged (ADR 2026-10-29 service-connection-secrets-are-written-only-during-storage). - NativeOntologyEveryPackInstallIT moves to the global-state lane. Its @isolated 11-15 minute install of every pack pushed the parallel lane past its 65 minute budget; the global-state lane runs beside it with headroom and every pack still installs on each merge (ADR 2026-11-06). - DataProductDeleteRaceIT matches lock waiters by table on MySQL too: a run waited the full minute on a blocked statement that did not carry the data product's id. * fix: an approval-held PUT without a connection must not clear it either The approval gate staged a PUT that omits `connection` as `connection: null`, so approving it would still delete the credentials. Services now declare `connection` and `serviceAttributes` as fields a PUT keeps, matching the updater. Records the decision and its security reasoning in ADR 2026-11-13-a-put-that-omits-a-service-connection-keeps-the-stored-one. SecretsManagerNullSecretIT covers both paths against the in-memory vault: a direct PUT keeps the connection and its vault secrets, and a held PUT stages no connection op (fails without the override). DataProductDeleteRaceIT moves to the serial global-state lane and matches whole table names, so no other test's lock wait can stand in for its own. * docs(adr): state what an omitted connection lost before the fix, as tested A red run of the old updater shows the service row losing its connection while the vault entries were still present right after the PUT, so the record no longer claims the vault entries were deleted.
…ipe (backport 2.1 #37725) (#37850) * Fix every integration-test failure on main: 14 stale/broken tests, the service-connection wipe, the parallel-lane timeout (#37725) * test(it): fix 13 integration tests main has failed since merges skipped ITs Each test was broken by a later PR whose behaviour change is intended and recorded, but merged without the integration lanes running: - IncidentGroupsIT x3, MetricMigrationIT: the 2.1.0 incident backfill now requires a testCase parentOf row (#37054); seed it like the write path does. - TeamResourceIT x2: only admins add team roles (ADR 2026-10-30) and every CSV row needs EDIT_ALL on its own team (ADR 2026-11-02). - DomainMoveApprovalAuthorizationIT, DomainReassignmentAuthorizationIT: a JSON Patch on the document root is refused with 400 (ADR 2026-11-03). - AIContextMcpIT: a metric child the caller cannot view is dropped (ADR 2026-10-31); amend the 2026-10-29 record that said otherwise. - OntologyDraftQueryIT: the release scope needs an active release first. - TaskResourceIT: field paths end in tags/description (#37051). - OntologyBulkIT: the two glossaries of one test shared a name. - DataContractResourceIT x2: unknown imported fields are carried as source metadata, and an imported numeric-unsafe rule is stored as an embedded custom rule (ADR 2026-11-09). * test(it): address self-review on the main IT fixes Tighten the DataContract export assertion to the exporter's message, drop the TeamResourceIT Javadoc clause the removed step proved, and note in the metric ADR amendment that the VIEW_ALL expression filter has no caller in the suite that can reach it. * fix: keep a service's connection on a PUT that omits it; unblock the IT lanes - ServiceEntityRepository: a PUT without `connection` now keeps the stored connection, as #32920 and issue #29494 intend and DatabaseServiceResourceIT.put_updateWithoutConnection_preservesExistingConnection_200 asserts. Each generated service types its own setter, so the stored connection is copied in place through its JSON form. Stored ciphertext and vault references pass through storage unchanged (ADR 2026-10-29 service-connection-secrets-are-written-only-during-storage). - NativeOntologyEveryPackInstallIT moves to the global-state lane. Its @isolated 11-15 minute install of every pack pushed the parallel lane past its 65 minute budget; the global-state lane runs beside it with headroom and every pack still installs on each merge (ADR 2026-11-06). - DataProductDeleteRaceIT matches lock waiters by table on MySQL too: a run waited the full minute on a blocked statement that did not carry the data product's id. * fix: an approval-held PUT without a connection must not clear it either The approval gate staged a PUT that omits `connection` as `connection: null`, so approving it would still delete the credentials. Services now declare `connection` and `serviceAttributes` as fields a PUT keeps, matching the updater. Records the decision and its security reasoning in ADR 2026-11-13-a-put-that-omits-a-service-connection-keeps-the-stored-one. SecretsManagerNullSecretIT covers both paths against the in-memory vault: a direct PUT keeps the connection and its vault secrets, and a held PUT stages no connection op (fails without the override). DataProductDeleteRaceIT moves to the serial global-state lane and matches whole table names, so no other test's lock wait can stand in for its own. * docs(adr): state what an omitted connection lost before the fix, as tested A red run of the old updater shows the service row losing its connection while the vault entries were still present right after the PUT, so the record no longer claims the vault entries were deleted. (cherry picked from commit a634c55) * test(it): read MySQL lock waits from performance_schema in DataProductDeleteRaceIT On CI the innodb_trx statement text never matched the blocked statements, so each race step only ended when a request hit MySQL's 50s lock-wait timeout, and one step outlived the 60s wait. data_lock_waits joined to data_locks names the table each blocked transaction waits on, independent of the statement text. Locally the three races now take 1.7-3.8s on MySQL instead of about 50s.
Problem
2.1.0 adds
test_case_incident, a summary table with one row per incident (perstateId). The incident grouping reads it instead of folding the whole history intest_case_resolution_status_time_series. When an incident's history rows are deleted, its summary row stays behind:Group counts join live test cases, so these rows usually stay hidden. They come back when a test case with the same name is created again: the old incident is counted in its group, while the drawer lists nothing for it.
What this PR changes
deleteByIddeletes the summary row once the last history row of thatstateIdis gone. Every per-row delete goes through it, including the cleanup from PR Fix incident cleanup during recursive test-case deletion #36983.orphan_test_case_incident. This also cleans up databases that already ran the 2.1.0 upgrade.parentOflink from a test case, the same rule the Data Retention sweep uses to find orphans. Databases already on an rc rerun the changed upsert, which is idempotent.How it was tested
TestCaseResourceIT: both hard-delete tests from PR Fix incident cleanup during recursive test-case deletion #36983 (direct and recursive from the table) now also check that the summary row exists before the delete and is gone afterwards.OrphanedTimeSeriesCleanupIT#testCaseIncidentOrphans: a summary row without history is deleted, and a live incident's summary row is kept.TestCaseResourceITtests 2/2,OrphanedTimeSeriesCleanupIT7/7,ReindexStatsIT2/2,ReindexDocSurvivalIT4/4,DataRetentionTest5/5,TestCaseRepositoryTest11/11. On MySQL: the twoTestCaseResourceITtests 2/2 andOrphanedTimeSeriesCleanupIT7/7.hibernate-validator9.1.4 bump undone, which is not part of this PR: with it, the in-JVM test server fails to start (NoClassDefFoundError: ConstraintValidatorFactoryImplfrom Dropwizard).Not in this PR
No linked issue: the gap was found while checking PR #36983 and its 2.0 backport PR #37003, and is fixed here directly (
skip-pr-checks).