feat(wiki): Phase 3.5 — wire plan/review phases to git-backed writes#8358
Merged
HydraOps-T-rav merged 2 commits intomainfrom Apr 19, 2026
Merged
feat(wiki): Phase 3.5 — wire plan/review phases to git-backed writes#8358HydraOps-T-rav merged 2 commits intomainfrom
HydraOps-T-rav merged 2 commits intomainfrom
Conversation
4 tasks
Turns on the Phase 3 per-entry layout from inside the running phase
runners. When `config.repo_wiki_git_backed` is True AND the issue
worktree exists, plan/review phase-ingests write their entries as
per-entry markdown files under `{worktree}/{repo_wiki_path}/` and commit
them via `RepoWikiStore.commit_pending_entries` so the wiki updates ride
the issue's PR. When the flag is False or the worktree is missing, the
legacy topic-level ingest path runs unchanged.
Dedup state (`is_ingested` / `mark_ingested`) continues to live on the
main host's legacy wiki path regardless — the tracked writes are an
additional artifact, not a replacement for dedup bookkeeping. Errors in
the tracked-write path still leave the legacy dedup mark unset so the
next cycle can retry.
Changes:
- PlanPhase._wiki_ingest_plan and ReviewPhase._wiki_ingest_review each
gain `_wiki_tracked_store(issue_number)` and
`_wiki_commit_compiler_entries(...)` helpers. Both cover compiler and
fallback paths: compiler-synthesized entries route through
`write_entry` with `classify_topic`, fallback sections through
`ingest_from_plan(..., git_backed=True)` /
`ingest_from_review(..., git_backed=True)`.
- Promotes `_classify_topic` to a module-level `classify_topic` in
repo_wiki so phase runners can call it without reaching into private
store methods. The store's `_classify_topic` method stays as a
backward-compat shim.
- tests/test_phase_wiki_wiring.py — 10 new parametrized tests covering
both PlanPhase and ReviewPhase: `_wiki_tracked_store` decision under
config flag + worktree-missing branches; `_wiki_commit_compiler_entries`
producing a commit with the expected files; rollback removes prior
writes when one raises mid-batch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Phase 3.5 wiring called `RepoWikiStore.commit_pending_entries` directly from `PlanPhase._wiki_ingest_plan` / `ReviewPhase._wiki_ingest_review`, both of which are `async def`. `commit_pending_entries` runs three synchronous `subprocess.run` git calls (status, add, commit); a slow `git commit` would block the event loop and stall all five concurrent phase loops (ADR-0001). Fix: - Wrap the compiler-path tracked write in `asyncio.to_thread`: `_wiki_commit_compiler_entries` now runs in a worker thread. - Extract the fallback path into module-level `_run_fallback_ingest_plan` / `_run_fallback_ingest_review` helpers so they can be dispatched via `asyncio.to_thread` without binding a method reference. - Legacy (non-git-backed) path unchanged — it was already file-I/O-only and fast enough not to block. Also: - Replaces a private-attribute assertion in test_phase_wiki_wiring.py::TestWikiTrackedStore::test_returns_tracked_store_when_worktree_exists (`tracked._wiki_root == ...`) with a behaviour check: write an entry and assert it lands under `worktree/repo_wiki/<topic>/`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
186001a to
35fc358
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 3.5 of the git-backed repo wiki. Turns on the Phase 3 per-entry write path from inside the running phase runners. Stacked on #8357.
What happens at runtime
When
config.repo_wiki_git_backedis True and the issue worktree exists,PlanPhase._wiki_ingest_planandReviewPhase._wiki_ingest_review:RepoWikiStorepointed at{worktree}/{repo_wiki_path}/.write_entry(compiler path usesclassify_topicper entry; fallback path usesingest_from_plan/review(..., git_backed=True)).append_log.commit_pending_entries— targetedgit add, messagewiki: ingest {phase} for #{issue}.When the flag is False or the worktree is missing, the legacy topic-level ingest path runs unchanged.
Dedup state (
is_ingested/mark_ingested) keeps living on the main host's legacy wiki path regardless — the tracked writes are an additional artifact. Errors leave the legacy dedup mark unset so the next cycle retries.What changed
src/plan_phase.py—_wiki_ingest_plangains_wiki_tracked_store+_wiki_commit_compiler_entrieshelpers; both compiler and fallback paths route through the tracked store when applicable.src/review_phase.py— mirror changes for_wiki_ingest_review.src/repo_wiki.py— promotes_classify_topicto a module-levelclassify_topic(the store's method stays as a backward-compat shim).Rollback discipline
Compiler-synthesized entries are written in a batch; if any write raises mid-loop, every prior file in that batch is unlinked before the exception re-raises (log append never runs; no commit lands). Matches
ingest_from_plan's_write_pairs_or_rollback.Tests
tests/test_phase_wiki_wiring.py— 10 new parametrized tests covering both phases:_wiki_tracked_storereturns None whengit_backed=False_wiki_tracked_storereturns None when the worktree is missing_wiki_tracked_storereturns a worktree-rooted store when both conditions hold_wiki_commit_compiler_entrieswrites files, commits, respectspath_prefix255 tests pass locally (includes the full plan/review/wiki suites).
make lint-checkclean.Test plan
uv run pytest tests/test_plan_phase.py tests/test_review_phase_core.py tests/test_phase_wiki_wiring.py tests/test_repo_wiki*.py tests/test_wiki_migration.py— 255 passed.make lint-check— clean.make quality.wiki: ingest {phase} for #{N}commit in the issue's PR.🤖 Generated with Claude Code