feat: evidence and lineage improvements - #454
Conversation
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. 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, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
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 |
There was a problem hiding this comment.
Pull request overview
This PR improves evidence↔risk traceability and lineage output by adding a dedicated API route to list risks associated with an evidence stream (cross-SSP), plus enriching lineage risk nodes with the owning SSP identity/title so UIs can group and label risk nodes without extra round trips.
Changes:
- Add a risk query helper +
RiskServicemethod to fetch risks linked to a given evidence stream, preloading SSP metadata. - Add
GET /evidence/{id}/risks(authenticated + risk read guard) returning risks linked to the evidence record’s stream. - Enrich lineage risk nodes with owning SSP id/title (and load the title in scoped lineage views), with integration test coverage.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/service/relational/risks/service.go | Adds ListForEvidenceStream for cross-SSP evidence-stream risk lookups with SSP metadata preloaded. |
| internal/service/relational/risks/queries.go | Introduces ApplyEvidenceStreamFilter to join risk_evidence_links by evidence stream UUID. |
| internal/service/relational/risks/queries_test.go | Adds unit tests for ApplyEvidenceStreamFilter behavior across SSPs/streams. |
| internal/api/handler/evidence.go | Adds /evidence/{id}/risks endpoint + wiring in EvidenceHandler with response shape and swagger annotations. |
| internal/api/handler/api.go | Wires the new evidence→risk route under JWT + riskGuard.Read() and injects RiskService into EvidenceHandler. |
| internal/api/handler/lineage.go | Adds SSP id/title fields to risk lineage nodes and loads SSP title for scoped lineage builds. |
| internal/api/handler/lineage_risk_evidence_integration_test.go | Updates integration test to assert lineage risk nodes carry SSP id/title. |
| internal/api/handler/oscal/inventory_integration_test.go | Updates handler construction for new NewEvidenceHandler signature. |
| internal/api/handler/evidence_test.go | Updates test construction for new NewEvidenceHandler signature. |
| docs/swagger.yaml | Documents the new endpoint and response schema; updates lineage node schema fields. |
| docs/swagger.json | Generated OpenAPI JSON updates for the new endpoint and schemas. |
| docs/docs.go | Generated docs template updates reflecting the new OpenAPI content. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gusfcarvalho
left a comment
There was a problem hiding this comment.
LGTM / approving in spirit (GitHub blocks self-approval on your own PR).
Builds clean, vet clean, targeted tests pass, CI green. New tests are thorough (positive/negative/unknown-stream), the evidence→risk route is correctly auth-gated behind the risk read guard, and the composite PK on risk_evidence_links rules out duplicate risks from the new JOIN.
One non-blocking Low inline note: loadSSPTitle now returns HTTP 500 on a valid-format-but-nonexistent sspId, where the scoped path previously degraded to an empty tree. Worth a follow-up, not a blocker.
No description provided.