Skip to content

feat: evidence and lineage improvements - #454

Merged
gusfcarvalho merged 2 commits into
mainfrom
gc-feat-evidence-revamp
Jul 13, 2026
Merged

feat: evidence and lineage improvements#454
gusfcarvalho merged 2 commits into
mainfrom
gc-feat-evidence-revamp

Conversation

@gusfcarvalho

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Copilot AI review requested due to automatic review settings July 13, 2026 15:10
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@gusfcarvalho, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 70b68468-c68f-4ead-bf96-0f04c434b353

📥 Commits

Reviewing files that changed from the base of the PR and between 0612e80 and 7f20b96.

📒 Files selected for processing (12)
  • docs/docs.go
  • docs/swagger.json
  • docs/swagger.yaml
  • internal/api/handler/api.go
  • internal/api/handler/evidence.go
  • internal/api/handler/evidence_test.go
  • internal/api/handler/lineage.go
  • internal/api/handler/lineage_risk_evidence_integration_test.go
  • internal/api/handler/oscal/inventory_integration_test.go
  • internal/service/relational/risks/queries.go
  • internal/service/relational/risks/queries_test.go
  • internal/service/relational/risks/service.go

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + RiskService method 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 gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/api/handler/lineage.go
@gusfcarvalho
gusfcarvalho enabled auto-merge (squash) July 13, 2026 15:35
@gusfcarvalho
gusfcarvalho merged commit 0d920c2 into main Jul 13, 2026
5 checks passed
@gusfcarvalho
gusfcarvalho deleted the gc-feat-evidence-revamp branch July 13, 2026 15:41
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.

2 participants