refactor: depend on sgm-detectkit for the shared detector contract + built-ins #12
No reviewers
Labels
No labels
correctness
coverage
milestone:M4
polish
security
tech-debt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/warden!12
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/depend-on-detectkit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Extract the sensing layer into the shared sgm-detectkit package (import
sgm_detectkit) and depend on it, so warden and statustree sense through one contract.Name: the package is
sgm-detectkit(notdetectkit) to avoid a collision with an unrelated public PyPI package of that name (dependency-confusion hazard).What moves: the
Detector -> Findingcontract (Finding/Status/Severity/default_fingerprint, CheckContext, the Detector protocol, register/parse_duration) and the 10 generic built-in detectors were extracted verbatim. warden re-exports them unchanged.Compatibility (verified):
warden.Finding IS sgm_detectkit.Finding— one type across the boundary, fingerprints byte-identical, so incident dedup is unchanged.warden.detectors.<x>aliases the sgm_detectkit module via sys.modules — same classes, helpers, and module-level defaults (monkeypatch targets included).warden.detectorsentry-point discovery preserved.Result: net -840 lines. Full suite unchanged: 903 passed, 1 skipped.
known_plugins()still returns all 12; CLI + entry point intact.Requires sgm-detectkit>=0.1 (published to the Optimacro index).
🤖 Generated with Claude Code
The Detector->Finding contract (Finding/Status/Severity/default_fingerprint, CheckContext, the Detector protocol, register/parse_duration) and the 10 generic built-in detectors were extracted verbatim into the shared detectkit package so the sensing layer lives once and is reused by statustree. warden now depends on detectkit and re-exports those symbols unchanged: - model.py: re-export Finding/Status/Severity/default_fingerprint from detectkit; Incident/IncidentState stay (the orchestrator's domain). warden.Finding IS detectkit.Finding, so ingested findings share one type and fingerprints are byte-identical (verified: dedup unchanged). - detectors/__init__.py: re-export the contract from detectkit.base onto the shared registry; keep the mesh_bus/mesh_registry detectors and warden.detectors entry-point discovery so third-party add-ons load without a fork. - detectors/{promql,probe,prom_scrape,heartbeat,disk,cert_expiry,systemd, json_check,dagster,delta_freshness}.py: alias the detectkit module via sys.modules, so warden.detectors.<x> IS the detectkit module (same classes, helpers, and module-level defaults — monkeypatch targets included). Net -840 lines. Full suite unchanged: 903 passed, 1 skipped. known_plugins() still returns all 12; CLI + entry point intact. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01MJZ2jTLqJxnc31UhrbNcyu2a3507b9dcto8688c8f290refactor: depend on detectkit for the shared detector contract + built-insto refactor: depend on sgm-detectkit for the shared detector contract + built-ins