Retire the legacy prose-JSON repair stack - #43
Open
Ndevu12 wants to merge 1 commit into
Open
Conversation
Native structured outputs (schema attached via pydantic-ai output_type)
are now the only LLM call path, so the parallel machinery that repaired
free-form JSON responses is removed end to end:
- Delete src/utils/{enhanced_response_handler, fallback_processing,
content_quality, model_adaptation, enhanced_validation, quality_monitor,
retry_manager, response_models} and src/retrieval/helpers_modules/
(~5,100 lines), plus their repair-narrative message formatters.
- Strip the legacy branches and handler/session plumbing from synthesis,
gap analysis, and query expansion; stages now call try_run_structured
directly with heuristic fallbacks unchanged.
- Remove the llm.structured_outputs flag (settings, default.yaml,
.env.example, docs) and the now-unused synthesis retry knobs; research
loop and verification gate on synthesis.llm_enabled alone.
- Rework synthesis/structured-output tests to mock try_run_structured;
drop the deleted stack's test suite; refresh affected docs.
Verified: 411 tests pass, ruff clean, docs policy OK, golden-set metrics
unchanged against main (R@5 0.93, nDCG@10 0.97, MRR 1.00, validity 92%).
Ndevu12
force-pushed
the
refactor/retire-json-repair-stack
branch
from
September 4, 2026 18:10
34e8228 to
c47b842
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
Native structured outputs (#38) made the prose-JSON repair machinery redundant: schemas are attached to agents via pydantic-ai
output_type, validated natively, and retried with validation feedback by the framework itself. This change completes that migration by removing the parallel legacy path entirely — −5,307 / +150 lines — leaving one LLM call path (run_structured/try_run_structured) with the existing heuristic fallbacks as the safety net.What was removed
src/utils/repair stack (8 modules, ~4,400 lines):enhanced_response_handler,fallback_processing,content_quality,model_adaptation,enhanced_validation,quality_monitor,retry_manager,response_models, plus the repair-narrative message formatters that only they used.src/retrieval/helpers_modules/(~700 lines): JSON extraction/validation/recovery helpers whose only remaining consumers were the stack itself and query expansion's legacy branch. (src/retrieval/helpers.pyis unrelated and stays.)handler/session_idplumbing threaded throughextract_papers,synthesize_collective,run_synthesis,analyze_gaps,SynthesisStage, andGapAnalysisStage.llm.structured_outputsflag (settings,config/default.yaml,.env.example, docs) and the now-unusedextraction_max_retries/collective_max_retriessynthesis knobs. Research loop and verification now gate onsynthesis.llm_enabledalone.test_graceful_response_handling.py); synthesis and structured-output tests now mocksrc.models.structured.try_run_structureddirectly, preserving the original behavioral assertions (identity pinning, circuit breaker,max_llm_paperscap, heuristic fallbacks, call-count checks).What did not change
max_llm_paperscap, concurrency control, and identity pinning (paper ID/title always come from retrieval metadata).main(verified by running the harness on both).Verification
pytest: 411 passed, 1 skipped (count drops from 442 because the deleted stack's 31-test suite is gone)ruff check src tests setups: cleanscripts/check_docs_policy.py: OK (63 nav pages, 6 hubs)mainand this branch