Skip to content

chore: expand gerrit delete activities script#4080

Open
joanagmaia wants to merge 7 commits into
mainfrom
chore/expand-gerrit-delete-activities-script
Open

chore: expand gerrit delete activities script#4080
joanagmaia wants to merge 7 commits into
mainfrom
chore/expand-gerrit-delete-activities-script

Conversation

@joanagmaia
Copy link
Copy Markdown
Contributor

@joanagmaia joanagmaia commented May 6, 2026

Summary

  • Replaced hardcoded type and date filters with --type and --before-date CLI flags, making the script
    reusable for different cleanup scenarios without code changes.
  • Added a pre-flight count step that queries all three stores (Postgres, Tinybird activities, Tinybird
    activityRelations) in parallel before any deletion, so the operator can see the blast radius upfront.
  • Added an interactive confirmation prompt (skippable with --yes/-y) to prevent accidental mass deletions.
  • Refactored Postgres deletion from a Tinybird-ID-driven batched approach to a direct chunked DELETE ...
    WHERE ... LIMIT 10k loop, removing the dependency on Tinybird to drive the Postgres cleanup.
  • Added input validation for --before-date (YYYY-MM-DD format check) and --type (enum guard against
    VALID_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/-y confirmation bypass and improved --help/warnings.

Changes execution flow to do pre-flight Tinybird row counts, require an interactive confirmation by default, delete matching Postgres activityRelations via 10k chunked batches (no longer driven by Tinybird ID queries), then trigger Tinybird delete jobs and persist job IDs/results to /tmp while waiting (up to 6h) for completion. Also adds a cleanup-gerrit-activities npm script entry.

Reviewed by Cursor Bugbot for commit 8dd1936. Bugbot is set up for automated code reviews on this repo. Configure here.

joanagmaia added 2 commits May 6, 2026 12:23
…es as filters

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
@joanagmaia joanagmaia requested review from Copilot and mbani01 May 6, 2026 13:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Comment thread services/apps/script_executor_worker/src/bin/cleanup-gerrit-activities.ts Outdated
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings May 6, 2026 16:23
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings May 11, 2026 15:51
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants