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
+11 -8
View File
@@ -405,12 +405,14 @@ def reopen_red_review(db: Session, test: Test, user: User, notes: str) -> Test:
test.red_review_at = datetime.utcnow()
test.red_review_notes = notes.strip()
test.red_round_number = (test.red_round_number or 1) + 1
# New sheet — the operator fills these in fresh for this round; the
# values that were just archived stay visible via round_history.
test.procedure_text = None
test.tool_used = None
# Only the per-round verdict/timing fields get a blank slate — the
# operator must explicitly answer "was THIS attempt successful" and
# "when did THIS attempt run" rather than silently inheriting round 1's
# answer. The old values aren't lost: they're in round_history and
# shown on the archived Phase Timeline card. Free-text fields
# (procedure, tool, summary) are NOT cleared — the operator edits them
# in place for the new round instead of retyping from scratch.
test.attack_success = None
test.red_summary = None
test.execution_start_time = None
test.execution_end_time = None
db.flush()
@@ -640,13 +642,14 @@ def reopen_blue_review(db: Session, test: Test, user: User, notes: str) -> Test:
test.blue_review_at = datetime.utcnow()
test.blue_review_notes = notes.strip()
test.blue_round_number = (test.blue_round_number or 1) + 1
# New sheet for this round; the archived values above remain visible
# via round_history.
# Same split as the red side: verdict/timing fields get a blank slate
# for this round (old values live on in round_history + the archived
# Phase Timeline card), but blue_summary is free text the operator
# edits in place rather than retyping.
test.detection_result = None
test.containment_result = None
test.detection_time = None
test.containment_time = None
test.blue_summary = None
db.flush()
log_action(