feat(RMGR-WP-0003): production pilot dual-run config, bulk, push

Config file dual-run (env override), writeback_push, bulk-status facade
on State Hub, pilot example config, evidence and finished workplan.
This commit is contained in:
tegwick 2026-08-11 02:32:14 +02:00
parent a00a4264da
commit 5921b65c49
6 changed files with 324 additions and 55 deletions

View file

@ -1,4 +1,4 @@
"""Dual-run flags, meter, and hardened task status command."""
"""Dual-run flags, config file, meter, and hardened task status command."""
from __future__ import annotations
@ -48,10 +48,19 @@ x
return repo
@pytest.fixture(autouse=True)
def _clear_dual_run_cache():
dual_run.reload_config()
yield
dual_run.reload_config()
def test_flags_and_pilot(monkeypatch: pytest.MonkeyPatch):
monkeypatch.delenv("RM_WRITEBACK", raising=False)
monkeypatch.delenv("RM_RECONCILE", raising=False)
monkeypatch.delenv("RM_PILOT_REPOS", raising=False)
monkeypatch.delenv("RM_DUAL_RUN_CONFIG", raising=False)
dual_run.reload_config()
assert dual_run.writeback_enabled() is False
monkeypatch.setenv("RM_WRITEBACK", "1")
@ -63,6 +72,31 @@ def test_flags_and_pilot(monkeypatch: pytest.MonkeyPatch):
assert dual_run.writeback_for_repo("any") is True
def test_config_file(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
cfg = tmp_path / "dual-run.yaml"
cfg.write_text(
"writeback: true\nreconcile: true\nwriteback_push: true\n"
"pilot_repos:\n - repo-manager\n",
encoding="utf-8",
)
monkeypatch.delenv("RM_WRITEBACK", raising=False)
monkeypatch.delenv("RM_RECONCILE", raising=False)
monkeypatch.delenv("RM_WRITEBACK_PUSH", raising=False)
monkeypatch.delenv("RM_PILOT_REPOS", raising=False)
monkeypatch.setenv("RM_DUAL_RUN_CONFIG", str(cfg))
dual_run.reload_config()
assert dual_run.writeback_enabled() is True
assert dual_run.reconcile_enabled() is True
assert dual_run.writeback_push_enabled() is True
assert dual_run.writeback_for_repo("repo-manager") is True
assert dual_run.writeback_for_repo("other") is False
# env overrides file
monkeypatch.setenv("RM_WRITEBACK", "0")
dual_run.reload_config()
assert dual_run.writeback_enabled() is False
def test_meter(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
meter = tmp_path / "meter.jsonl"
monkeypatch.setenv("RM_METER_PATH", str(meter))
@ -106,7 +140,6 @@ def test_update_by_uuid_and_idempotency(tmp_path: Path, monkeypatch: pytest.Monk
assert r2.status == "applied"
assert r2.evidence.get("git_sha") == r1.evidence.get("git_sha")
# Different payload same key → conflict
r3 = update_task_status(
repo,
"11111111-1111-4111-8111-111111111111",