Skip to content

feat: risk scores#378

Merged
gusfcarvalho merged 4 commits into
mainfrom
codex/risk-score
Apr 14, 2026
Merged

feat: risk scores#378
gusfcarvalho merged 4 commits into
mainfrom
codex/risk-score

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 April 13, 2026 15:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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_scores relational 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-history and /risks/score-timeseries (and SSP-scoped equivalents), plus Swagger updates.
  • Extend risk update flow to detect likelihood/impact changes, emit score_updated events, 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.

Comment thread internal/service/relational/risks/service.go Outdated
Comment thread internal/service/worker/risk_evidence_worker.go Outdated
Comment thread internal/api/handler/risks.go
Comment thread internal/api/handler/risks.go Outdated
Copilot AI review requested due to automatic review settings April 14, 2026 09:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread internal/service/relational/risks/scores.go
Comment thread internal/api/handler/risks.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@gusfcarvalho gusfcarvalho merged commit b71da3a into main Apr 14, 2026
8 checks passed
@gusfcarvalho gusfcarvalho deleted the codex/risk-score branch April 14, 2026 09:26
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