feat(STATE-WP-0064): add state-hub-consistency-sweep ActivityDefinition

Land the 15-minute consistency sync definition disabled until manual
canary and cutover from the local custodian-sync timer.
This commit is contained in:
2026-06-21 20:19:22 +02:00
parent 4eec96aa02
commit 8cfda08cea

View File

@@ -0,0 +1,88 @@
---
id: "7c4e9a12-8f3b-4d5e-9c6a-1b2d3e4f5a6b"
name: "State Hub Consistency Sweep"
type: activity-definition
version: "1.0"
enabled: false
owner: custodian
governance: custodian
status: proposed
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
bind_to: context.consistency_sweep_remote_all
---
# ActivityDefinition: State Hub Consistency Sweep
## Purpose
This definition is the activity-core handoff point for
`STATE-WP-0064 - Move State Hub consistency sync to Railiance01`.
It schedules the 15-minute ADR-001 reconciliation sweep across all
registered repos with local paths on the workstation State Hub host.
State Hub owns `scripts/consistency_check.py`, lock semantics, and the
`consistency_sweep_remote_all` progress event; activity-core owns the
cron schedule and ActivityRun audit trail.
## Runner Status
This definition stays `enabled: false` until a successful manual canary
against Railiance01 Temporal.
Cutover boundary:
- The local `custodian-sync.timer` remains the interim primary runner
during the parallel week in `STATE-WP-0064-T03`.
- After cutover, disable the local timer and enable this definition as
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` State Hub context resolver issues:
- `POST /consistency/sweep/remote-all`
- payload: `{"max_seconds": 300}`
The context source is marked `required: true`. A failed State Hub call
fails the activity-core workflow visibly instead of silently binding an
empty context. On success, the response is stored in the ActivityRun
`context_snapshot` under `consistency_sweep_remote_all`.
State Hub runs `consistency_check.py --remote --all --json` on the
workstation host and records a compact progress event with event type
`consistency_sweep_remote_all`, including processed repos and skip
metadata.
`STATE_HUB_URL` must point at the workstation State Hub through the
ops-bridge tunnel service (for example `actcore-state-hub-bridge`), not
at 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