Skip to content

chore(governance): review follow-ups for workflow run retention - #36065

Merged
yan-3005 merged 2 commits into
mainfrom
chore/workflow-run-retention-review-fixes
Oct 23, 2026
Merged

yan-3005 merged 2 commits into
mainfrom
chore/workflow-run-retention-review-fixes

Conversation

@yan-3005

@yan-3005 yan-3005 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Retention stats: when a workflow-run page throws, drainInBatches charged BATCH_SIZE (10,000) failed rows, but a workflow-run page holds at most WORKFLOW_RUN_PAGE_SIZE (1,000). Workflow runs now drain through drainWorkflowRuns, which charges one page; recordDrain holds the shared logging and stats. Only the app-run record's failedRecords is affected.
  • IT cleanup: DataRetentionAppIT#test_retentionRun_deletesExpiredWorkflowRunsButKeepsEachEntitysLatest inserts runs, states and live-process rows directly, so TestNamespace cleanup cannot see them. They are now removed in a finally, including when seeding or the app run fails part way. The assertions moved into a helper.
  • Conventions (java.md): nullOrEmpty instead of isEmpty(); final on the new unchanged locals; named constants for the SQL fragments that ListFilterTest asserts.

Not changed: the ListFilterTest dialect test keeps mocking DatasourceConfig. That is how the existing tests in that file switch dialects, and DataRetentionAppIT covers both real databases.

Type of change:

  • Chore / code quality (no functional change)

Tests:

  • Unit: ListFilterTest 61/0, DataRetentionTest 5/0. aFailedWorkflowRunPageIsChargedOnePageOfRuns fails 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

RetriggerView in GreptileConfidence 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.

  • Workflow-run cleanup counts a failed page at its actual page size.
  • The retention test removes its directly seeded workflow history afterward.
  • Java cleanup and filter tests use shared empty checks and named SQL text.

Reviews (2) · Last reviewed commit: "test(governance): pin the one-page failu..." · Reviewed by Greptile

- 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.
@yan-3005
yan-3005 requested a review from a team as a code owner October 23, 2026 06:27
@yan-3005
yan-3005 requested review from sonika-shah and a balanced review from Copilot October 23, 2026 06:27

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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 backend safe to test Add this label to run secure Github workflows on PRs labels Oct 23, 2026
Comment on lines +326 to +330
drainInBatches(
"workflow_runs",
retention::deleteNextPage,
deleted -> retention.isDrained(),
WORKFLOW_RUN_PAGE_SIZE);

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 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!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +653 to +656
String entity,
Supplier<Integer> deleteFunction,
IntPredicate drainedWhen,
int failedRowsPerBatch) {

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 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.

Suggested change
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!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 06:37

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown
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.

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

@yan-3005
yan-3005 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 4dae5d5 Oct 23, 2026
87 of 90 checks passed
@yan-3005
yan-3005 deleted the chore/workflow-run-retention-review-fixes branch October 23, 2026 07:52
@yan-3005 yan-3005 self-assigned this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 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.

3 participants