feat(STATE-WP-0064): start parallel week with source-tagged sweep runners

Tag consistency_sweep_remote_all progress events by source, route the local
timer through the API, add a parallel-week comparison script, and document
the 2026-06-21 to 2026-06-28 observation window for T03.
This commit is contained in:
2026-06-21 21:46:43 +02:00
parent 696b628142
commit ab14e77e77
9 changed files with 157 additions and 16 deletions

View File

@@ -17,9 +17,10 @@ from api.services import consistency_sweep as sweep_service
@pytest.mark.asyncio
async def test_remote_all_sweep_records_progress_and_parses_stderr(client, monkeypatch):
async def fake_run_remote_all_sweep(session, *, max_seconds: int):
async def fake_run_remote_all_sweep(session, *, max_seconds: int, source: str = "api"):
return ConsistencySweepRemoteAllRun(
max_seconds=max_seconds,
source=source,
exit_code=0,
lock_skipped=False,
repos_processed=[
@@ -57,9 +58,10 @@ async def test_remote_all_sweep_records_progress_and_parses_stderr(client, monke
@pytest.mark.asyncio
async def test_remote_all_sweep_lock_skip_is_idempotent(client, monkeypatch):
async def fake_run_remote_all_sweep(session, *, max_seconds: int):
async def fake_run_remote_all_sweep(session, *, max_seconds: int, source: str = "api"):
return ConsistencySweepRemoteAllRun(
max_seconds=max_seconds,
source=source,
exit_code=0,
lock_skipped=True,
repos_processed=[],
@@ -175,10 +177,14 @@ async def test_run_remote_all_sweep_invokes_script_and_logs_progress(client, mon
monkeypatch.setattr(sweep_service.asyncio, "to_thread", fake_to_thread)
monkeypatch.setattr(sweep_service.subprocess, "run", fake_run)
response = await client.post("/consistency/sweep/remote-all", json={"max_seconds": 120})
response = await client.post(
"/consistency/sweep/remote-all",
json={"max_seconds": 120, "source": "local-timer"},
)
assert response.status_code == 201, response.text
body = response.json()
assert body["source"] == "local-timer"
assert "--remote" in captured["cmd"]
assert "--all" in captured["cmd"]
assert captured["cmd"][captured["cmd"].index("--max-seconds") + 1] == "120"
@@ -191,4 +197,5 @@ async def test_run_remote_all_sweep_invokes_script_and_logs_progress(client, mon
params={"event_type": "consistency_sweep_remote_all"},
)
assert events.status_code == 200, events.text
assert events.json()[0]["detail"]["skipped_clean"] == ["quiet-repo"]
assert events.json()[0]["detail"]["skipped_clean"] == ["quiet-repo"]
assert events.json()[0]["detail"]["source"] == "local-timer"