Fix pipeline bugs, consolidate duplicated code, harden CI, and streamline README - #24
Merged
Merged
Conversation
…pipeline - Run LLM paper extraction concurrently under the configured semaphore instead of sequentially awaiting inside the loop; the circuit breaker still short-circuits remaining papers after repeated failures - Derive recency scores from the current UTC year instead of a hardcoded year that silently goes stale - Persist the expanded query variants generated during a run to session memory instead of always saving an empty list - Return failed provider names structurally from the retrieval fan-out instead of re-parsing warning strings, and aggregate results for providers that share a name - Use the current pydantic-ai structured-output API (output_type / result.output) in LLMProvider.complete; the legacy result_type call raised on pydantic-ai 1.x - Point partial-recovery fallbacks at the real recovery helper; the previous import target never existed and raised ImportError
- Add src/research/text_utils.py as the single home for stop-word sets, generic query terms, query-term extraction, and plural-aware term matching that were copy-pasted across ranking, relevance scoring, clustering, and query expansion - Make cosine similarity a single implementation on the embeddings base module; providers and embedding_context now delegate to it - Vectorize embedding deduplication with one matrix product instead of per-pair Python cosine calls - Route the retrieval stage through the registry's provider fan-out so the gather-and-collect logic exists once - Extract the repeated macro-cluster fallback block in clustering into a helper - Drop the deprecated search_openalex / search_semantic_scholar shims, the unused GAP_ANALYSIS_SYSTEM_PROMPT rebinding, and alias functions that only forwarded to other helpers
…sed JSON stack - Retrieval providers report retry and rate-limit events through the logging system instead of printing to stdout from the data layer - The shared analysis agent is now created on first use via get_analysis_agent(); importing src.analysis no longer resolves settings or constructs a model as a side effect (analysis_agent remains importable through module __getattr__) - Remove src/utils/json_processing.py: production code exclusively uses retrieval/helpers_modules/json_extraction, so the parallel processor and its test class were dead weight - Fix undefined type names, an unused-variable pair, and a placeholder-less f-string surfaced by the new lint gate
…mline README - CI now runs pytest against the whole tests/ directory, so a new test file can never be silently excluded by a stale hardcoded matrix - Add a ruff lint job (syntax errors, undefined names, unused code) with configuration in pyproject.toml - Add tests/conftest.py stubbing the Ollama setup path so the suite is fast and network-independent, and RA_SKIP_SETUP_CHECK so subprocess tests and CI containers can skip environment setup explicitly - Rewrite the README at a standard level: condensed configuration reference, single architecture diagram, troubleshooting trimmed to essentials, license section added
Ndevu12
force-pushed
the
claude/research-assistant-analysis-ciqutp
branch
from
August 11, 2026 08:29
71e7d0a to
daf5be5
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
This PR fixes the concrete bugs found during a full project review, consolidates duplicated code into single implementations, closes quality gaps, and upgrades CI and the README. No features were removed — every change is a correctness fix, a consolidation, or an upgrade. The full test suite passes (353 passed, 1 skipped) and the new lint gate is clean.
Bug fixes
synthesis.concurrencysetting had no effect. Extractions now run throughasyncio.gatherunder the semaphore, with the circuit breaker still cutting over to heuristics after repeated failures.signal_recencyhardcodedcurrent_year = 2026; it now derives the year from the current UTC date.expanded_querieslist; the pipeline now exposes the expansion artifact and the orchestrator stores the real variants and sub-questions.LLMProvider.completeworks on pydantic-ai 1.x. The structured-output branch used the legacyresult_type/result.dataAPI, which raises on the pinned pydantic-ai 1.101.0. It now usesoutput_type/result.output._attempt_partial_recoveryfrom the orchestrator, where it never existed; they now call the realenhanced_partial_recoveryhelper.Consolidation
src/research/text_utils.pyholds the stop-word sets, generic query terms, and plural-aware term matching that were copy-pasted across ranking, relevance scoring, clustering, and query expansion.embedding_contextdelegate to it.search_openalex/search_semantic_scholarshims,src/utils/json_processing.py(unused in production — the handler useshelpers_modules/json_extraction), alias functions, and an unused system-prompt rebinding.Quality upgrades
src.analysisno longer resolves settings or constructs a model as a side effect (analysis_agentremains importable).CI and tests
pytest tests/and adds a ruff lint job (syntax errors, undefined names, unused code) configured inpyproject.toml.tests/conftest.pystubs the Ollama setup path (no test exercised it intentionally), and subprocess-level tests use the newRA_SKIP_SETUP_CHECKenv var. Locally this cut the suite from ~3.5 minutes with network-dependent failures to ~35 seconds, all green.Docs
Verification
pipenv run pytest tests/— 353 passed, 1 skippedruff check src tests setups— cleanpipenv run python scripts/check_docs_policy.py— docs policy OK