Skip to content

feat: risk templates as templateable objects#363

Merged
gusfcarvalho merged 5 commits into
mainfrom
gc-feat-templeatable-risk-templates
Mar 26, 2026
Merged

feat: risk templates as templateable objects#363
gusfcarvalho merged 5 commits into
mainfrom
gc-feat-templeatable-risk-templates

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 March 26, 2026 12:36
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

Adds “templateable” risk templates by introducing a label schema + dedupe label keys, and supporting Go-template rendering for key risk template fields. This extends the risk-template system so a single template can generate multiple distinct risks (e.g., per CVE) and dynamically render titles/statements from evidence labels.

Changes:

  • Add label-schema and dedupe-label-keys to risk templates (DB model + service validation + API + SDK).
  • Add templated fields (*-template) for title/statement/likelihood-hint/impact-hint and render them in the risk evidence worker.
  • Update migrations/tests and regenerate Swagger docs to reflect the expanded API surface.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/types/types.go Extends SDK RiskTemplate type with template fields, dedupe keys, and label schema.
internal/tests/migrate.go Includes new label schema model in test migrator up/down.
internal/service/worker/risk_evidence_worker_test.go Adds coverage for dedupe key computation and template rendering into created risks.
internal/service/worker/risk_evidence_worker.go Implements label-based dedupe keys and template rendering when creating risks.
internal/service/relational/templates/template_renderer.go Exposes template rendering helper for cross-package use.
internal/service/relational/templates/risk_template_service_test.go Adds tests for create/update/batch upsert with label schema + templates and validation cases.
internal/service/relational/templates/risk_template_service.go Adds payload fields, persistence, replacement semantics, and validation for schema/dedupe/template references.
internal/service/relational/templates/models.go Adds DB columns for templated fields/dedupe keys and new risk_template_label_schema_fields model.
internal/service/migrator.go Adds new model to global migrate up/down ordering.
internal/api/handler/templates/risk_template.go Wires new request/response fields for risk template CRUD + batch upsert.
docs/swagger.yaml Documents new request/response fields and schema definitions.
docs/swagger.json Generated Swagger JSON update for the new fields.
docs/docs.go Embedded Swagger docs updated accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/service/worker/risk_evidence_worker.go Outdated
Comment thread internal/service/relational/templates/risk_template_service.go
Comment thread internal/service/relational/templates/risk_template_service.go
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 15 out of 15 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread templateable-risk-trajectory.md Outdated
Comment thread docs/authz-design.md Outdated
Comment thread internal/service/worker/risk_evidence_worker.go
Comment thread internal/service/relational/templates/template_renderer.go Outdated
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Copilot AI review requested due to automatic review settings March 26, 2026 13:20
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 14 out of 14 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/worker/risk_evidence_worker.go Outdated
Comment thread internal/service/worker/risk_evidence_worker.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 14 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/service/worker/risk_evidence_worker.go
@gusfcarvalho gusfcarvalho merged commit 40bbf86 into main Mar 26, 2026
8 checks passed
@gusfcarvalho gusfcarvalho deleted the gc-feat-templeatable-risk-templates branch March 26, 2026 13:52
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