feat(wiki): Phase 5 — /api/wiki/* read + admin-enqueue endpoints#8362
Merged
HydraOps-T-rav merged 1 commit intomainfrom Apr 20, 2026
Merged
feat(wiki): Phase 5 — /api/wiki/* read + admin-enqueue endpoints#8362HydraOps-T-rav merged 1 commit intomainfrom
HydraOps-T-rav merged 1 commit intomainfrom
Conversation
4 tasks
HydraOps-T-rav
pushed a commit
that referenced
this pull request
Apr 20, 2026
Phase 4 (RepoWikiLoop maintenance PR) added ``queue_drained`` to the zero-repos early-return so admin tasks targeting freshly-migrated repos don't pile up in the queue. This scenario test still asserted the pre-Phase-4 shape and broke CI on #8362 even though its source change was from PR #8359 that already merged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HydraOps-T-rav
pushed a commit
that referenced
this pull request
Apr 20, 2026
Phase 4 (RepoWikiLoop maintenance PR) added ``queue_drained`` to the zero-repos early-return so admin tasks targeting freshly-migrated repos don't pile up in the queue. This scenario test still asserted the pre-Phase-4 shape and broke CI on #8362 even though its source change was from PR #8359 that already merged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the dashboard API surface for the git-backed repo wiki. Read
endpoints traverse the tracked ``repo_wiki/`` directory under
``config.repo_root / config.repo_wiki_path`` (Phase 2 layout); admin
endpoints enqueue MaintenanceTask entries into RepoWikiLoop's queue so
all edits go through the single-track commit path that Phase 4 ships
via ``chore(wiki): maintenance`` PRs. Nothing here mutates the wiki
directly.
Routes (src/dashboard_routes/_wiki_routes.py)
- GET /api/wiki/repos — list repos with a wiki
- GET /api/wiki/repos/{owner}/{repo}/entries — filter by topic/status/q, paginated
- GET /api/wiki/repos/{owner}/{repo}/entries/{entry_id} — full entry + frontmatter
- GET /api/wiki/repos/{owner}/{repo}/log — merged per-issue audit log
- GET /api/wiki/maintenance/status — queue depth + open PR
- POST /api/wiki/admin/force-compile — enqueue synthesis task
- POST /api/wiki/admin/mark-stale — enqueue stale flag write
- POST /api/wiki/admin/rebuild-index — enqueue index rebuild
- POST /api/wiki/admin/run-now — trigger loop immediately
(soft-fallback when loop
has no trigger hook)
Path-traversal guards reject owner/repo values containing ``..`` or
``/``; entry_id is validated as 1–6 digits before any filesystem lookup.
Wiring
Registered in ``src/dashboard_routes/_routes.py`` alongside the other
sub-routers. Admin/status endpoints look up ``RepoWikiLoop`` and its
``MaintenanceQueue`` lazily via ``ctx.get_orchestrator()._svc`` — the
orchestrator is constructed after the dashboard, so lazy lookup is the
only option; all handlers return 503 when the loop isn't up yet.
Tests (tests/test_wiki_routes.py)
17 tests across 3 classes use ``make_dashboard_router`` + ``find_endpoint``
to call handlers directly:
- Read — list/filter by topic, filter by status, path-traversal rejection,
404 on unknown id, 400 on non-numeric id, log filter by issue.
- Maintenance status — reports queue depth + open PR URL/branch.
- Admin — force-compile/mark-stale/rebuild-index enqueue correct kinds
and params; 503 when orchestrator is None; run-now calls trigger_now
when available and falls back to acknowledged otherwise.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
347c41a to
53c6f96
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 5 of the git-backed repo wiki. Adds the dashboard API surface. Read endpoints traverse the tracked
repo_wiki/layout (Phase 2); admin endpoints enqueueMaintenanceTaskentries intoRepoWikiLoop._queueso every edit rides the single-track commit path that Phase 4 ships viachore(wiki): maintenancePRs. Nothing here mutates the wiki directly.Routes
/api/wiki/repos/api/wiki/repos/{owner}/{repo}/entries/api/wiki/repos/{owner}/{repo}/entries/{entry_id}/api/wiki/repos/{owner}/{repo}/log/api/wiki/maintenance/status/api/wiki/admin/force-compile/api/wiki/admin/mark-stale/api/wiki/admin/rebuild-index/api/wiki/admin/run-nowSecurity
owner/repopath params reject..or/before any filesystem lookup (path-traversal guard).entry_idvalidated as 1–6 digits.Wiring
src/dashboard_routes/_routes.pyalongside the other sub-routers.RepoWikiLoopand itsMaintenanceQueuelazily viactx.get_orchestrator()._svc— the orchestrator is constructed after the dashboard, so lazy lookup is the only option. All admin handlers return 503 when the loop isn't up yet.Tests
17 tests across 3 classes (
tests/test_wiki_routes.py) usemake_dashboard_router+find_endpointto call handlers directly:trigger_nowwhen available and falls back to acknowledged otherwise.Test plan
uv run pytest tests/test_wiki_routes.py— 17 passed.make lint-checkclean.make quality-liteclean.make quality.🤖 Generated with Claude Code