feat(wiki): Phase 8 — compile_topic_tracked + loop integration#8372
Merged
HydraOps-T-rav merged 1 commit intomainfrom Apr 20, 2026
Merged
feat(wiki): Phase 8 — compile_topic_tracked + loop integration#8372HydraOps-T-rav merged 1 commit intomainfrom
HydraOps-T-rav merged 1 commit intomainfrom
Conversation
Turns LLM synthesis on against the tracked per-entry layout. Once a
topic has ≥ 5 ``status: active`` entries, RepoWikiLoop now calls
``WikiCompiler.compile_topic_tracked``: it reads the active entries,
asks the model to consolidate them, writes each synthesis output as a
new per-entry file under
``repo_wiki/{owner}/{repo}/{topic}/{id:04d}-issue-synthesis-{slug}.md``
with ``source_phase: synthesis`` and a ``supersedes:`` list, and
flips every input to ``status: superseded`` with a ``superseded_by``
pointer. Those rewrites land as uncommitted diffs that the same
tick's ``_maybe_open_maintenance_pr`` bundles into the next
``chore(wiki): maintenance`` PR.
Helpers in src/repo_wiki.py
- ``_load_tracked_active_entries(topic_dir)`` — returns rich dicts
(id / title / body / source fields / path) for every ``status:
active`` entry. Lets the compiler build the synthesis prompt
without round-tripping through WikiEntry.
- ``_write_tracked_synthesis_entry(topic_dir, *, entry, topic,
supersedes)`` — writes a synthesis entry with
``source_issue: synthesis`` and a ``supersedes: id1,id2,…`` field.
Filename uses ``issue-synthesis`` so synthesis outputs are
distinguishable at a glance from ingest entries.
- ``_mark_tracked_entry_superseded(entry_path, *, superseded_by)`` —
flips ``status`` → ``superseded`` and adds ``superseded_by``.
Silent no-op on files without frontmatter.
WikiCompiler
- ``compile_topic_tracked(tracked_root, repo, topic)`` — tracked
counterpart of ``compile_topic``. Reuses ``_COMPILE_TOPIC_PROMPT``
and ``_parse_entries``. Returns 0 when the topic has < 2 active
entries, when the LLM call fails, or when the parse returns
nothing.
RepoWikiLoop._do_work
- Existing legacy compile pass unchanged.
- New tracked compile pass runs when ``tracked_root`` is set and the
topic has ≥ 5 active entries. Failures log at ``warning`` and
don't crash the tick.
- Module-level ``_iter_tracked_active_files(topic_dir)`` streams
active files without building WikiEntry objects — avoids paying
the pydantic round-trip just to count.
Tests (11 new, 45 total in the suite pass)
- ``tests/test_compile_topic_tracked.py``: ``_load_tracked_active_entries``
returns only active (stale / superseded filtered), missing dir, no
frontmatter; ``_write_tracked_synthesis_entry`` frontmatter shape +
monotonic id; ``_mark_tracked_entry_superseded`` status flip + pointer
+ no-op on files without frontmatter; ``compile_topic_tracked``
writes synthesis + supersedes originals, skips when < 2 active
entries, LLM call returning None keeps originals, LLM returning
``[]`` keeps originals.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6df1cc3 to
8431682
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
Closes the last piece of loop-side behaviour that hadn't been ported to the tracked layout. Once a topic has ≥ 5
status: activeentries,RepoWikiLoopnow callsWikiCompiler.compile_topic_tracked: LLM synthesis runs against per-entry files, and the resulting synthesis entries +supersededflag rewrites land in the nextchore(wiki): maintenancePR. Stacked on #8371.What's in
src/repo_wiki.pyhelpers_load_tracked_active_entries(topic_dir)— dicts with id / title / body / source fields / path._write_tracked_synthesis_entry(topic_dir, *, entry, topic, supersedes)— emits per-entry file withsource_issue: synthesis,source_phase: synthesis,supersedes: id1,id2,…, filename{id:04d}-issue-synthesis-{slug}.md._mark_tracked_entry_superseded(entry_path, *, superseded_by)— flips status + adds pointer; no-op on files without frontmatter.WikiCompiler.compile_topic_trackedTracked counterpart of
compile_topic. Reuses_COMPILE_TOPIC_PROMPT+_parse_entries. Returns 0 when < 2 active entries, LLM call fails, or parse returns empty.RepoWikiLoop._do_workLegacy compile pass unchanged. New tracked compile pass runs when
tracked_rootis set and topic has ≥ 5 active entries. Errors log atwarningand don't crash the tick. Module-level_iter_tracked_active_filesstreams active files for the count check without the pydantic round-trip.Tests (11 new, 45 total)
tests/test_compile_topic_tracked.py:_load_tracked_active_entriesreturns only active (filters stale / superseded), missing dir, no-frontmatter tolerance_write_tracked_synthesis_entryfrontmatter shape + monotonic id_mark_tracked_entry_supersededstatus flip + pointer + no-op on files without frontmattercompile_topic_trackedwrites synthesis + supersedes originals, skips < 2 active, LLM None keeps originals, LLM[]keeps originalsStubs
WikiCompiler._call_modelviaAsyncMockso the suite never touches a real LLM backend.Test plan
uv run pytest tests/test_compile_topic_tracked.py tests/test_active_lint_tracked.py tests/test_repo_wiki_loop_pr.py— 45 pass.make lint-checkclean.make quality.🤖 Generated with Claude Code