fix(tests): keep free-text round fields in place on reopen, only blank verdicts
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled

Only the per-round verdict/timing fields (attack_success, execution
start/end for red; detection_result, containment_result, detection/
containment time for blue) get cleared on reopen — the operator must
answer those fresh for each round, and the prior round's answer stays
visible via round_history + the archived Phase Timeline card. Free-text
fields (procedure_text, tool_used, red_summary, blue_summary) are no
longer cleared: the operator edits them in place for the new round
instead of retyping everything from scratch.
This commit is contained in:
kitos
2026-07-13 12:46:46 +02:00
parent 8fe38dc661
commit b48de743b6
2 changed files with 23 additions and 15 deletions
+12 -7
View File
@@ -740,9 +740,11 @@ class TestReviewDecisions:
@patch("app.services.test_workflow_service.log_action")
def test_reopen_red_review_archives_round_and_resets_fields(self, mock_log):
"""Reopening must not erase what Red already submitted — it archives
the round (visible via round_history) and only then blanks the live
fields for a fresh attempt, bumping the round counter."""
"""Reopening must not erase what Red already submitted. The round is
archived (visible via round_history) and only the per-round verdict
fields (attack_success, execution start/end) are blanked for a fresh
answer — free-text fields (procedure, tool, summary) stay in place
for the operator to edit, not retype from scratch."""
from app.models.test_round_history import TestRoundHistory
test = _make_test(
@@ -766,10 +768,12 @@ class TestReviewDecisions:
assert archived[0].red_summary == "Got a shell."
assert archived[0].review_notes == "incomplete evidence"
assert test.procedure_text is None
assert test.tool_used is None
assert test.procedure_text == "ran mimikatz"
assert test.tool_used == "mimikatz"
assert test.red_summary == "Got a shell."
assert test.attack_success is None
assert test.red_summary is None
assert test.execution_start_time is None
assert test.execution_end_time is None
assert test.red_round_number == 2
@patch("app.services.test_workflow_service.log_action")
@@ -797,7 +801,8 @@ class TestReviewDecisions:
assert archived[0].review_notes == "missing containment steps"
assert test.detection_result is None
assert test.blue_summary is None
assert test.containment_result is None
assert test.blue_summary == "Caught it via EDR."
assert test.blue_round_number == 2
@patch("app.services.test_workflow_service.log_action")