feat(rescoring): Harmonise and fix rescoring scopes#469
Conversation
Signed-off-by: Jonas Brand (8R0WNI3) <j.brand@sap.com>
Signed-off-by: Jonas Brand (8R0WNI3) <j.brand@sap.com>
Signed-off-by: Jonas Brand (8R0WNI3) <j.brand@sap.com>
📝 WalkthroughWalkthroughRescoring selection logic changed to order candidates purely by creation date rather than scope specificity. Artefact identity construction for scoped rescorings now strips the version field from extra identity for ARTEFACT scope and gates artefact fields by scope. Finding-to-rescoring matching logic was updated to compare normalized, version-stripped extra identities. ChangesRescoring logic updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant findingIsResolved
participant mostSpecificRescoring
participant Rescorings
findingIsResolved->>mostSpecificRescoring: mostSpecificRescoring(applicable_rescorings)
mostSpecificRescoring->>Rescorings: sort by meta.creation_date (desc)
Rescorings-->>mostSpecificRescoring: sorted list
mostSpecificRescoring-->>findingIsResolved: most recent rescoring.data.severity
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
@coderabbitai review |
There was a problem hiding this comment.
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/util.js`:
- Around line 148-151: `mostSpecificRescoring()` is mutating its input by
calling `sort()` directly on the `rescorings` array, which can reorder
`finding.rescorings` and `rescoring.applicable_rescorings` unexpectedly. Update
the function to sort a shallow copy instead of the original array, while keeping
the existing creation-date comparison and return of the first item.
🪄 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: Pro
Run ID: 4ce2d551-7903-4ad2-9c45-234a809ef656
📒 Files selected for processing (3)
src/findings.jssrc/rescoring.jssrc/util.js
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes open-component-model/open-delivery-gear#106
Special notes for your reviewer:
Release note: