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. |
|
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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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 4b50a8f. Configure here.

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
Medium risk because it changes a destructive data-deletion script, expanding what can be deleted via new CLI filters and a new Postgres deletion strategy; mistakes could remove more data than intended despite added confirmations/validation.
Overview
Makes the Gerrit cleanup script reusable and safer by replacing hardcoded delete criteria with validated CLI flags (
--type,--before-date) plus a--yes/-yconfirmation bypass and improved--help/warnings.Changes execution flow to do pre-flight Tinybird row counts, require an interactive confirmation by default, delete matching Postgres
activityRelationsvia 10k chunked batches (no longer driven by Tinybird ID queries), then trigger Tinybird delete jobs and persist job IDs/results to/tmpwhile waiting (up to 6h) for completion. Also adds acleanup-gerrit-activitiesnpm script entry.Reviewed by Cursor Bugbot for commit 8dd1936. Bugbot is set up for automated code reviews on this repo. Configure here.