Files
rengine/shared/models/target_summary.py
T
Yogesh OjhaandClaude Fable 5.1 0a69f3201c copy: state the fact, delete the explanation
Repo-wide sweep of every user-facing string: frontend components, routes,
config and stores; API details and route docs; shared definitions and
models; stage config help; report prose; MCP, toolbox, interest and
connector text; notification and worker messages.

Descriptions that explained, reassured, justified or restated their title
are deleted. Confirm dialogs name what is removed and stop. Failed actions
read "<Noun> not <verbed>", successes "<Noun> <verbed>". No reader address,
no product-as-subject, no em-dashes or parentheticals in prose.

Mirrors updated on both sides: EPSS band help, compare refusal reasons,
interest labels. Four tests asserting on old wording follow the new text.
The rules are condensed into CLAUDE.md under Writing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SK5o8xR96cbSnAfjYSTPSe
2026-09-12 11:35:07 +05:30

61 lines
1.6 KiB
Python

import uuid
from datetime import datetime
from pydantic import BaseModel, Field
from shared.models.scan import ScanRead
from shared.models.vulnerability import SeverityCount
class SurfaceMetric(BaseModel):
"""Figures from the most recent scan that ran this dimension."""
key: str
label: str
covered: bool = False
value: int | None = None
previous: int | None = None
delta: int | None = None
added: int | None = None
gone: int | None = None
scan_id: uuid.UUID | None = None
scan_status: str | None = None
observed_at: datetime | None = None
current: bool = False
class TargetRisk(BaseModel):
scan_id: uuid.UUID | None = None
observed_at: datetime | None = None
total: int = 0
actionable: int = 0
kev: int = 0
suppressed: int = 0
by_severity: list[SeverityCount] = Field(default_factory=list)
class TargetMonitoring(BaseModel):
schedule_id: uuid.UUID
name: str
cadence: str
status: str
next_run_at: datetime | None = None
last_run_at: datetime | None = None
class TargetSummaryRead(BaseModel):
target_id: uuid.UUID
scans_total: int = 0
scans_running: int = 0
scans_failed: int = 0
first_scan_at: datetime | None = None
last_scan_at: datetime | None = None
last_completed_at: datetime | None = None
latest_scan: ScanRead | None = None
surface: list[SurfaceMetric] = Field(default_factory=list)
risk: TargetRisk = Field(default_factory=TargetRisk)
sensitive_services: int | None = None
inventory_total: int = 0
inventory_first_seen: datetime | None = None
monitoring: TargetMonitoring | None = None