Repository navigation
chore(governance): review follow-ups for workflow run retention - #36065
Conversation
- Charge a failed workflow-run retention page as at most one page of runs (WORKFLOW_RUN_PAGE_SIZE), not BATCH_SIZE, in the app run's failed count. - DataRetentionAppIT removes every run, state and live-process row it seeds, also when seeding or the app run fails. - nullOrEmpty over isEmpty(), final on unchanged locals, and named constants for the SQL fragments ListFilterTest asserts.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
| drainInBatches( | ||
| "workflow_runs", | ||
| retention::deleteNextPage, | ||
| deleted -> retention.isDrained(), | ||
| WORKFLOW_RUN_PAGE_SIZE); |
There was a problem hiding this comment.
Corrected failure count lacks coverage
No test checks the corrected failure count. Existing failure tests call BatchDrain directly, so they would still pass if cleanWorkflowRuns used the old 10,000-row charge. Add a test that makes workflow-run deletion throw and checks that the recorded failure count is 1,000. The Java guide requires bug fixes to include a test that fails without the fix; this requirement must be met before merging.
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!
There was a problem hiding this comment.
Added in edf56c8. cleanWorkflowRuns now drains through a package-private drainWorkflowRuns(retention) that passes WORKFLOW_RUN_PAGE_SIZE as the per-page failure charge, and DataRetentionTest#aFailedWorkflowRunPageIsChargedOnePageOfRuns makes the run DAO (the database boundary) throw and asserts the drain reports the failure with exactly 1,000 failed rows. Verified it is a real regression test: with the old BATCH_SIZE charge it fails with expected: <1000> but was: <10000>; with the fix DataRetentionTest is 5/0.
| String entity, | ||
| Supplier<Integer> deleteFunction, | ||
| IntPredicate drainedWhen, | ||
| int failedRowsPerBatch) { |
There was a problem hiding this comment.
Unchanged parameters lack required modifiers
The new drainInBatches overload declares four unchanged parameters without final. The Java guide requires final on locals and parameters that do not change. Add it to these parameters before merging.
| String entity, | |
| Supplier<Integer> deleteFunction, | |
| IntPredicate drainedWhen, | |
| int failedRowsPerBatch) { | |
| final String entity, | |
| final Supplier<Integer> deleteFunction, | |
| final IntPredicate drainedWhen, | |
| final int failedRowsPerBatch) { |
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!
There was a problem hiding this comment.
Fixed in edf56c8: the four-parameter overload is gone (replaced by drainWorkflowRuns + a shared recordDrain), and the parameters of drainInBatches, drainWorkflowRuns and recordDrain are final.
…tention drainWorkflowRuns drains workflow-run pages with WORKFLOW_RUN_PAGE_SIZE as the per-page failure charge, and DataRetentionTest makes the run DAO throw and checks that exactly one page is charged; the test fails with the previous BATCH_SIZE charge (expected 1000, was 10000). recordDrain holds the shared logging and stats; the new parameters are final.
Code Review ✅ Approved🟡 Medium risk · Changing workflow-run page failure charges from 10,000 to 1,000 may alter failed-record totals reported in retention app runs. Workflow-run retention failure charging now counts one page of runs instead of a full batch, with the retention IT test cleaning up its directly seeded rows in a finally block. 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 |
Describe your changes:
Fixes open-metadata/openmetadata-collate#7630
Chore: review follow-ups to #35920 (governance workflow run history indexing and retention), raised by the bots on its 2.0 backport #36059. There is no functional change to what retention deletes, keeps or reads.
drainInBatcheschargedBATCH_SIZE(10,000) failed rows, but a workflow-run page holds at mostWORKFLOW_RUN_PAGE_SIZE(1,000). Workflow runs now drain throughdrainWorkflowRuns, which charges one page;recordDrainholds the shared logging and stats. Only the app-run record'sfailedRecordsis affected.DataRetentionAppIT#test_retentionRun_deletesExpiredWorkflowRunsButKeepsEachEntitysLatestinserts runs, states and live-process rows directly, soTestNamespacecleanup cannot see them. They are now removed in afinally, including when seeding or the app run fails part way. The assertions moved into a helper.java.md):nullOrEmptyinstead ofisEmpty();finalon the new unchanged locals; named constants for the SQL fragments thatListFilterTestasserts.Not changed: the
ListFilterTestdialect test keeps mockingDatasourceConfig. That is how the existing tests in that file switch dialects, andDataRetentionAppITcovers both real databases.Type of change:
Tests:
ListFilterTest61/0,DataRetentionTest5/0.aFailedWorkflowRunPageIsChargedOnePageOfRunsfails on the previous charge (expected: <1000> but was: <10000>) and passes with the fix.DataRetentionAppIT: 5/0 on PostgreSQL + OpenSearch and 5/0 on MySQL + Elasticsearch.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; both previous findings are addressed and no new actionable issues were found.Summary
This PR corrects workflow-run failure counts and cleans up directly seeded test rows.
Reviews (2) · Last reviewed commit: "test(governance): pin the one-page failu..." · Reviewed by Greptile