fix(tests): apply user edits when creating test from template
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

The form captured name/description/platform/procedure/tool edits but
never sent them — the created test always used the raw template values.

- TestTemplateInstantiate schema: add optional override fields
  (name, description, platform, procedure_text, tool_used)
- create_test_from_template service: accept *_override kwargs;
  use override value when provided, fall back to template value
- Router: pass all override fields from payload to service
- Frontend API createTestFromTemplate: accept overrides object, spread into body
- TestFromTemplateForm: pass all form state values as overrides

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kitos
2026-05-28 16:38:40 +02:00
parent fa8e7f311b
commit b248c2816e
5 changed files with 45 additions and 8 deletions

View File

@@ -72,7 +72,17 @@ class TestTemplateSummary(BaseModel):
class TestTemplateInstantiate(BaseModel):
"""Payload to create a real test from an existing template."""
"""Payload to create a real test from an existing template.
Optional override fields take precedence over the template values when provided.
"""
template_id: uuid.UUID
technique_id: str # accepts both UUID and MITRE ID (e.g. "T1059.001")
# User-editable overrides (if omitted the template value is used)
name: str | None = None
description: str | None = None
platform: str | None = None
procedure_text: str | None = None
tool_used: str | None = None