Skip to content

Portfolio: lint, types, hybrid retrieval, evals, Docker and docs - #7

Merged
sklsp merged 48 commits into
mainfrom
portfolio
Oct 19, 2026
Merged

sklsp merged 48 commits into
mainfrom
portfolio

Conversation

@sklsp

@sklsp sklsp commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Makes Apollo recruiter-ready: lint, types, tests, retrieval evals, hybrid search, Docker and docs.

What changed

  • Code quality: ruff and mypy configs, zero findings, both in CI with a coverage report.
  • Retrieval: a BM25 keyword index and reciprocal rank fusion behind RAG_HYBRID (auto, vector or keyword).
  • Evals: a chunking grid and hybrid mode in the eval command, with a regression gate in CI. Measured baselines: MiniLM hit@4 1.0000, MRR 0.9757; hashing hit@4 0.2292.
  • Tests: the suite runs in about 85 s instead of 320 s, and tests no longer write into the real data/ folder.
  • Docker: an image, a compose file, and a build plus smoke job in CI.
  • Docs: ARCHITECTURE.md, DESIGN.md, EVAL.md, the README engineering section, the CHANGELOG, and a test that keeps doc paths honest.

Checks

  • pytest: 425 passed (run locally twice).
  • Dash scan is clean.

🤖 Generated with Claude Code

sklsp and others added 30 commits October 15, 2026 14:27
ruff --fix with the safe rules only (F401, W293, I001, UP017, UP035, UP015):
no logic changes. pytest: 261 passed in 79.58s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tics, llm_client, memory, vector store, entrypoint test)
evals.dataset turns corpus/*.md + questions.json into frozen dataclasses (CorpusDoc, Question, EvalDataset) with validation: non-empty docs, unique question ids, well-formed fields, and cross-check that every source_docs reference resolves to a real document. 16 tests pin the committed dataset (12 docs, q01-q48, 4 cross-doc questions) and cover all error paths.
evals.metrics scores document-level retrieval quality: recall_at_k, reciprocal_rank (raw chunk ranks), hit_at_k, plus QuestionResult and summarize() -> MetricsSummary(mean_recall@k, mrr, hit_rate@k). Semantics match what the pipeline actually consumes: the top-k cutoff applies to chunks (repeats occupy slots) and each document counts once within a cutoff. 23 tests cover perfect/partial/zero recall, cutoff boundaries, rank shifts from repeats, error paths, and hand-computed aggregates.
evals.index.build_index chunks every corpus document with the production chunker (app.services.rag.chunking) and indexes the chunks in a fresh in-memory VectorStore, so the evaluation measures exactly what the RAG pipeline does. Chunking parameters default to settings.rag_chunk_size/rag_chunk_overlap; the embedder is injected via a BatchEmbedder protocol (tests use a deterministic content-hashed fake, the runner will pass EmbeddingClient). Returns IndexBuildResult(store, num_chunks, chunks_per_doc); dimension is inferred from the embedder output. 11 tests: chunk counts/metadata/ordering vs the production chunker, single batch call in doc order, self-query ranks own doc first at score ~1.0, error paths, full committed corpus builds, and defaults-follow-settings.
sklsp and others added 18 commits October 17, 2026 19:09
Services persist under settings.data_dir and some are built at import time,
so the suite appended to data/sessions.json on every run until it reached
24 GB and saving it raised MemoryError. conftest now points data_dir at a
throwaway temp folder before anything is imported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checks README.md and every docs/*.md for em/en dashes, backticked repo paths that do not exist (after cutting :line / ::name suffixes), and unclosed mermaid blocks. Keeps passing while those files are still missing.

docs/EVAL.md: replaced 16 em dashes with colons/semicolons/commas so the new test passes; README.md needed no changes. Full suite: 425 passed in 84s (junitxml: 0 failures, 0 skipped).
Intro paragraph plus a 15-row Module/Responsibility table, one sentence per module from its docstring and main class.

Two spec paths were stale and are documented as they actually exist: app/services/rag/bm25.py (not keyword.py) and evals/runner.py (there is no app/eval package; the eval harness lives in top-level evals/). Full suite: 425 passed in 85s (junitxml: 0 failures, 0 skipped); test_docs validates every backticked path.
Two sections with mermaid diagrams, every function name verified against the code first: 'Chat with documents' (sequenceDiagram browser -> chat route -> RAGService.query -> VectorStore.search and KeywordIndex.search when RAG_HYBRID includes the keyword leg -> LLMService.chat) and 'Document upload' (flowchart POST /documents/upload through extract_text, DocumentService.store_document, chunk_text, EmbeddingClient.embed_batch, VectorStore.add plus the OllamaServiceError rollback). Five numbered lines under each diagram with backticked file paths.

Full suite: 425 passed in 85s (junitxml: 0 failures, 0 skipped); test_docs validates the mermaid blocks and every path.
@sklsp
sklsp merged commit f988c0c into main Oct 19, 2026
4 checks passed
@sklsp
sklsp deleted the portfolio branch November 24, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant