Skip to content

feat(forensics): forensic read-only resource (client.forensics.*)#11

Merged
caballeto merged 1 commit into
mainfrom
feat/forensics
Apr 29, 2026
Merged

feat(forensics): forensic read-only resource (client.forensics.*)#11
caballeto merged 1 commit into
mainfrom
feat/forensics

Conversation

@caballeto
Copy link
Copy Markdown
Member

Summary

Adds a `Forensics` resource exposing the detection engine's audit trail. Backed by the event-sourced forensic model — every detection outcome is recorded as an immutable row, and these methods expose the read side.

```python
from devhelm import Devhelm

client = Devhelm(token="dh_live_…")

timeline = client.forensics.incident_timeline(incident_id)
trace = client.forensics.check_trace(check_id)
snapshot = client.forensics.policy_snapshot(hash_hex)

page = client.forensics.monitor_rule_evaluations(
monitor_id, only_matched=True, rule_type="consecutive_failures"
)
page = client.forensics.monitor_transitions(monitor_id, from_=since)
```

Pydantic models for `IncidentTimelineDto`, `CheckTraceDto`, `PolicySnapshotDto`, `RuleEvaluationDto`, `IncidentStateTransitionDto` regenerated from the API spec and re-exported from `devhelm.types` / `devhelm.init`.

Companion PRs

  • API: devhelmhq/mono `feat/detection-forensic-model`
  • CLI / sdk-js: `feat/forensics`
  • MCP server: blocked on this PR's release (needs `devhelm >= 0.5.0`)

Test plan

  • `uv run mypy src/` clean
  • `uv run pytest tests/` — 21 client tests pass (including new `test_forensics`)
  • `uv run ruff check` clean
  • Surface integration tests pass against the API on `feat/detection-forensic-model`

Made with Cursor

Adds a Forensics resource exposing the detection engine's audit trail:

- client.forensics.incident_timeline(id) → IncidentTimelineDto
- client.forensics.check_trace(check_id) → CheckTraceDto
- client.forensics.policy_snapshot(hash_hex) → PolicySnapshotDto
- client.forensics.monitor_rule_evaluations(monitor_id, rule_type=, region=,
  only_matched=, from_=, to=, page=, size=) → Page[RuleEvaluationDto]
- client.forensics.monitor_transitions(monitor_id, from_=, to=, page=, size=)
  → Page[IncidentStateTransitionDto]

Pydantic models for IncidentTimelineDto, CheckTraceDto, PolicySnapshotDto,
RuleEvaluationDto, IncidentStateTransitionDto regenerated from the API spec
and re-exported from devhelm.types / devhelm.__init__.

Made-with: Cursor
@caballeto caballeto merged commit 6681850 into main Apr 29, 2026
4 checks passed
@caballeto caballeto deleted the feat/forensics branch April 29, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant