refactor: depend on sgm-detectkit for the shared detector contract + built-ins #12

Merged
jmz merged 1 commit from refactor/depend-on-detectkit into main 2026-09-12 08:25:42 +00:00
Owner

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 (not detectkit) to avoid a collision with an unrelated public PyPI package of that name (dependency-confusion hazard).

What moves: 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. 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).
  • mesh_bus/mesh_registry stay in warden; warden.detectors entry-point discovery preserved.
  • Incident/IncidentState stay in warden.

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

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` (not `detectkit`) to avoid a collision with an unrelated public PyPI package of that name (dependency-confusion hazard). **What moves:** 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. 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). - mesh_bus/mesh_registry stay in warden; `warden.detectors` entry-point discovery preserved. - Incident/IncidentState stay in warden. **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](https://claude.com/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_01MJZ2jTLqJxnc31UhrbNcyu
jmz force-pushed refactor/depend-on-detectkit from 2a3507b9dc to 8688c8f290 2026-09-12 08:04:40 +00:00 Compare
jmz changed title from refactor: depend on detectkit for the shared detector contract + built-ins to refactor: depend on sgm-detectkit for the shared detector contract + built-ins 2026-09-12 08:05:09 +00:00
jmz merged commit 58aabd657d into main 2026-09-12 08:25:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/warden!12
No description provided.