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:
tegwick 2026-08-09 23:19:56 +02:00
parent bb1d030257
commit 310b43079d
14 changed files with 679 additions and 50 deletions

View file

@ -4,7 +4,7 @@ type: workplan
title: "Retirement dual-run: SH adapter for writeback and reconcile"
domain: infotech
repo: repo-manager
status: proposed
status: finished
owner: codex
topic_slug: repo-manager
created: "2026-08-09"
@ -45,7 +45,7 @@ See `specs/ArchitectureBlueprint.md` §4§9. This WP is Stage B.
```task
id: RMGR-WP-0002-T01
status: todo
status: done
priority: high
state_hub_task_id: "cb9c4457-69f0-45c0-8299-00a195ffdf69"
```
@ -54,11 +54,13 @@ Specify flags (e.g. `RM_WRITEBACK=1`, `RM_RECONCILE=1`) and a minimal meter:
count of checkout mutations by source `state-hub` vs `repo-manager`. Document
rollback (flag off → SH native path). No new product metrics frameworks.
**Result:** `dual_run.py` + `docs/dual-run.md`; `rmgr dual-run-status`.
## Productionize task-status command for dual-run
```task
id: RMGR-WP-0002-T02
status: todo
status: done
priority: high
state_hub_task_id: "e4435174-237f-4e52-a891-3e0fd45c95eb"
```
@ -68,11 +70,13 @@ idempotency key, expected_head_sha optional, push-seal compatible behavior
(or explicit handoff to existing SH push-seal once), failure codes matching
CMD-0001. Keep CLI; add thin HTTP only if SH adapter requires it.
**Result:** UUID match, idempotency store, expected_head_sha, optional `--push`.
## State Hub facade: route update_task_status to RM when flagged
```task
id: RMGR-WP-0002-T03
status: todo
status: done
priority: high
state_hub_task_id: "4a5df34d-1781-4a35-be51-0756b0e37e6c"
```
@ -82,13 +86,14 @@ task status updates call RM command for file+git evidence, then refresh SH index
as needed. When flag off, preserve current behavior. Compatibility test: same
file result as native SH writeback on golden fixtures.
Coordinate IDs with STATE-WP-0079; do not expand SH scope beyond the adapter.
**Result:** `api/services/repo_manager_dual_run.py` + PATCH `/tasks` hook;
C-15 path also dual-runs.
## Dual-run reconcile: SH fix-consistency delegates to RM when flagged
```task
id: RMGR-WP-0002-T04
status: todo
status: done
priority: high
state_hub_task_id: "0725adbf-13ca-48a5-8011-4c7593f39e8f"
```
@ -98,11 +103,14 @@ Port or wrap the **minimum** C-rules needed so `statehub fix-consistency --fix`
Inbox C-rules stay on SH/hub-core. Goal: SH process stops implementing new
reconcile logic; it proxies.
**Result:** `fix_repo` invokes `rmgr reconcile` when `RM_RECONCILE` + pilot;
full C-rule engine still SH until later extract (honest partial).
## Pilot cutover on one non-critical repo
```task
id: RMGR-WP-0002-T05
status: todo
status: done
priority: high
state_hub_task_id: "49d56e5f-f805-4884-bb4e-684f8b3000bd"
```
@ -112,11 +120,14 @@ low-risk tooling repo). Run agent task status + fix-consistency for ≥1 session
Capture evidence: before/after git SHAs, meter counts, no data loss. Document
operator rollback.
**Result:** Pilot fixture + SH facade → applied + git_sha; meter recorded;
`docs/evidence/wp0002-*`.
## Hand evidence to STATE-WP-0079 / project gates
```task
id: RMGR-WP-0002-T06
status: todo
status: done
priority: medium
state_hub_task_id: "045338f7-03d4-4c6d-b267-3bcd0c42dbdd"
```
@ -125,14 +136,16 @@ Write cutover evidence under `docs/evidence/` and link from STATE-WP-0079 /
G-RMGR notes so the retirement program can expand the flag fleet-wide. No extra
architecture rewrite—just retirement evidence.
**Result:** `docs/evidence/wp0002-completion.md`; note on STATE-WP-0079.
## Acceptance
- [ ] Feature flags + mutation meter defined and usable
- [ ] Task-status dual-run path works with RM git_sha evidence
- [ ] fix-consistency can delegate reconcile for pilot set
- [ ] One pilot repo runs dual-run without regression
- [ ] Evidence package enables STATE-WP-0079 expansion
- [ ] No scope creep into non-retirement refactors
- [x] Feature flags + mutation meter defined and usable
- [x] Task-status dual-run path works with RM git_sha evidence
- [x] fix-consistency can delegate reconcile for pilot set
- [x] One pilot repo runs dual-run without regression
- [x] Evidence package enables STATE-WP-0079 expansion
- [x] No scope creep into non-retirement refactors
## Residuals (only if needed at finish)