chore: expand gerrit delete activities script#4080
Conversation
…es as filters Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
2 similar comments
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 383dede. Configure here.
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |

Summary
--typeand--before-dateCLI flags, making the scriptreusable for different cleanup scenarios without code changes.
activityRelations) in parallel before any deletion, so the operator can see the blast radius upfront.
--yes/-y) to prevent accidental mass deletions.WHERE ... LIMIT 10k loop, removing the dependency on Tinybird to drive the Postgres cleanup.
--before-date(YYYY-MM-DD format check) and--type(enum guard againstVALID_GERRIT_TYPES), with an explicit warning when neither filter is provided (would delete all Gerrit
activities).
Note
Medium Risk
Moderate risk because it changes a destructive cleanup workflow (Postgres deletes + Tinybird delete jobs) and broadens what can be targeted via CLI filters; safeguards were added but misuse could still cause large deletions.
Overview
Extends the Gerrit activities cleanup tooling by adding a
cleanup-gerrit-activitiesscript and making the cleanup script configurable via CLI flags (--type,--before-date,--tb-token,--dry-run,--yes).The script now does a pre-flight count across PostgreSQL and both Tinybird datasources, prompts for explicit confirmation by default, and switches Postgres cleanup to a direct 10k-chunked
DELETEloop (rather than querying IDs from Tinybird) while triggering and optionally waiting for Tinybird delete jobs, persisting job IDs/results to/tmp.Reviewed by Cursor Bugbot for commit b7386b1. Bugbot is set up for automated code reviews on this repo. Configure here.