generated from coulomb/repo-seed
Delivers all 12 tasks (T22–T33): Temporal Schedule manager + startup sync, NATS JetStream event router, FastAPI CRUD + manual trigger, Prometheus metrics wiring, custom search-attribute tagging, and operational runbook. Marks workplan status as done. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4.4 KiB
4.4 KiB
id, type, domain, repo, status, state_hub_workstream_id, tasks
| id | type | domain | repo | status | state_hub_workstream_id | tasks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| custodian-WP-0002 | workplan | custodian | activity-core | done | 3a4f47d9-8bc1-434e-acb4-bed5d4dacda0 |
|
activity-core Triggers & Ops
Workstream: activity-core Triggers & Ops
Hub ID: 3a4f47d9-8bc1-434e-acb4-bed5d4dacda0
Depends on: custodian-WP-0001 (Foundation — Temporal Backbone)
Status: DONE (2026-03-28)
Purpose
Add automated triggering (time-based via Temporal Schedules and event-driven via Event Router), a REST admin API, Prometheus metrics, and an operational runbook. Transforms the manually-triggered backbone from WP-0001 into a self-operating service.
Decisions resolved
- Event broker choice (hub:
bc47c9c2-5643-4a88-8114-601738a2f64e): NATS + JetStream chosen.
Phase 4 — Time-Based Triggers (Temporal Schedules) ✓
| Task | Priority | Status |
|---|---|---|
| T22: Write schedule_manager.py | medium | done |
| T23: Bootstrap script to sync schedules on startup | medium | done |
| T24: Handle misfire policy in schedule config | medium | done |
| T25: Test schedule pause/resume lifecycle | medium | done |
Phase 5 — Event-Driven Triggers ✓
| Task | Priority | Status |
|---|---|---|
| T26: Implement Event Router service | medium | done |
| T27: Implement routing rules (event.type + filters → activity_ids) | medium | done |
| T28: Start/signal workflow from Event Router | medium | done |
| T29: Integration test — publish event → observe workflow run | medium | done |
Phase 6 — Observability & Admin ✓
| Task | Priority | Status |
|---|---|---|
| T30: REST API (FastAPI) — CRUD for ActivityDefinition | low | done |
| T31: Wire Temporal SDK metrics to Prometheus | low | done |
| T32: Tag workflows with activity_id for Temporal visibility search | low | done |
| T33: Write operational runbook | low | done |
Files produced
| File | Purpose |
|---|---|
src/activity_core/schedule_manager.py |
T22/T24: upsert/delete/list Temporal Schedules |
src/activity_core/sync_schedules.py |
T23: bootstrap schedule sync |
src/activity_core/event_router.py |
T26/T27/T28: NATS JetStream → Temporal |
src/activity_core/api.py |
T30: FastAPI CRUD + manual trigger |
tests/test_schedule_lifecycle.py |
T25: schedule lifecycle unit tests |
tests/test_event_router.py |
T29: event router unit + integration tests |
docs/runbook.md |
T33: operational runbook |
docker-compose.dev.yml |
added NATS service |
Completion criteria ✓
- Schedules fire
RunActivityWorkflowautomatically on cron cadence ✓ - External event published to NATS reaches the correct ActivityDefinition end-to-end ✓
- ActivityDefinitions are manageable via REST API ✓
- Prometheus metrics are scraped ✓
- Runbook is written ✓