Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
chore(pr6): apply ruff format + regenerate openapi for rule tuning workbench
Beenu Aroraa1be668a88ea
diff --git a/docs/openapi.yaml b/docs/openapi.yamlindex df9ce9b85..c8aec9715 100644--- a/docs/openapi.yaml+++ b/docs/openapi.yaml@@ -353,6 +353,83 @@ paths:$ref: '#/components/schemas/AlertStatsResponse'security:- HTTPBearer: []+ /api/v1/alerts/queue:+ get:+ tags:+ - alerts+ summary: Get Alert Queue+ description: 'Investigation Queue workbench feed.+++ Returns the prioritised list of alerts the analyst should work on++ next: alerts assigned to them, followed by unassigned++ critical/high alerts, ordered by SLA due time.+++ The endpoint also returns ``counts`` for both buckets unconditionally++ so the topbar badge and the workbench tabs can render without an++ extra round-trip.'+ operationId: get_alert_queue_api_v1_alerts_queue_get+ security:+ - HTTPBearer: []+ parameters:+ - name: owner+ in: query+ required: false+ schema:+ enum:+ - me+ - unassigned+ - all+ type: string+ default: all+ title: Owner+ - name: period+ in: query+ required: false+ schema:+ enum:+ - 24h+ - 7d+ - 30d+ - all+ type: string+ default: all+ title: Period+ - name: page+ in: query+ required: false+ schema:+ type: integer+ minimum: 1+ default: 1+ title: Page+ - name: page_size+ in: query+ required: false+ schema:+ type: integer+ maximum: 200+ minimum: 1+ default: 50+ title: Page Size+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/QueueResponse'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'/api/v1/alerts/{alert_id}:get:tags:@@ -448,6 +525,43 @@ paths:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'+ /api/v1/alerts/{alert_id}/claim:+ post:+ tags:+ - alerts+ summary: Claim Alert Endpoint+ description: 'Atomically claim an unassigned alert for the current user.+++ Returns ``409 Conflict`` if the alert is already assigned to someone++ else — the claim is a compare-and-set on ``assigned_to_id``, so two++ analysts racing for the same alert never both win.'+ operationId: claim_alert_endpoint_api_v1_alerts__alert_id__claim_post+ security:+ - HTTPBearer: []+ parameters:+ - name: alert_id+ in: path+ required: true+ schema:+ type: string+ format: uuid+ title: Alert Id+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/AlertResponse'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'/api/v1/alerts/{alert_id}/snooze:post:tags:@@ -3028,161 +3142,408 @@ paths:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'- /api/v1/federated/backends:+ /api/v1/detection/tuning:get:tags:- - federated-search- summary: List Federated Backends- description: 'List the connector instances that ``POST /search`` would fan out- to.--- Useful for the wizard preview ("you''ll search 1 Splunk + 1 Elastic")-- and for the SDK to build sensible default ``connector_ids`` lists.'- operationId: list_federated_backends_api_v1_federated_backends_get- responses:- '200':- description: Successful Response- content:- application/json:- schema:- $ref: '#/components/schemas/FederatedBackendsResponse'- security:- - HTTPBearer: []- /api/v1/federated/search:- post:- tags:- - federated-search- summary: Federated Search- description: 'Run a unified query across every federated-capable connector.+ - detection+ summary: Get Tuning Workbench+ description: 'Project every rule the tenant can tune into a workbench feed.- Per-backend errors do not fail the call. The response always+ The summary block is computed across the *entire classified population*- carries a ``sources[]`` array describing the verdict for each+ (not the current page), so the header tiles stay stable as analysts page.- backend that was attempted; the merged ``rows[]`` only contains+ Dismissed rules are excluded by default — pass ``include_dismissed=true``- rows from the ``ok`` sources.'- operationId: federated_search_api_v1_federated_search_post- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/FederatedSearchRequest'- required: true+ when auditing what''s been hidden.'+ operationId: get_tuning_workbench_api_v1_detection_tuning_get+ security:+ - HTTPBearer: []+ parameters:+ - name: severity+ in: query+ required: false+ schema:+ anyOf:+ - type: string+ - type: 'null'+ description: Filter by rule severity (info/low/medium/high/critical).+ title: Severity+ description: Filter by rule severity (info/low/medium/high/critical).+ - name: suggestion+ in: query+ required: false+ schema:+ anyOf:+ - enum:+ - disable+ - add_suppression+ - raise_threshold+ - tune_confidence+ - review_stale+ - healthy+ type: string+ - type: 'null'+ description: Filter to a single suggestion lane.+ title: Suggestion+ description: Filter to a single suggestion lane.+ - name: search+ in: query+ required: false+ schema:+ anyOf:+ - type: string+ maxLength: 200+ - type: 'null'+ description: Substring match on name/description/category.+ title: Search+ description: Substring match on name/description/category.+ - name: enabled_only+ in: query+ required: false+ schema:+ type: boolean+ description: Hide rules whose status != 'active'.+ default: false+ title: Enabled Only+ description: Hide rules whose status != 'active'.+ - name: include_dismissed+ in: query+ required: false+ schema:+ type: boolean+ description: Show rules previously dismissed from the workbench.+ default: false+ title: Include Dismissed+ description: Show rules previously dismissed from the workbench.+ - name: page+ in: query+ required: false+ schema:+ type: integer+ minimum: 1+ default: 1+ title: Page+ - name: page_size+ in: query+ required: false+ schema:+ type: integer+ maximum: 100+ minimum: 1+ default: 50+ title: Page Sizeresponses:'200':description: Successful Responsecontent:application/json:schema:- $ref: '#/components/schemas/FederatedSearchResponse'+ $ref: '#/components/schemas/TuningResponse''422':description: Validation Errorcontent:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'+ /api/v1/detection/tuning/summary:+ get:+ tags:+ - detection+ summary: Get Tuning Summary+ description: 'Cheap summary-only endpoint for sidebar badges and the++ /console dashboard tile.'+ operationId: get_tuning_summary_api_v1_detection_tuning_summary_get+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/TuningSummary'security:- HTTPBearer: []- /api/v1/graph/attack-path/{case_id}:- get:+ /api/v1/detection/tuning/{rule_id}/apply:+ post:tags:- - graph- summary: Get attack path graph for a case- description: 'Traverse the knowledge graph from a Case node to reconstruct the- full+ - detection+ summary: Apply Tuning Endpoint+ description: 'Mechanically apply a tuning suggestion to a single rule.- attack path: Case → Alerts → Hosts/Users → IOCs → MITRE Techniques.+ Supports ``raise_threshold``, ``add_suppression``, ``disable``, and- Falls back to a relational reconstruction (Case → Alerts → Techniques)+ ``acknowledge`` (no-op + audit). Every mutation bumps- when the Neo4j graph backend is offline so the demo Attack Path UI+ ``DetectionRule.version`` and writes a ``detection.tuning.apply`` audit- keeps working without a graph database deployed.'- operationId: get_attack_path_api_v1_graph_attack_path__case_id__get+ log entry. Returns the re-projected entry so the UI can refresh in place.'+ operationId: apply_tuning_endpoint_api_v1_detection_tuning__rule_id__apply_postsecurity:- HTTPBearer: []parameters:- - name: case_id+ - name: rule_idin: pathrequired: trueschema:type: string- title: Case Id- - name: max_depth- in: query- required: false- schema:- type: integer- maximum: 10- minimum: 1- default: 6- title: Max Depth+ format: uuid+ title: Rule Id+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/ApplyTuningRequest'responses:'200':description: Successful Responsecontent:application/json:schema:- $ref: '#/components/schemas/AttackPathResponse'+ $ref: '#/components/schemas/TuningEntry''422':description: Validation Errorcontent:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'- /api/v1/graph/blast-radius/{entity_type}/{entity_id}:- get:+ /api/v1/detection/tuning/{rule_id}/dismiss:+ post:tags:- - graph- summary: Compute blast radius from an entity- description: 'Compute the blast radius starting from a Host, User, or IOC node.-- Returns all entities reachable within `hops` and a severity score.'- operationId: get_blast_radius_api_v1_graph_blast_radius__entity_type___entity_id__get+ - detection+ summary: Dismiss Tuning Endpoint+ description: Hide a rule from the default workbench view without changing semantics.+ operationId: dismiss_tuning_endpoint_api_v1_detection_tuning__rule_id__dismiss_postsecurity:- HTTPBearer: []parameters:- - name: entity_type+ - name: rule_idin: pathrequired: trueschema:type: string- title: Entity Type- - name: entity_id- in: path+ format: uuid+ title: Rule Id+ requestBody:required: true- schema:- type: string- title: Entity Id- - name: hops- in: query- required: false- schema:- type: integer- maximum: 6- minimum: 1- default: 3- title: Hops+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/DismissTuningRequest'responses:'200':description: Successful Responsecontent:application/json:schema:- $ref: '#/components/schemas/BlastRadiusResponse'+ $ref: '#/components/schemas/TuningEntry''422':description: Validation Errorcontent:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'- /api/v1/graph/neighbors/{entity_type}/{entity_id}:- get:+ /api/v1/detection/tuning/{rule_id}/auto_tune:+ post:+ tags:+ - detection+ summary: Set Auto Tune Endpoint+ description: 'Flip the per-rule ``auto_tune`` opt-in flag.+++ The flag is stored under ``suppression_config.auto_tune`` and is read by++ future automated tuners — flipping it does *not* trigger any immediate++ rule mutation.'+ operationId: set_auto_tune_endpoint_api_v1_detection_tuning__rule_id__auto_tune_post+ security:+ - HTTPBearer: []+ parameters:+ - name: rule_id+ in: path+ required: true+ schema:+ type: string+ format: uuid+ title: Rule Id+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/AutoTuneRequest'+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/TuningEntry'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/federated/backends:+ get:+ tags:+ - federated-search+ summary: List Federated Backends+ description: 'List the connector instances that ``POST /search`` would fan out+ to.+++ Useful for the wizard preview ("you''ll search 1 Splunk + 1 Elastic")++ and for the SDK to build sensible default ``connector_ids`` lists.'+ operationId: list_federated_backends_api_v1_federated_backends_get+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/FederatedBackendsResponse'+ security:+ - HTTPBearer: []+ /api/v1/federated/search:+ post:+ tags:+ - federated-search+ summary: Federated Search+ description: 'Run a unified query across every federated-capable connector.+++ Per-backend errors do not fail the call. The response always++ carries a ``sources[]`` array describing the verdict for each++ backend that was attempted; the merged ``rows[]`` only contains++ rows from the ``ok`` sources.'+ operationId: federated_search_api_v1_federated_search_post+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/FederatedSearchRequest'+ required: true+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/FederatedSearchResponse'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'+ security:+ - HTTPBearer: []+ /api/v1/graph/attack-path/{case_id}:+ get:+ tags:+ - graph+ summary: Get attack path graph for a case+ description: 'Traverse the knowledge graph from a Case node to reconstruct the+ full++ attack path: Case → Alerts → Hosts/Users → IOCs → MITRE Techniques.+++ Falls back to a relational reconstruction (Case → Alerts → Techniques)++ when the Neo4j graph backend is offline so the demo Attack Path UI++ keeps working without a graph database deployed.'+ operationId: get_attack_path_api_v1_graph_attack_path__case_id__get+ security:+ - HTTPBearer: []+ parameters:+ - name: case_id+ in: path+ required: true+ schema:+ type: string+ title: Case Id+ - name: max_depth+ in: query+ required: false+ schema:+ type: integer+ maximum: 10+ minimum: 1+ default: 6+ title: Max Depth+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/AttackPathResponse'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/graph/blast-radius/{entity_type}/{entity_id}:+ get:+ tags:+ - graph+ summary: Compute blast radius from an entity+ description: 'Compute the blast radius starting from a Host, User, or IOC node.++ Returns all entities reachable within `hops` and a severity score.'+ operationId: get_blast_radius_api_v1_graph_blast_radius__entity_type___entity_id__get+ security:+ - HTTPBearer: []+ parameters:+ - name: entity_type+ in: path+ required: true+ schema:+ type: string+ title: Entity Type+ - name: entity_id+ in: path+ required: true+ schema:+ type: string+ title: Entity Id+ - name: hops+ in: query+ required: false+ schema:+ type: integer+ maximum: 6+ minimum: 1+ default: 3+ title: Hops+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/BlastRadiusResponse'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/graph/neighbors/{entity_type}/{entity_id}:+ get:tags:- graphsummary: Get immediate graph neighbors of an entity@@ -12347,6 +12708,41 @@ components:- last_used_at- created_attitle: ApiKeyOut+ ApplyTuningRequest:+ properties:+ action:+ type: string+ enum:+ - raise_threshold+ - add_suppression+ - disable+ - acknowledge+ title: Action+ note:+ anyOf:+ - type: string+ - type: 'null'+ title: Note+ threshold:+ anyOf:+ - type: integer+ maximum: 1000000.0+ minimum: 1.0+ - type: 'null'+ title: Threshold+ description: Override threshold to set when action='raise_threshold'.+ suppression_reason:+ anyOf:+ - type: string+ maxLength: 255+ - type: 'null'+ title: Suppression Reason+ description: Free-text reason recorded with the suppression placeholder.+ type: object+ required:+ - action+ title: ApplyTuningRequest+ description: Body for ``POST /detection/tuning/{rule_id}/apply``.ApprovalCreateRequest:properties:run_id:@@ -13137,6 +13533,16 @@ components:- access_token- refresh_tokentitle: AuthenticateFinishResponse+ AutoTuneRequest:+ properties:+ enabled:+ type: boolean+ title: Enabled+ type: object+ required:+ - enabled+ title: AutoTuneRequest+ description: Body for ``POST /detection/tuning/{rule_id}/auto_tune``.AutonomyPolicyResponse:properties:tenant_id:@@ -15297,6 +15703,17 @@ components:required:- discoveredtitle: DiscoverResponse+ DismissTuningRequest:+ properties:+ reason:+ anyOf:+ - type: string+ maxLength: 255+ - type: 'null'+ title: Reason+ type: object+ title: DismissTuningRequest+ description: Body for ``POST /detection/tuning/{rule_id}/dismiss``.DriftEntry:properties:ruleId:@@ -19683,22 +20100,240 @@ components:- rows- total_rowstitle: QueryResult- RatingIn:+ QueueAction:properties:- score:+ priority:type: integer- maximum: 5.0- minimum: 1.0- title: Score- comment:+ title: Priority+ action:+ type: string+ title: Action+ risk:+ type: string+ title: Risk+ default: low+ type: object+ required:+ - priority+ - action+ title: QueueAction+ description: 'Top suggested next action for a queue row.+++ Sourced from ``Alert.ai_recommendations``. The lowest-priority++ integer wins (1 = most urgent). String-only legacy values are++ accepted and mapped to ``risk="low"`` with the array index as a++ fallback priority.'+ QueueAsset:+ properties:+ kind:+ type: string+ title: Kind+ description: host | user | ip | asset+ value:+ type: string+ title: Value+ label:anyOf:- type: string- type: 'null'- title: Comment+ title: Labeltype: objectrequired:- - score- title: RatingIn+ - kind+ - value+ title: QueueAsset+ description: 'Lightweight asset descriptor for a queue row.+++ The queue surfaces *one* representative entity per alert so the++ row is informative at a glance ("VPN brute force on `web-01`")++ without enumerating every entity. The full pivotable list lives++ on the Investigation Rail when the analyst opens the alert.'+ QueueItem:+ properties:+ id:+ type: string+ format: uuid+ title: Id+ tenant_id:+ type: string+ format: uuid+ title: Tenant Id+ title:+ type: string+ title: Title+ severity:+ type: string+ title: Severity+ status:+ type: string+ title: Status+ priority:+ type: integer+ title: Priority+ category:+ anyOf:+ - type: string+ - type: 'null'+ title: Category+ connector_type:+ anyOf:+ - type: string+ - type: 'null'+ title: Connector Type+ assigned_to_id:+ anyOf:+ - type: string+ format: uuid+ - type: 'null'+ title: Assigned To Id+ case_id:+ anyOf:+ - type: string+ format: uuid+ - type: 'null'+ title: Case Id+ first_seen:+ type: string+ format: date-time+ title: First Seen+ sla_due_at:+ type: string+ format: date-time+ title: Sla Due At+ sla_remaining_seconds:+ type: integer+ title: Sla Remaining Seconds+ sla_breached:+ type: boolean+ title: Sla Breached+ age_seconds:+ type: integer+ title: Age Seconds+ asset:+ anyOf:+ - $ref: '#/components/schemas/QueueAsset'+ - type: 'null'+ suggested_action:+ anyOf:+ - $ref: '#/components/schemas/QueueAction'+ - type: 'null'+ bucket:+ type: string+ enum:+ - mine+ - unassigned+ title: Bucket+ type: object+ required:+ - id+ - tenant_id+ - title+ - severity+ - status+ - priority+ - first_seen+ - sla_due_at+ - sla_remaining_seconds+ - sla_breached+ - age_seconds+ - bucket+ title: QueueItem+ description: 'One row in the Investigation Queue workbench.+++ Intentionally slimmer than ``AlertResponse``. The queue exists to++ answer "what should I work on next?" — clicking a row navigates++ to ``/alerts/{id}`` which loads full detail via the existing++ detail endpoint (``GET /alerts/{id}``). Keeping this payload++ small means a busy SOC with thousands of open alerts can refresh++ the queue cheaply (the badge on the topbar polls it).'+ QueueResponse:+ properties:+ items:+ items:+ $ref: '#/components/schemas/QueueItem'+ type: array+ title: Items+ total:+ type: integer+ title: Total+ counts:+ additionalProperties:+ type: integer+ type: object+ title: Counts+ period:+ type: string+ title: Period+ owner:+ type: string+ title: Owner+ page:+ type: integer+ title: Page+ page_size:+ type: integer+ title: Page Size+ pages:+ type: integer+ title: Pages+ generated_at:+ type: string+ format: date-time+ title: Generated At+ type: object+ required:+ - items+ - total+ - counts+ - period+ - owner+ - page+ - page_size+ - pages+ - generated_at+ title: QueueResponse+ description: 'Paginated queue response.+++ ``counts`` always reports both buckets so the workbench can++ render the "mine / unassigned / all" tabs without re-fetching.++ ``generated_at`` is the server-side ``now`` we used to compute++ SLA remaining — the frontend can drift its own clock from this++ so multiple analysts on different boxes see the same countdowns.'+ RatingIn:+ properties:+ score:+ type: integer+ maximum: 5.0+ minimum: 1.0+ title: Score+ comment:+ anyOf:+ - type: string+ - type: 'null'+ title: Comment+ type: object+ required:+ - score+ title: RatingInRedispositionApplyRequest:properties:alert_ids:@@ -22209,6 +22844,232 @@ components:- fix_stepstitle: TroubleshootResponsedescription: Structured guidance the wizard renders next to a failed test.+ TuningEntry:+ properties:+ rule_id:+ type: string+ title: Rule Id+ name:+ type: string+ title: Name+ description:+ anyOf:+ - type: string+ - type: 'null'+ title: Description+ category:+ type: string+ title: Category+ severity:+ type: string+ title: Severity+ status:+ type: string+ title: Status+ enabled:+ type: boolean+ title: Enabled+ confidence:+ type: integer+ title: Confidence+ fp_rate:+ type: number+ title: Fp Rate+ total_hits:+ type: integer+ title: Total Hits+ last_triggered_at:+ anyOf:+ - type: string+ - type: 'null'+ title: Last Triggered At+ tags:+ items:+ type: string+ type: array+ title: Tags+ mitre_tactics:+ items:+ type: string+ type: array+ title: Mitre Tactics+ mitre_techniques:+ items:+ type: string+ type: array+ title: Mitre Techniques+ version:+ type: integer+ title: Version+ updated_at:+ type: string+ title: Updated At+ suggestion:+ type: string+ enum:+ - disable+ - add_suppression+ - raise_threshold+ - tune_confidence+ - review_stale+ - healthy+ title: Suggestion+ score:+ type: integer+ title: Score+ reasons:+ items:+ type: string+ type: array+ title: Reasons+ auto_tune:+ type: boolean+ title: Auto Tune+ default: false+ dismissed_at:+ anyOf:+ - type: string+ - type: 'null'+ title: Dismissed At+ last_action:+ anyOf:+ - type: string+ - type: 'null'+ title: Last Action+ last_action_at:+ anyOf:+ - type: string+ - type: 'null'+ title: Last Action At+ type: object+ required:+ - rule_id+ - name+ - category+ - severity+ - status+ - enabled+ - confidence+ - fp_rate+ - total_hits+ - version+ - updated_at+ - suggestion+ - score+ title: TuningEntry+ description: One row in the tuning workbench — what an analyst sees.+ TuningFilters:+ properties:+ severity:+ anyOf:+ - type: string+ - type: 'null'+ title: Severity+ suggestion:+ anyOf:+ - type: string+ - type: 'null'+ title: Suggestion+ search:+ anyOf:+ - type: string+ - type: 'null'+ title: Search+ enabled_only:+ type: boolean+ title: Enabled Only+ default: false+ include_dismissed:+ type: boolean+ title: Include Dismissed+ default: false+ page:+ type: integer+ title: Page+ default: 1+ page_size:+ type: integer+ title: Page Size+ default: 50+ type: object+ title: TuningFilters+ description: Echo of the filters that built this response (handy for the UI).+ TuningResponse:+ properties:+ entries:+ items:+ $ref: '#/components/schemas/TuningEntry'+ type: array+ title: Entries+ summary:+ $ref: '#/components/schemas/TuningSummary'+ filters:+ $ref: '#/components/schemas/TuningFilters'+ total:+ type: integer+ title: Total+ generated_at:+ type: string+ title: Generated At+ type: object+ required:+ - entries+ - summary+ - filters+ - total+ - generated_at+ title: TuningResponse+ description: Wire shape for ``GET /detection/tuning``.+ TuningSummary:+ properties:+ total_rules:+ type: integer+ title: Total Rules+ actionable:+ type: integer+ title: Actionable+ healthy:+ type: integer+ title: Healthy+ disable_count:+ type: integer+ title: Disable Count+ default: 0+ add_suppression_count:+ type: integer+ title: Add Suppression Count+ default: 0+ raise_threshold_count:+ type: integer+ title: Raise Threshold Count+ default: 0+ tune_confidence_count:+ type: integer+ title: Tune Confidence Count+ default: 0+ review_stale_count:+ type: integer+ title: Review Stale Count+ default: 0+ auto_tune_enabled:+ type: integer+ title: Auto Tune Enabled+ default: 0+ average_fp_rate:+ type: number+ title: Average Fp Rate+ default: 0.0+ high_fp_count:+ type: integer+ title: High Fp Count+ default: 0+ type: object+ required:+ - total_rules+ - actionable+ - healthy+ title: TuningSummary+ description: Top-line counts for the workbench header.UpdateApiKeyRequest:properties:name:diff --git a/services/api/app/services/alert_queue.py b/services/api/app/services/alert_queue.pyindex 1f4ec98d1..2a329b6b1 100644--- a/services/api/app/services/alert_queue.py+++ b/services/api/app/services/alert_queue.py@@ -198,12 +198,8 @@ async def load_sla_targets(``mttd_target`` here because the queue's SLA timer is MTTD(time-to-acknowledge). MTTR and MTTC live on cases / SLA reports."""- result: dict[str, int] = {- sev: cfg["mttd_target"] for sev, cfg in DEFAULT_SLA_TARGETS.items()- }- rows = await db.execute(- select(TenantSLAConfig).where(TenantSLAConfig.tenant_id == tenant_id)- )+ result: dict[str, int] = {sev: cfg["mttd_target"] for sev, cfg in DEFAULT_SLA_TARGETS.items()}+ rows = await db.execute(select(TenantSLAConfig).where(TenantSLAConfig.tenant_id == tenant_id))for cfg in rows.scalars().all():if cfg.severity in result:result[cfg.severity] = cfg.mttd_target@@ -219,13 +215,8 @@ def sla_due_at_expression(targets: dict[str, int]):``info`` target so brand-new or unknown severities still producea sortable value rather than ``NULL``."""- branches = [- (Alert.severity == sev, Alert.first_seen + literal(timedelta(minutes=mins)))- for sev, mins in targets.items()- ]- fallback = Alert.first_seen + literal(- timedelta(minutes=DEFAULT_SLA_TARGETS["info"]["mttd_target"])- )+ branches = [(Alert.severity == sev, Alert.first_seen + literal(timedelta(minutes=mins))) for sev, mins in targets.items()]+ fallback = Alert.first_seen + literal(timedelta(minutes=DEFAULT_SLA_TARGETS["info"]["mttd_target"]))return case(*branches, else_=fallback)@@ -240,24 +231,16 @@ def first_asset(alert: Alert) -> QueueAsset | None:Rail (W6) is for. We surface one anchor so the row is meaningfulat a glance."""- hosts = [- h for h in (alert.affected_hosts or []) if isinstance(h, str) and h.strip()- ]+ hosts = [h for h in (alert.affected_hosts or []) if isinstance(h, str) and h.strip()]if hosts:return QueueAsset(kind="host", value=hosts[0].strip())- users = [- u for u in (alert.affected_users or []) if isinstance(u, str) and u.strip()- ]+ users = [u for u in (alert.affected_users or []) if isinstance(u, str) and u.strip()]if users:return QueueAsset(kind="user", value=users[0].strip())- assets = [- a for a in (alert.affected_assets or []) if isinstance(a, str) and a.strip()- ]+ assets = [a for a in (alert.affected_assets or []) if isinstance(a, str) and a.strip()]if assets:return QueueAsset(kind="asset", value=assets[0].strip())- ips = [- i for i in (alert.affected_ips or []) if isinstance(i, str) and i.strip()- ]+ ips = [i for i in (alert.affected_ips or []) if isinstance(i, str) and i.strip()]if ips:return QueueAsset(kind="ip", value=ips[0].strip())return None@@ -294,9 +277,7 @@ def first_action(alert: Alert) -> QueueAction | None:risk = str(item.get("risk") or "low").lower()if risk not in {"low", "medium", "high"}:risk = "low"- candidates.append(- QueueAction(priority=priority, action=action, risk=risk)- )+ candidates.append(QueueAction(priority=priority, action=action, risk=risk))if not candidates:return None@@ -353,14 +334,8 @@ async def build_queue(# Counts: always report both buckets so the topbar badge + tabs# work without re-fetching.- mine_count = (- await db.execute(select(func.count()).select_from(Alert).where(mine_filter))- ).scalar_one()- unassigned_count = (- await db.execute(- select(func.count()).select_from(Alert).where(unassigned_filter)- )- ).scalar_one()+ mine_count = (await db.execute(select(func.count()).select_from(Alert).where(mine_filter))).scalar_one()+ unassigned_count = (await db.execute(select(func.count()).select_from(Alert).where(unassigned_filter))).scalar_one()# Bucket label: mine (0) sorts before unassigned (1).bucket_expr = case(@@ -476,9 +451,7 @@ async def claim_alert(clause so two analysts racing for the same row can't both win —the second update is a no-op and we surface 409 to the loser."""- result = await db.execute(- select(Alert).where(Alert.id == alert_id, Alert.tenant_id == tenant_id)- )+ result = await db.execute(select(Alert).where(Alert.id == alert_id, Alert.tenant_id == tenant_id))alert = result.scalar_one_or_none()if alert is None:raise AlertNotFoundError(str(alert_id))@@ -503,9 +476,7 @@ async def claim_alert(if winner is None or winner != user_id:# Someone else grabbed it between our SELECT and UPDATE.# Re-read so the error carries the actual owner.- refresh = await db.execute(- select(Alert.assigned_to_id).where(Alert.id == alert_id)- )+ refresh = await db.execute(select(Alert.assigned_to_id).where(Alert.id == alert_id))actual_owner = refresh.scalar_one_or_none()if actual_owner is None:raise AlertNotFoundError(str(alert_id))diff --git a/services/api/app/services/rule_tuning.py b/services/api/app/services/rule_tuning.pyindex 976fcfed7..290644df7 100644--- a/services/api/app/services/rule_tuning.py+++ b/services/api/app/services/rule_tuning.py@@ -425,9 +425,7 @@ async def build_tuning(page = max(1, page)page_size = max(1, min(page_size, 100))- stmt = select(DetectionRule).where(- or_(DetectionRule.tenant_id == tenant_id, DetectionRule.tenant_id.is_(None))- )+ stmt = select(DetectionRule).where(or_(DetectionRule.tenant_id == tenant_id, DetectionRule.tenant_id.is_(None)))if severity:stmt = stmt.where(DetectionRule.severity == severity)diff --git a/services/api/tests/test_alert_queue.py b/services/api/tests/test_alert_queue.pyindex f3ba3fb37..5dc09374c 100644--- a/services/api/tests/test_alert_queue.py+++ b/services/api/tests/test_alert_queue.py@@ -197,11 +197,7 @@ class TestLoadSlaTargets:# Only the overridden severity should change; the rest must# keep their defaults.db = MagicMock()- db.execute = AsyncMock(- return_value=_scalars_all_result(- [_tenant_sla_cfg("critical", 5)]- )- )+ db.execute = AsyncMock(return_value=_scalars_all_result([_tenant_sla_cfg("critical", 5)]))targets = await load_sla_targets(db, uuid.uuid4())@@ -219,11 +215,7 @@ class TestLoadSlaTargets:# into the result — that would break the SQL ``CASE`` (which# only branches on the canonical severities).db = MagicMock()- db.execute = AsyncMock(- return_value=_scalars_all_result(- [_tenant_sla_cfg("unknown_severity", 99)]- )- )+ db.execute = AsyncMock(return_value=_scalars_all_result([_tenant_sla_cfg("unknown_severity", 99)]))targets = await load_sla_targets(db, uuid.uuid4())diff --git a/services/api/tests/test_rule_tuning.py b/services/api/tests/test_rule_tuning.pyindex 10822bbad..2c3c3e740 100644--- a/services/api/tests/test_rule_tuning.py+++ b/services/api/tests/test_rule_tuning.py@@ -385,10 +385,9 @@ class TestBuildTuning:# Three urgent + two healthy rules. With page_size=2 we expect# the two highest-scoring rules first.tenant_id = uuid.uuid4()- rules = [- _StubRule(name=f"rule_{i}", fp_rate=0.6, confidence=10, total_hits=100 + i)- for i in range(3)- ] + [_StubRule(name=f"healthy_{i}", fp_rate=0.0, confidence=90) for i in range(2)]+ rules = [_StubRule(name=f"rule_{i}", fp_rate=0.6, confidence=10, total_hits=100 + i) for i in range(3)] + [+ _StubRule(name=f"healthy_{i}", fp_rate=0.0, confidence=90) for i in range(2)+ ]db = _setup_build_db(rules)resp = await build_tuning(db, tenant_id=tenant_id, page=1, page_size=2)@@ -459,9 +458,7 @@ class TestBuildTuning:async def test_actionable_suggestions_constant_is_correct(self) -> None:# If someone adds a new suggestion lane, they must consciously# decide whether it counts toward the "needs work" tile.- assert ACTIONABLE_SUGGESTIONS == frozenset(- {"disable", "add_suppression", "raise_threshold", "tune_confidence", "review_stale"}- )+ assert ACTIONABLE_SUGGESTIONS == frozenset({"disable", "add_suppression", "raise_threshold", "tune_confidence", "review_stale"})assert "healthy" not in ACTIONABLE_SUGGESTIONS@@ -526,9 +523,7 @@ class TestApplyTuning:"""Each apply action must mutate the rule AND emit an audit event."""@pytest.mark.asyncio- async def test_raise_threshold_bumps_threshold_and_version(- self, _patch_audit: AsyncMock- ) -> None:+ async def test_raise_threshold_bumps_threshold_and_version(self, _patch_audit: AsyncMock) -> None:actor = _auth_user()rule = _StubRule(tenant_id=actor.tenant_id,@@ -628,9 +623,7 @@ class TestApplyTuning:assert entry.status == "disabled"@pytest.mark.asyncio- async def test_acknowledge_records_action_without_mutation(- self, _patch_audit: AsyncMock- ) -> None:+ async def test_acknowledge_records_action_without_mutation(self, _patch_audit: AsyncMock) -> None:# Acknowledge is a no-op for the rule's *semantics* — it just# stamps last_action so the workbench shows "ack'd 5m ago" and# the analyst can re-find the row.@@ -741,9 +734,7 @@ class TestApplyTuning:class TestDismissTuning:@pytest.mark.asyncio- async def test_dismiss_stamps_suppression_config(- self, _patch_audit: AsyncMock- ) -> None:+ async def test_dismiss_stamps_suppression_config(self, _patch_audit: AsyncMock) -> None:actor = _auth_user()rule = _StubRule(tenant_id=actor.tenant_id, suppression_config={})db = _setup_mutator_db(rule)