Fix Session.delete() in gap analysis cleanup (#826, rebased #827) - #1099
Conversation
SQLAlchemy 2.x session.delete() returns None, so the old rowcount log never ran. Count deletions explicitly. Test inserts cache rows directly because add_gap_analysis_result skips empty primary payloads. Co-authored-by: northdpole <morfeas3000@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. Summary by CodeRabbit
WalkthroughThe cleanup method now counts deleted gap-analysis rows and logs one aggregate message with the node name. A new test verifies matching-row deletion, unrelated-row preservation, the return count, and logging. ChangesGap analysis cleanup
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The cleanup explicitly counts matching rows, deletes them correctly, and has focused coverage for deletion and aggregate logging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
* origin/main: Rework OWASP mapping importers to load shared eval fixtures.
Summary
main.session.delete()returnsNonein SQLAlchemy 2.x, so the oldresult.rowcountlog never ran. Count deletions explicitly and log once.GapAnalysisResultsrows directly becauseadd_gap_analysis_resultnow skips empty primary payloads.Original work by @akashrajeev. Maintainer rebase so we can land it without waiting on a conflicted fork.
Test plan
python -m unittest application.tests.db_test.TestDB.test_delete_gapanalysis_results_for_deletes_and_logs_countdb_test/ fullmake testCloses #826
Supersedes #827
Made with Cursor