Skip to content

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

Open
mkanoor wants to merge 1 commit into
ansible:mainfrom
mkanoor:aap_77231
Open

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

Conversation

@mkanoor
Copy link
Copy Markdown
Contributor

@mkanoor mkanoor commented May 31, 2026

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

coderabbitai Bot commented May 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 3a6ecb62-739b-4f0b-964d-057a0e022920

📥 Commits

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

📒 Files selected for processing (2)
  • src/aap_eda/services/activation/drools_cleanup.py
  • tests/integration/services/activation/test_drools_cleanup.py
✅ Files skipped from review due to trivial changes (1)
  • 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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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

codecov-commenter commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.17%. Comparing base (d9275fc) to head (12ad335).

@@           Coverage Diff           @@
##             main    #1575   +/-   ##
=======================================
  Coverage   92.17%   92.17%           
=======================================
  Files         244      244           
  Lines       11214    11214           
=======================================
  Hits        10337    10337           
  Misses        877      877           
Flag Coverage Δ
unit-int-tests-3.11 92.17% <ø> (ø)
unit-int-tests-3.12 92.17% <ø> (ø)

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

sonarqubecloud Bot commented Jun 1, 2026

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.

3 participants