the-custodian/activity-definitions/state-hub-consistency-sweep.md
codex 1e2199ddc7
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
docs: record repo-manager as consistency sweep engine
ACTIVITY-WP-0029 keeps the 15-minute schedule in activity-core and
treats State Hub as the dual-run adapter until REPO_MANAGER_URL is set.
2026-08-18 10:53:03 +02:00

83 lines
No EOL
2.7 KiB
Markdown

---
id: "7c4e9a12-8f3b-4d5e-9c6a-1b2d3e4f5a6b"
name: "State Hub Consistency Sweep"
type: activity-definition
version: "1.0"
enabled: true
owner: custodian
governance: custodian
status: active
created: "2026-06-21"
trigger:
type: cron
cron_expression: "*/15 * * * *"
timezone: UTC
misfire_policy: skip
context_sources:
- type: state-hub
query: consistency_sweep_remote_all
required: true
params:
max_seconds: 300
source: activity-core
bind_to: context.consistency_sweep_remote_all
---
# ActivityDefinition: State Hub Consistency Sweep
## Purpose
This definition is the activity-core handoff point for the 15-minute
ADR-001 reconciliation sweep (STATE-WP-0064, ACTIVITY-WP-0029).
activity-core owns the cron schedule and ActivityRun audit trail.
**repo-manager** owns the C-rule engine. State Hub
`POST /consistency/sweep/remote-all` is the dual-run adapter until
`REPO_MANAGER_URL` / `CONSISTENCY_SWEEP_URL` points at repo-manager.
## Runner Status
`enabled: true` during `STATE-WP-0064-T03` parallel week (started
2026-06-21) alongside the local `custodian-sync.timer`. Both invoke the
same State Hub API; the process lock makes overlapping runs idempotent.
Cutover boundary:
- **Parallel week (T03):** cluster schedule and local timer both active.
- **After T04 cutover:** disable the local timer; this definition remains
the sole primary runner.
- Do not treat the local timer and this activity-core schedule as two
independent primary runners after cutover.
## Trigger
Every 15 minutes in UTC, with `misfire_policy: skip`.
If the activity-core host is offline at a scheduled tick, the missed run
is skipped rather than replayed as a burst after the host returns.
## Deterministic State Hub Invocation
The `consistency_sweep_remote_all` resolver issues:
- `POST {sweep_base}/consistency/sweep/remote-all`
- payload: `{"max_seconds": 300, "source": "activity-core"}`
`sweep_base` is `CONSISTENCY_SWEEP_URL` or `REPO_MANAGER_URL` or
`STATE_HUB_URL` (default dual-run adapter). The context source is
`required: true`. A failed call fails the workflow visibly. On success,
the ActivityRun snapshot includes `engine_owner`, `adapter`, and
`sweep_url`.
`STATE_HUB_URL` (adapter default) must point at the workstation State Hub
through the ops-bridge tunnel, not a cluster-local checkout path.
## Output Contract
The run should produce:
- one State Hub progress event with `event_type: consistency_sweep_remote_all`
- zero or more per-repo consistency reports in the API response
- a lock-skipped response when another remote-all sweep is already active
- one activity-core ActivityRun containing the sweep response metadata
- no LLM call and no direct workplan or canon edits