fix: 4 improvements — campaign test deletion, review queue triggers, technique link, Jira read-only
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
1. Campaign test deletion: removing a test from a campaign now also
deletes the underlying Test record and recalculates technique status.
2. Review Queue triggers: review_required=True is now also set when
- Sigma/Elastic detection rules are imported for a technique
- A test is validated (coverage status changes)
3. Test detail — Technique link: 'Technique' entry added at the top of
the Details sidebar showing MITRE ID + name as a clickable link to
/techniques/{mitre_id}.
4. Jira panel — read-only on test page: added readOnly + label props to
JiraLinkPanel. TestDetailPage now passes readOnly=true and the test
name as label, hiding Link Issue / Sync / Unlink controls (automatic
Jira creation only — no manual management).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -320,9 +320,28 @@ def remove_test_from_campaign(db: Session, campaign_id: str, campaign_test_id: s
|
||||
for dep in dependents:
|
||||
dep.depends_on = None
|
||||
|
||||
# Keep a reference to the underlying test before deleting the join record
|
||||
test_id = ct.test_id
|
||||
technique_id = None
|
||||
test_obj = db.query(Test).filter(Test.id == test_id).first()
|
||||
if test_obj:
|
||||
technique_id = test_obj.technique_id
|
||||
|
||||
db.delete(ct)
|
||||
db.flush()
|
||||
|
||||
# Also delete the actual test record (it was created for this campaign)
|
||||
if test_obj:
|
||||
db.delete(test_obj)
|
||||
db.flush()
|
||||
|
||||
# Recalculate technique status_global so coverage metrics stay consistent
|
||||
if technique_id:
|
||||
technique = db.query(Technique).filter(Technique.id == technique_id).first()
|
||||
if technique:
|
||||
recalculate_technique_status(db, technique)
|
||||
db.flush()
|
||||
|
||||
|
||||
def activate_campaign(db: Session, campaign_id: str) -> Campaign:
|
||||
"""Activate a campaign, moving it from draft to active.
|
||||
|
||||
Reference in New Issue
Block a user