feat(RMGR-WP-0002): dual-run writeback, flags, meter, SH facade
Add dual-run flags/meter, harden task-status (idempotency, UUID, head, push), State Hub adapter for PATCH /tasks and C-15/reconcile proxy, pilot evidence, and finish RMGR-WP-0002.
This commit is contained in:
parent
bb1d030257
commit
310b43079d
14 changed files with 679 additions and 50 deletions
50
docs/dual-run.md
Normal file
50
docs/dual-run.md
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Dual-run flags (RMGR-WP-0002)
|
||||
|
||||
State Hub remains the MCP/REST entrypoint. When flags are on, **checkout
|
||||
mutation** is executed by Repo Manager.
|
||||
|
||||
## Environment variables
|
||||
|
||||
| Variable | Meaning |
|
||||
| --- | --- |
|
||||
| `RM_WRITEBACK=1` | Task file writeback via `rmgr update-task-status` |
|
||||
| `RM_RECONCILE=1` | `fix-consistency` also runs `rmgr reconcile` for pilots |
|
||||
| `RM_PILOT_REPOS=repo-manager` | Comma-separated slugs; **unset** = all repos when flags on |
|
||||
| `RM_METER_PATH` | JSONL meter path (default `~/.repo-manager/mutation-meter.jsonl`) |
|
||||
| `REPO_MANAGER_SRC` | Optional path to `repo-manager/src` for SH adapter |
|
||||
| `RMGR_BIN` | Optional override command prefix for `rmgr` |
|
||||
|
||||
## Rollback
|
||||
|
||||
```bash
|
||||
unset RM_WRITEBACK RM_RECONCILE RM_PILOT_REPOS
|
||||
# or
|
||||
export RM_WRITEBACK=0 RM_RECONCILE=0
|
||||
```
|
||||
|
||||
State Hub immediately uses native C-15 writeback again.
|
||||
|
||||
## Pilot (repo-manager)
|
||||
|
||||
```bash
|
||||
export RM_WRITEBACK=1
|
||||
export RM_RECONCILE=1
|
||||
export RM_PILOT_REPOS=repo-manager
|
||||
export REPO_MANAGER_SRC=$HOME/repo-manager/src
|
||||
|
||||
# From API host environment, PATCH a task or:
|
||||
cd ~/repo-manager
|
||||
rmgr update-task-status --path . --task-id <canonical-or-uuid> --status progress
|
||||
|
||||
cd ~/repo-manager && statehub fix-consistency
|
||||
rmgr dual-run-status
|
||||
```
|
||||
|
||||
## Meter
|
||||
|
||||
```bash
|
||||
rmgr dual-run-status
|
||||
# or
|
||||
wc -l ~/.repo-manager/mutation-meter.jsonl
|
||||
grep repo-manager ~/.repo-manager/mutation-meter.jsonl | tail
|
||||
```
|
||||
20
docs/evidence/idempotency-pilot.json
Normal file
20
docs/evidence/idempotency-pilot.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"sh-dual-aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa-done-d61b0719-b3fd-4d4d-8179-48f030c33786": {
|
||||
"payload_hash": "1f2ca8802007e55c670745c596bbf92846e673d46d975ef2d1caf18b275240b8",
|
||||
"result": {
|
||||
"command": "repo.work.update_task_status",
|
||||
"status": "applied",
|
||||
"correlation_id": "d61b0719-b3fd-4d4d-8179-48f030c33786",
|
||||
"evidence": {
|
||||
"status": "applied",
|
||||
"git_sha": "3a6366f837d01ddf8e10fe046547a4a0ccc85372",
|
||||
"files_touched": [
|
||||
"workplans/RMGR-WP-0002-pilot.md"
|
||||
],
|
||||
"observed_at": "2026-08-09T21:18:31.232949+00:00",
|
||||
"index_path": "/tmp/rmgr-pilot-1960028/.repo-manager/index.json",
|
||||
"source": "repo-manager"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
docs/evidence/mutation-meter-pilot.jsonl
Normal file
2
docs/evidence/mutation-meter-pilot.jsonl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
{"ts": "2026-08-09T21:18:30.362077+00:00", "source": "repo-manager", "kind": "task_status_writeback", "repo_slug": "repo-manager", "detail": {"task_id": "RMGR-WP-0002-T01", "status": "progress", "git_sha": "0e9d6163318c8d69eeb132facab6570f3a135302", "correlation_id": "a9bcd3bc-24db-493f-8ee1-afce9e5dbe38"}}
|
||||
{"ts": "2026-08-09T21:18:31.234835+00:00", "source": "repo-manager", "kind": "task_status_writeback", "repo_slug": "repo-manager", "detail": {"task_id": "RMGR-WP-0002-T01", "status": "done", "git_sha": "3a6366f837d01ddf8e10fe046547a4a0ccc85372", "correlation_id": "d61b0719-b3fd-4d4d-8179-48f030c33786"}}
|
||||
46
docs/evidence/wp0002-completion.md
Normal file
46
docs/evidence/wp0002-completion.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# RMGR-WP-0002 completion evidence
|
||||
|
||||
**Date:** 2026-08-09
|
||||
**Stage:** ArchitectureBlueprint Stage B (dual-run)
|
||||
|
||||
## Delivered
|
||||
|
||||
| Task | Result |
|
||||
| --- | --- |
|
||||
| T01 flags + meter | `src/repo_manager/dual_run.py`, `docs/dual-run.md` |
|
||||
| T02 hardened command | idempotency, expected_head_sha, UUID match, optional push |
|
||||
| T03 SH facade | `state-hub/api/services/repo_manager_dual_run.py` + PATCH `/tasks` hook |
|
||||
| T04 reconcile proxy | `fix_repo` calls `rmgr reconcile` when `RM_RECONCILE` + pilot |
|
||||
| T05 pilot | Fixture + SH facade call → `applied` + git_sha; meter lines |
|
||||
| T06 package | this file + `wp0002-pilot.json` + `mutation-meter-pilot.jsonl` |
|
||||
|
||||
## Operator enable (pilot)
|
||||
|
||||
```bash
|
||||
export RM_WRITEBACK=1
|
||||
export RM_RECONCILE=1
|
||||
export RM_PILOT_REPOS=repo-manager
|
||||
# ensure SH can import/run rmgr:
|
||||
export REPO_MANAGER_SRC=$HOME/repo-manager/src # optional; adapter defaults to ~/repo-manager/src
|
||||
```
|
||||
|
||||
Restart State Hub API process so env is picked up for PATCH dual-run.
|
||||
|
||||
## Rollback
|
||||
|
||||
```bash
|
||||
unset RM_WRITEBACK RM_RECONCILE RM_PILOT_REPOS
|
||||
# restart SH API
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
```bash
|
||||
cd ~/repo-manager && pytest -q # includes test_dual_run.py
|
||||
```
|
||||
|
||||
## STATE-WP-0079 handoff
|
||||
|
||||
Expand `RM_PILOT_REPOS` fleet-wide after meter shows RM writebacks healthy.
|
||||
Meter path: `~/.repo-manager/mutation-meter.jsonl` (or `RM_METER_PATH`).
|
||||
Strangler exit: zero `source=state-hub` checkout mutations for pilot set under load.
|
||||
40
docs/evidence/wp0002-pilot.json
Normal file
40
docs/evidence/wp0002-pilot.json
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"workplan": "RMGR-WP-0002",
|
||||
"pilot_slug": "repo-manager",
|
||||
"flags": {
|
||||
"RM_WRITEBACK": "1",
|
||||
"RM_RECONCILE": "1",
|
||||
"RM_PILOT_REPOS": "repo-manager"
|
||||
},
|
||||
"fixture_path": "/tmp/rmgr-pilot-1960028",
|
||||
"before_sha": "3a856de",
|
||||
"after_cli_sha": "0e9d616",
|
||||
"rollback": "unset RM_WRITEBACK RM_RECONCILE RM_PILOT_REPOS",
|
||||
"meter_path": "/home/worsch/repo-manager/docs/evidence/mutation-meter-pilot.jsonl",
|
||||
"meter_lines": [
|
||||
{
|
||||
"ts": "2026-08-09T21:18:30.362077+00:00",
|
||||
"source": "repo-manager",
|
||||
"kind": "task_status_writeback",
|
||||
"repo_slug": "repo-manager",
|
||||
"detail": {
|
||||
"task_id": "RMGR-WP-0002-T01",
|
||||
"status": "progress",
|
||||
"git_sha": "0e9d6163318c8d69eeb132facab6570f3a135302",
|
||||
"correlation_id": "a9bcd3bc-24db-493f-8ee1-afce9e5dbe38"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-09T21:18:31.234835+00:00",
|
||||
"source": "repo-manager",
|
||||
"kind": "task_status_writeback",
|
||||
"repo_slug": "repo-manager",
|
||||
"detail": {
|
||||
"task_id": "RMGR-WP-0002-T01",
|
||||
"status": "done",
|
||||
"git_sha": "3a6366f837d01ddf8e10fe046547a4a0ccc85372",
|
||||
"correlation_id": "d61b0719-b3fd-4d4d-8179-48f030c33786"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue