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:
parent
0fdebc6aa8
commit
5a7a6ef5ee
9 changed files with 599 additions and 50 deletions
33
api/routers/consistency_sweep.py
Normal file
33
api/routers/consistency_sweep.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue