feat: risk scores#378
Conversation
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces persistent, append-only risk score snapshots and exposes them via new API endpoints to support score history per risk and aggregate timeseries reporting (globally and SSP-scoped).
Changes:
- Add
risk_scoresrelational model + migrations/indexes and record score snapshots on key risk lifecycle events (create, status change, score change, review, remediation flows). - Add API endpoints to fetch
/risks/{id}/score-historyand/risks/score-timeseries(and SSP-scoped equivalents), plus Swagger updates. - Extend risk update flow to detect likelihood/impact changes, emit
score_updatedevents, and record snapshots.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/service/relational/risks/scores.go | New RiskScore model + snapshot recording + history/timeseries query logic |
| internal/service/relational/risks/service.go | Record score snapshots during create/update/accept/review/orphan remediation |
| internal/api/handler/risks.go | Add score history + timeseries endpoints and update handling for score changes |
| internal/service/worker/risk_evidence_worker.go | Record score snapshots on risk reopen/create/remediate paths |
| internal/service/relational/risks/models.go | Add risk_scores indexes behind table-exists guard |
| internal/service/relational/risks/events.go | Add score_updated event type + details rendering |
| internal/service/migrator.go / internal/tests/migrate.go | Include RiskScore in migrate up/down and test migrators |
| internal/service/relational/risks/*_test.go + internal/api/handler/risks_integration_test.go | Unit + integration tests for snapshots and timeseries behavior |
| docs/swagger.yaml / docs/swagger.json / docs/docs.go | Document new endpoints and response types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.