Skip to content

feat(serving): alert history + alert-rule repository behind ControlPlaneStore (ADR 0010 slice 2) - #132

Merged
brownjuly2003-code merged 2 commits into
mainfrom
feature/control-plane-slice2-alerts
Jul 2, 2026
Merged

brownjuly2003-code merged 2 commits into
mainfrom
feature/control-plane-slice2-alerts

Conversation

@brownjuly2003-code

Copy link
Copy Markdown
Owner

Summary

Second rollout slice of ADR 0010: alert delivery history and the alert-rule repository (including mutable runtime state — state, fired_at, last_escalation_level, flap window, cooldown) move behind the ControlPlaneStore port. Pure extraction — table DDL, the YAML file format, and dispatcher/router behavior are byte-compatible; no behavior change on the embedded (default) profile.

  • ControlPlaneStore gains log_alert_delivery / get_alert_delivery_history (mirrors the webhook attempt-log shape) and load_alert_rules / save_alert_rules (JSON-shaped records — the port doesn't import the AlertRule pydantic model, avoiding a cycle with alerts.dispatcher, which imports get_control_plane_store to resolve the store).
  • EmbeddedControlPlaneStore gains ensure_alert_history_table (moved verbatim from alerts/history.py, same catalog_ddl_lock discipline as its webhook siblings) and alert_rules_path_provider (mirrors conn_provider — resolved per call so app.state.alert_config_path swaps in tests keep working).
  • alerts/escalation.py and routers/alerts.py no longer reach query_engine._conn (structural ratchet test extended); create_alert / list_alerts / get_alert / update_alert / deactivate_alert now take the FastAPI app (resolving the store internally) instead of a bare Path.
  • src/serving/api/alerts/history.py removed; its DB-plumbing backwards-compat re-exports (get_alert_history, ensure_alert_history_table) retired from the alert_dispatcher.py shim — internal plumbing, not public SDK surface.

Test plan

  • tests/unit/test_control_plane_store.py — new alert-history-log + YAML rule-repository round-trip coverage, structural ratchet extended to the alerts subsystem
  • test_catalog_ddl_concurrency, test_alert_dispatcher_backcompat, test_alerts_router_unit, test_blocking_routes_offloaded, integration test_alert_dedup rewired to the new module/signatures
  • Full unit+property: 1561 passed
  • mypy strict: clean
  • ruff: clean
  • Integration (docker/live excluded): 206 passed, 19 skipped

🤖 Generated with Claude Code

…aneStore (ADR 0010 slice 2)

Second rollout slice of ADR 0010: alert delivery history and the alert-rule
repository (including mutable runtime state — state, fired_at,
last_escalation_level, flap window, cooldown) move behind the
ControlPlaneStore port. Pure extraction — table DDL, the YAML file format,
and the dispatcher/router behavior are byte-compatible; no behavior change
on the embedded (default) profile.

- ControlPlaneStore gains log_alert_delivery / get_alert_delivery_history
  (mirrors the webhook attempt-log shape) and load_alert_rules /
  save_alert_rules (JSON-shaped records — the port doesn't import the
  AlertRule pydantic model, avoiding a cycle with alerts.dispatcher, which
  imports get_control_plane_store to resolve the store).
- EmbeddedControlPlaneStore gains ensure_alert_history_table (moved verbatim
  from alerts/history.py, same catalog_ddl_lock discipline as its webhook
  siblings) and alert_rules_path_provider (mirrors conn_provider — resolved
  per call so app.state.alert_config_path swaps in tests keep working).
- alerts/escalation.py and routers/alerts.py no longer reach
  query_engine._conn (structural ratchet test extended); create_alert /
  list_alerts / get_alert / update_alert / deactivate_alert now take the
  FastAPI app (resolving the store internally) instead of a bare Path.
- src/serving/api/alerts/history.py removed; its DB-plumbing backwards-compat
  re-exports (get_alert_history, ensure_alert_history_table) retired from
  the alert_dispatcher.py shim — internal plumbing, not public SDK surface.

Tests: tests/unit/test_control_plane_store.py gains alert history log +
YAML rule-repository round-trip coverage; test_catalog_ddl_concurrency,
test_alert_dispatcher_backcompat, test_alerts_router_unit,
test_blocking_routes_offloaded and integration test_alert_dedup rewired to
the new module/signatures.

Verified: full unit+property 1561 passed, mypy strict clean, ruff clean,
integration (docker/live excluded) 206 passed/19 skipped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

DORA Metrics

  • Window: last 30 days
  • Branch: main
  • Deployment frequency: 126 total / 29.4 per week
  • Lead time for changes: avg 0.41h / median 0.0h
  • Change failure rate: 76.98% (97/126)
  • MTTR: 0.25h across 3 incident(s)

@brownjuly2003-code
brownjuly2003-code merged commit e88d5b1 into main Jul 2, 2026
22 checks passed
@brownjuly2003-code
brownjuly2003-code deleted the feature/control-plane-slice2-alerts branch July 2, 2026 17:39
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.

2 participants