feat(rag,ui): index bundled project docs into the RAG corpus (#214)#215
Conversation
There was a problem hiding this comment.
Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Implements PRP-23 — RAG Corpus Manager (MVP). Closes #214.
What
Adds one additive orchestration endpoint,
POST /rag/index/project-docs, that discovers the repo's bundled markdown (docs/**,PRPs/**, and the root allow-listREADME.md/AGENTS.md/CHANGELOG.md) and indexes each file through the existingRAGService.index_documentpath — reusing its chunking, embedding, SHA-256 content-hash idempotency, and upsert. The Admin → RAG Sources tab gets an Index Project Docs button.No Alembic migration (no schema change —
categoryrides in the existingDocumentSource.metadata_JSONB), no new slice, no.envvar, noapp/main.pychange.Changes
Backend (
app/features/rag/)schemas.py—IndexProjectDocsRequest/ProjectDocResult/IndexProjectDocsResponse.service.py— pure_discover_project_doc_files()+ asyncindex_project_docs()orchestrator;_PROJECT_ROOT_FILESconstant.routes.py—POST /rag/index/project-docs(mirrors theindex_documentroute'sEmbeddingError→502 /SQLAlchemyError→DatabaseErrorhandling).TestIndexProjectDocsEndpointintegration class; conftest cleanup glob widenedtest-%→%test-%for nested fixture paths.Frontend
types/api.ts— 3 new interfaces.use-rag-sources.ts—useIndexProjectDocsmutation hook (invalidates['rag-sources']).admin.tsx— Index Project Docs button (spinner,toast.success/toast.warning/toast.error).Docs —
API_CONTRACTS.mdendpoint row; thePRPs/PRP-23-*.mdplan.Validation
ruff check+ruff format --checkclean; CRLF line endings preserved.mypy --strict+pyright --strictclean (218 files).test_strict_mode_policy.pystill green.tsc --noEmitclean,lint0 errors, 54 tests pass.qwen3-embedding:4b@ dim 1536): real index populated 112 sources / 1400 chunks; semantic search returns cited chunks; the Admin button shows the success toast (unchanged 112 — 1400 chunkson the idempotent re-run); Knowledge page renders the corpus; zero console errors.Known limitation (follow-up candidate)
POST /rag/index/project-docshas no concurrency guard — two overlapping calls race onindex_document's check-then-insert and one returns 500 on auq_source_type_pathviolation. This is a pre-existing property ofindex_document(shared withPOST /rag/index), not introduced here; a single click works correctly. A module-levelasyncio.Lock(as the demo slice uses) would be a clean follow-up.Added: ForecastLab user guides (#216)
A second commit (
docs: add forecastlab user-facing guides (#216)) adds four curated, user-facing guides underdocs/user-guide/—getting-started.md,dashboard-guide.md,feature-reference.md,agents-and-rag-guide.md— synthesized from existing repo material and cross-checked against the codebase (routes, endpoints, seeder, agent safety limits). These replace the raw internal docs as the intended RAG-corpus content. Also addresses #216.