feat(STATE-WP-0064): add consistency sweep remote-all API endpoint

Expose POST /consistency/sweep/remote-all so activity-core can trigger
the workstation ADR-001 remote-all sweep via the bridge tunnel pattern.
Records consistency_sweep_remote_all progress events and documents the
cutover runbook while the local custodian-sync timer remains interim.
This commit is contained in:
2026-06-21 20:19:22 +02:00
parent 0fdebc6aa8
commit 5a7a6ef5ee
9 changed files with 599 additions and 50 deletions

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
import json
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.ext.asyncio import AsyncSession
from api.database import get_session
from api.schemas.consistency_sweep import (
ConsistencySweepRemoteAllGenerate,
ConsistencySweepRemoteAllRun,
)
from api.services.consistency_sweep import run_remote_all_sweep
router = APIRouter(prefix="/consistency/sweep", tags=["consistency"])
@router.post(
"/remote-all",
response_model=ConsistencySweepRemoteAllRun,
status_code=status.HTTP_201_CREATED,
)
async def sweep_remote_all(
body: ConsistencySweepRemoteAllGenerate,
session: AsyncSession = Depends(get_session),
) -> ConsistencySweepRemoteAllRun:
try:
return await run_remote_all_sweep(session, max_seconds=body.max_seconds)
except json.JSONDecodeError as exc:
raise HTTPException(
status_code=500,
detail=f"Consistency sweep returned invalid JSON: {exc}",
) from exc