Repository navigation
Delete the never-started CaseAutomationService, the case_metrics recompute route and its script - #3104
Conversation
…mpute route and its script
Nothing called automation_service.start(), so its SLA, metrics and
stale-case loops never ran. CaseMetricsService.calculate_case_metrics was
reached only from that loop, the beta POST /cases/metrics/calculate/{case_id}
that no client calls, and scripts/calculate_case_metrics.py. All of them go,
with the now-empty case_metrics_service module. The vstrike clustering code in
case_automation_service.py stays. Lowers the f-string logger ratchet to 281
and regenerates schema.d.ts.
Closes #2905
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he-never-started-22359ad9
…arted-22359ad9' into cleanup/2905-delete-the-never-started-22359ad9
|
🧹 Asked for proof in the running app, level 5, which a high or critical blast radius needs (1 of 3): a high blast radius proven only to level 4. |
… to 278 Main lowered BASELINE to 285. With this PR's deletions the tree has 278 f-string logger calls, so the ratchet is lowered to match. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…te the removed beta route Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
|
🏭 Advisory review (claude-haiku-5-5 + opus advisor) — merge Nothing left on #3104: head |
|
🧹 Proof at Job: #2905, a remove job in feature
Blast radius: high. Touches 9 file(s) in the contract, api, ui, tests, docs layer(s), across feature(s)
The author says it is safe because: Nothing outside the removed code calls the recompute route, the singleton or How each count was made, and how to rerun itSize. +11 −547 over the whole diff, as GitHub counts it. A remove job must delete more than it adds. Reproduce with Callers. What the PR deletes and does not define again, searched for across the repo at
git fetch origin pull/3104/head
git grep -n -I -F -w -e 'calculate_case_metrics' 13db502e12d5
git grep -n -I -F -w -e 'CaseAutomationService' 13db502e12d5
git grep -n -I -F -w -e 'sla_monitor_task' 13db502e12d5
git grep -n -I -F -w -e '_check_sla_deadlines' 13db502e12d5
git grep -n -I -F -w -e 'metrics_update_task' 13db502e12d5
git grep -n -I -F -w -e '_update_case_metrics' 13db502e12d5
git grep -n -I -F -w -e 'stale_case_detector_task' 13db502e12d5
git grep -n -I -F -w -e '_detect_stale_cases' 13db502e12d5
git grep -n -I -F -w -e 'CaseMetricsService' 13db502e12d5Style lint. No findings in the prose the PR adds. CI at Evidence. import-check.txt · pytest-base-env-failures.txt · pytest-before-baseline.txt · pytest-branch-dualmount-reachable.txt · pytest-cases-vstrike-contract.txt · pytest-ratchets.txt · route-check.txt Machine-readable{
"sha": "13db502e12d566566acb151c27f35f590bd497a6",
"pr": 3104,
"job": {
"issue": 2905,
"kind": "remove",
"feature": "case-metrics",
"survey": "2026-10-22-6035439f-y8bt"
},
"blast": {
"severity": "high",
"reasons": [
{
"severity": "high",
"what": "touches a published API contract or generated client: clients/web/src/services/generated/schema.d.ts"
},
{
"severity": "high",
"what": "spans 4 features: cases, case-metrics, api-platform, vstrike"
},
{
"severity": "medium",
"what": "touches API handlers: core/api/v1/README.md, core/api/v1/case_metrics_router.py"
},
{
"severity": "medium",
"what": "touches what users see: clients/web/src/services/generated/schema.d.ts"
}
],
"features": [
"cases",
"case-metrics",
"api-platform",
"vstrike"
],
"layers": [
"contract",
"api",
"ui",
"tests",
"docs"
],
"routes": [],
"safeBecause": "Nothing outside the removed code calls the recompute route, the singleton or `calculate_case_metrics`. The SLA and metrics loops never started, so no runtime behavior changes.",
"proofLevel": 5
},
"size": {
"additions": 11,
"deletions": 547
},
"verdicts": {
"size": "pass",
"callers": "pass",
"lint": "pass",
"ci": "pass"
},
"callers": [
{
"name": "calculate_case_metrics",
"kind": "symbol",
"from": "core/cases/case_metrics_service.py",
"refs": []
},
{
"name": "CaseAutomationService",
"kind": "symbol",
"from": "core/cases/case_automation_service.py",
"refs": []
},
{
"name": "sla_monitor_task",
"kind": "symbol",
"from": "core/cases/case_automation_service.py",
"refs": []
},
{
"name": "_check_sla_deadlines",
"kind": "symbol",
"from": "core/cases/case_automation_service.py",
"refs": []
},
{
"name": "metrics_update_task",
"kind": "symbol",
"from": "core/cases/case_automation_service.py",
"refs": []
},
{
"name": "_update_case_metrics",
"kind": "symbol",
"from": "core/cases/case_automation_service.py",
"refs": []
},
{
"name": "stale_case_detector_task",
"kind": "symbol",
"from": "core/cases/case_automation_service.py",
"refs": []
},
{
"name": "_detect_stale_cases",
"kind": "symbol",
"from": "core/cases/case_automation_service.py",
"refs": []
},
{
"name": "CaseMetricsService",
"kind": "symbol",
"from": "core/cases/case_metrics_service.py",
"refs": []
}
],
"lint": 0,
"checks": [
{
"name": "CodeQL",
"bucket": "pass"
},
{
"name": "Build Frontend",
"bucket": "pass"
},
{
"name": "Backend Image",
"bucket": "pass"
},
{
"name": "Unit Tests - Backend",
"bucket": "pass"
},
{
"name": "Helm Install Schema",
"bucket": "pass"
},
{
"name": "Setup Path (macos-latest)",
"bucket": "pass"
},
{
"name": "Setup Path (ubuntu-latest)",
"bucket": "pass"
},
{
"name": "Unit Tests - Agent Layer",
"bucket": "pass"
},
{
"name": "Lint Backend",
"bucket": "pass"
},
{
"name": "Unit Tests - Frontend",
"bucket": "pass"
},
{
"name": "Daemon Image",
"bucket": "pass"
},
{
"name": "Generated API Types",
"bucket": "pass"
},
{
"name": "MCP Runner Image",
"bucket": "pass"
},
{
"name": "Agent Image",
"bucket": "pass"
},
{
"name": "Lint Dockerfiles",
"bucket": "pass"
},
{
"name": "Lint Frontend",
"bucket": "pass"
},
{
"name": "Integration Tests",
"bucket": "pass"
},
{
"name": "Unit Tests - Backend (DB-backed)",
"bucket": "pass"
},
{
"name": "Security Scan - Python",
"bucket": "pass"
},
{
"name": "Security Scan - NPM",
"bucket": "pass"
},
{
"name": "Analyze (javascript-typescript)",
"bucket": "pass"
},
{
"name": "Analyze (python)",
"bucket": "pass"
},
{
"name": "Analyze (actions)",
"bucket": "pass"
}
],
"evidence": [
{
"name": "import-check.txt",
"url": "https://github.com/Vigil-SOC/vigil/blob/deslop-evidence/pr-3104/import-check.txt"
},
{
"name": "pytest-base-env-failures.txt",
"url": "https://github.com/Vigil-SOC/vigil/blob/deslop-evidence/pr-3104/pytest-base-env-failures.txt"
},
{
"name": "pytest-before-baseline.txt",
"url": "https://github.com/Vigil-SOC/vigil/blob/deslop-evidence/pr-3104/pytest-before-baseline.txt"
},
{
"name": "pytest-branch-dualmount-reachable.txt",
"url": "https://github.com/Vigil-SOC/vigil/blob/deslop-evidence/pr-3104/pytest-branch-dualmount-reachable.txt"
},
{
"name": "pytest-cases-vstrike-contract.txt",
"url": "https://github.com/Vigil-SOC/vigil/blob/deslop-evidence/pr-3104/pytest-cases-vstrike-contract.txt"
},
{
"name": "pytest-ratchets.txt",
"url": "https://github.com/Vigil-SOC/vigil/blob/deslop-evidence/pr-3104/pytest-ratchets.txt"
},
{
"name": "route-check.txt",
"url": "https://github.com/Vigil-SOC/vigil/blob/deslop-evidence/pr-3104/route-check.txt"
}
]
} |
Closes #2905
Nothing ever calls
automation_service.start(), so the SLA monitor, the hourly metrics loop and the stale-case detector inCaseAutomationServicenever ran.CaseMetricsService.calculate_case_metricshad three callers: that loop, the betaPOST /api/v1/cases/metrics/calculate/{case_id}(also mounted at/api/cases/metrics), andscripts/calculate_case_metrics.py. No client calls the route. This PR deletes all four.Where this PR departs from the issue, because the code changed after it was filed:
case_metrics_service.pyheld onlycalculate_case_metrics, so the whole module is gone. The issue said to keep the class. Its only other users were the router singletonmetrics_serviceand the script, both removed.CaseMetricsServiceas the source of the MTTR definitions. I cut those clauses because the class is gone.Kept:
cluster_findings_by_attack_path,_max_severityand_SEVERITY_ORDERincase_automation_service.py, whichservices/api/routers/vstrike.py:228andtests/unit/cases/test_open_case_sla.py:7import. Thecase_metricstable, its model andCaseMetricsSchemaalso stay.Callers checked
grep -rn -E "automation_service|CaseAutomationService|case_automation|calculate_case_metrics|metrics/calculate|CaseMetricsService|case_metrics_service"over the repo, excludingnode_modulesand.git. Before the change, hits were in the files this PR removes or edits, plus the vstrike importer, the vstrike test above, a docstring intests/integration/test_vstrike_ingest.py:129, the ambient-state allow-list, andschema.d.ts. No.start()call on the singleton exists anywhere.*.md,*.yml,*.yaml,*.toml,*.sh,*.ts,*.tsx,*.json, Makefiles and Dockerfiles turned up nothing outside the generated schema.metrics_calculateandmetrics/calculateinclients/turned up nothing outside the generated schema.Blast radius
calculate_case_metrics. The SLA and metrics loops never started, so no runtime behavior changes.app.openapi()from the real app. The import printedimport ok. The spec lists 7 paths under each of/api/v1/cases/metricsand/api/cases/metrics, and none iscalculate. The contract, reachability, security, cases and vstrike tests pass (see Verification).services.api.main:app) onmainand on this branch against the same throwaway Postgres + Redis and drove the case-metrics routes over HTTP. See "Live app run" under Verification./api/v1/cases/metrics/calculate/{case_id}now gets a 404. This is unlikely, because the route carriedx-vigil-beta, sat outside the contract snapshot, and no in-repo client called it. The impact is low, because the route only wrotecase_metrics, which no reader shows (Case metrics MTTR/MTTD/analyst resolution time always report 0 (case_metricsis never populated), and the handlers issue one query per case #1435).scripts/calculate_case_metrics.pyby hand loses it. This is unlikely and low impact for the same reason.core/api/v1/case_metrics_router.pyderives MTTR and MTTD in SQL and never readcase_metricsthrough this service.schema.d.tsdiff is 118 deleted lines in 4 hunks. They are the two calculate paths and their two operations, and no TS file references those operation ids.CaseMetricsSchemakeeps its user intests/unit/storage/test_orm_schema_parity.py.pyflakesreports nothing on the two edited Python files.Also seen
CaseNotificationService.notify_sla_warning(core/cases/case_notification_service.py:148) now has no production caller. Onlytests/unit/test_notification_metadata.pycalls it. The"sla_warning"type comment at line 30 points at it. I left both alone because they are outside this job.tests/unit/api/test_api_v1_reachable.py(10 errors) andtest_api_v1_dual_mount.py::test_both_paths_return_the_same_response(1 failure) failed withSchemaRevisionError: the database has no alembic_version. The cause is the shared local Postgres. Which tests fail depends on the order of earlier tests in the run. Both files pass alone, on this branch and onmain(13 passed each).Verification
Ran
pytest tests/unit/_ratchets: before the baseline change, the logger ratchet failed with "Only 281 f-string log calls remain; lower BASELINE ... from 288 to 281". After the change, 260 passed and 6 skipped (helm not installed). The base had no new commits to merge. Files:pytest-ratchets.txt,pytest-before-baseline.txt.pytest tests/unit/_ratchets tests/unit/api tests/unit/cases tests/unit/storage/test_orm_schema_parity.py tests/security tests/integration/test_vstrike_ingest.py tests/**/test_vstrike*.pywith the old baseline: 1488 passed, plus the ratchet step and the DB ordering failures above. File:pytest-before-baseline.txt.pytest tests/unit/api/test_api_v1_dual_mount.py tests/unit/api/test_api_v1_reachable.py: 13 passed alone on the branch and onmain. Files:pytest-branch-dualmount-reachable.txt,pytest-base-env-failures.txt.pytest tests/unit/cases tests/integration/test_vstrike_ingest.py tests/unit/storage/test_orm_schema_parity.py tests/unit/api/test_api_v1_contract.py: 302 passed. File:pytest-cases-vstrike-contract.txt.route-check.txt.python scripts/generate_frontend_types.py(openapi-typescript 7.13.0) produced 118 deletions inschema.d.ts.Live app run (before/after)
Throwaway
pgvector/pgvector:pg16+redis:7-alpinecontainers, schema applied withpython -m core.upgrade, app started withDEV_MODE=true uvicorn services.api.main:app. One case created throughPOST /api/v1/cases. Same DB for both runs.Before (
origin/main69f6f73):After (this branch, 1bd3ab0):
Both startup logs have the same single ERROR line (Bifrost unreachable, no LLM gateway in the throwaway setup) and no tracebacks. The 7 read routes return byte-identical bodies with a
case_metricsrow present, so they never read that table.Did not run
npx tsc --noEmit. This clone has nonode_modules. The schema diff only deletes two paths and two operations that no TS file references, and CI runs tsc.🤖 Generated with Claude Code