Skip to content

feat: delete rows from a new table for event persistence - #1575

Merged
mkanoor merged 1 commit into
ansible:mainfrom
mkanoor:aap_77231
Jun 23, 2026
Merged

feat: delete rows from a new table for event persistence#1575
mkanoor merged 1 commit into
ansible:mainfrom
mkanoor:aap_77231

Conversation

@mkanoor

@mkanoor mkanoor commented May 31, 2026

Copy link
Copy Markdown
Contributor

drools creates event records in a new table called drools_ansible_event_record
When an activation is deleted we have to cleanup the records related to this Activation

https://redhat.atlassian.net/browse/AAP-77231

To test it enable event persistence and generate some events check the records in the Event Persistence Database.
Delete the Activation and the related rows for the Activation should get deleted.

Summary by CodeRabbit

  • Bug Fixes

    • Cleanup now removes an additional Drools persistence table so those records are deleted during cleanup operations.
  • Tests

    • Integration tests and assertions updated to reflect the new deletion target, adjusted deletion counts, and additional warnings for missing tables.

@mkanoor
mkanoor requested a review from a team as a code owner May 31, 2026 20:17
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mkanoor, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 33 minutes and 6 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 40f5f341-6de9-416f-bfa8-879f708af8ba

📥 Commits

Reviewing files that changed from the base of the PR and between 12ad335 and ef0a312.

📒 Files selected for processing (2)
  • src/aap_eda/services/activation/drools_cleanup.py
  • tests/integration/services/activation/test_drools_cleanup.py
📝 Walkthrough

Walkthrough

Adds the drools_ansible_event_record table to the Drools tables cleaned by _delete_rows_by_ha_uuid and updates integration tests to expect deletion and existence-check behaviors for that table.

Changes

Drools Event Record Cleanup

Layer / File(s) Summary
Include drools_ansible_event_record in ha_uuid cleanup
src/aap_eda/services/activation/drools_cleanup.py
The drools_ansible_event_record table is added to the tables iterated over when deleting rows by ha_uuid, ensuring Drools event persistence data is included in cleanup operations.
Update integration test expectations
tests/integration/services/activation/test_drools_cleanup.py
Test assertions and mocks are updated to include drools_ansible_event_record in expected deletion result maps, DELETE call counts, and missing-table side effects.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding deletion of rows from a new table (drools_ansible_event_record) for event persistence cleanup.
Description check ✅ Passed The description covers what is being changed (new table cleanup), why it's needed (activation deletion requires related record cleanup), and provides testing instructions and a link to the related Jira issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/aap_eda/services/activation/drools_cleanup.py`:
- Line 253: The integration test that asserts the output shape and DELETE call
count for the function _delete_rows_by_ha_uuid must be updated to include the
new table key "drools_ansible_event_record" and to expect five DELETE calls
instead of four; locate the test that currently asserts exactly 4 keys and 4
DELETE FROM calls (the test covering drools cleanup) and add the new key to the
expected result map and change the expected delete count to 5 so the test
reflects the updated deletion behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 35b2c5c1-509d-4466-ab43-bcfbf742a7f5

📥 Commits

Reviewing files that changed from the base of the PR and between e823d44 and 52cbec6.

📒 Files selected for processing (1)
  • src/aap_eda/services/activation/drools_cleanup.py

Comment thread src/aap_eda/services/activation/drools_cleanup.py
@codecov-commenter

codecov-commenter commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.37%. Comparing base (fafd875) to head (ef0a312).

@@           Coverage Diff           @@
##             main    #1575   +/-   ##
=======================================
  Coverage   92.37%   92.37%           
=======================================
  Files         244      244           
  Lines       11219    11219           
=======================================
  Hits        10363    10363           
  Misses        856      856           
Flag Coverage Δ
unit-int-tests-3.11 92.37% <ø> (ø)
unit-int-tests-3.12 92.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/aap_eda/services/activation/drools_cleanup.py 95.69% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

drools creates event records in a new table called
drools_ansible_event_record
When an activation is deleted we have to cleanup the records
related to this Activation

https://redhat.atlassian.net/browse/AAP-77231
@sonarqubecloud

Copy link
Copy Markdown

@mkanoor
mkanoor merged commit 2d5f6da into ansible:main Jun 23, 2026
7 checks passed
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.

4 participants