Add admin sync hot reload path

This commit is contained in:
2026-06-19 01:54:13 +02:00
parent 6f68f8f9ec
commit 3e93567a53
9 changed files with 676 additions and 72 deletions

View File

@@ -8,7 +8,7 @@ status: active
owner: codex
topic_slug: custodian
created: "2026-06-18"
updated: "2026-06-18"
updated: "2026-06-19"
state_hub_workstream_id: "8887075e-21ec-451b-b82b-cd81035c9ca5"
---
@@ -39,7 +39,7 @@ a repo checkout manager or CI system.
```task
id: ACTIVITY-WP-0012-T01
status: todo
status: done
priority: high
state_hub_task_id: "53a7970b-7eec-47f5-ad30-bbd7c6271952"
```
@@ -57,11 +57,17 @@ Done when:
- failures are collected into a bounded `errors[]` result while preserving the
current startup best-effort behavior.
2026-06-19: Completed. Added `activity_core.sync_service.run_sync`, which
orchestrates ActivityDefinition, event type, and schedule sync independently
from explicit DB session factory and Temporal client dependencies. Worker
startup now calls the shared service for definitions+schedules and logs bounded
stage errors while continuing startup.
## Add Admin Sync Endpoint
```task
id: ACTIVITY-WP-0012-T02
status: todo
status: done
priority: high
state_hub_task_id: "8697c761-15d1-4da0-b66b-d838218a2495"
```
@@ -80,11 +86,17 @@ Done when:
- endpoint tests cover definitions-only, schedules-only, all-sync, and failure
result behavior.
2026-06-19: Completed. Added `POST /admin/sync` with defaults
`definitions=true`, `schedules=true`, and `event_types=false`. The response
reports definition/event counts, schedule upsert/pause/orphan-delete counts, and
bounded `errors[]`. Tests cover definitions-only, schedules-only, all-sync, and
failure-result behavior.
## Preserve Schedule Drift Semantics
```task
id: ACTIVITY-WP-0012-T03
status: todo
status: done
priority: high
state_hub_task_id: "efeac412-632c-4c90-9428-bb575ac7a624"
```
@@ -101,11 +113,18 @@ Done when:
- regression tests demonstrate the Coulomb hourly-to-daily rename shape without
needing a worker restart.
2026-06-19: Completed. `sync_schedules` now returns explicit counts for enabled
schedule upserts, disabled schedule pauses, and orphan deletes. Regression tests
cover the hourly-to-daily rename shape: a new enabled cron schedule is upserted,
the old disabled cron schedule is preserved as paused, unrelated orphan
schedules are deleted, event-triggered definitions do not create schedules, and
one-shot scheduled definitions are no longer mistaken for orphans.
## Optional Background Sync Loop
```task
id: ACTIVITY-WP-0012-T04
status: todo
status: done
priority: medium
state_hub_task_id: "d774087b-c51d-4444-8e90-bfef43765456"
```
@@ -121,6 +140,12 @@ Done when:
last error summary;
- the loop does not block worker startup or workflow task processing.
2026-06-19: Completed by decision. v1 stays manual/operator-triggered through
`POST /admin/sync`; no background loop was added. The runbook records this
posture so customer definition changes stay explicit and the worker does not
start background repo scanning. A periodic loop remains a future option if live
operator use proves it is needed.
## Live No-Restart Smoke
```task
@@ -143,3 +168,7 @@ Done when non-secret State Hub evidence shows:
Current wait reason: this gate depends on the implementation tasks and a
cluster-owned smoke path.
2026-06-19: Implementation tasks T01-T04 are complete and the repository test
suite passed (`192 passed, 1 skipped`). This task is now ready for a
Railiance/operator no-restart smoke using `POST /admin/sync`.