Conversation
PR #17422 removed UpsertRisk calls from reprocessImageComponentRisk and reprocessNodeComponentRisk because the risk table rows were never read. However, UpsertRisk had a side effect: it called ranker.Add(), which populated the in-memory component ranker. Downstream, updateComponentRisk in the image/node datastores reads from this ranker before every DB write, overwriting component.RiskScore with the ranker value (0 for missing entries). This caused image_component_v2.riskscore to always be 0. Fix: call ranker.Add() directly after calculating the risk score. Tests: add regression tests verifying the ranker is updated. Partially generated by AI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
🚀 Build Images ReadyImages are ready for commit 2fcf344. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-571-g2fcf3441a8 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds tests verifying component risk scores persist through image upserts and changes the risk manager to immediately record computed component risk scores in in-memory rankers during reprocessing. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19841 +/- ##
=======================================
Coverage 49.60% 49.61%
=======================================
Files 2763 2763
Lines 208339 208351 +12
=======================================
+ Hits 103342 103364 +22
+ Misses 97331 97319 -12
- Partials 7666 7668 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add TestComponentRiskScorePersistedToDB to both v1 and v2 image datastore test suites. These tests pre-populate the component ranker with known scores, upsert an image, then read back from DB to verify the scores survive through updateComponentRisk and into the database. Partially generated by AI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a4c1d5f to
2fcf344
Compare
Description
fix: restore component risk score population in ranker
PR #17422 removed UpsertRisk calls from reprocessImageComponentRisk and
reprocessNodeComponentRisk because the risk table rows were never read.
However, UpsertRisk had a side effect: it called ranker.Add(), which
populated the in-memory component ranker. Downstream, updateComponentRisk
in the image/node datastores reads from this ranker before every DB write,
overwriting component.RiskScore with the ranker's value (0 for missing
entries). This caused image_component_v2.riskscore to always be 0.
Fix: call ranker.Add() directly after calculating the risk score.
Tests: add regression tests verifying the ranker is updated.
Partially generated by AI.
User-facing documentation
Testing and quality
Automated testing
How I validated my change
Added a unit test to catch this regression in the future. Also tested manually.