Skip to content

Fix CI lint gate and restore >95% test coverage#21

Merged
dr-gareth-roberts merged 6 commits intomainfrom
fix/ci-coverage-95
Feb 6, 2026
Merged

Fix CI lint gate and restore >95% test coverage#21
dr-gareth-roberts merged 6 commits intomainfrom
fix/ci-coverage-95

Conversation

@dr-gareth-roberts
Copy link
Owner

@dr-gareth-roberts dr-gareth-roberts commented Feb 6, 2026

Summary

  • applies the existing lint-fix commit for unused locals in coverage-focused tests
  • runs Ruff formatting on branch-coverage test files so ruff format --check . passes
  • keeps real (non-excluded) coverage above gate threshold

Verification

  • ruff check .
  • ruff format --check .
  • pytest --cov=insideLLMs --cov-report=term --cov-fail-under=95
    • result: 95.05% total coverage

Open with Devin

Summary by CodeRabbit

  • Chores

    • Updated CI/workflow dependencies (PyYAML, pytest, fastapi, uvicorn).
    • Refactored test infrastructure and formatting for improved maintainability.
  • Tests

    • Enhanced test scaffolding and code organization across multiple test suites.

Copilot AI review requested due to automatic review settings February 6, 2026 17:10
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @dr-gareth-roberts, your pull request is larger than the review limit of 150000 diff characters

@dosubot
Copy link

dosubot bot commented Feb 6, 2026

Related Documentation

Checked 15 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

This PR refactors 30+ test files with cosmetic formatting changes (multi-line reflowing, consolidating with-statements, removing unused variable assignments) and updates the CI workflow to add PyYAML/pytest dependencies and adjust the test environment configuration.

Changes

Cohort / File(s) Summary
CI Configuration
.github/workflows/ci.yml
Added PyYAML and pytest as install dependencies; prepended PYTHONPATH=. to pytest invocation; added fastapi and uvicorn to test job installations.
Test Scaffolding
tests/test_models_config_coverage.py
Introduced concrete test model classes (ConcreteModel, ConcreteAsyncModel, FailingModel) and fake error classes (FakeRateLimitError, FakeTimeoutError, FakeAPIError) for abstract model testing; minor formatting adjustments to accommodate new scaffolding.
Functional Refactoring
tests/test_routing_branch_coverage.py
Replaced inline lambda embedder with a named function definition in test_semantic_matcher_cosine_edge_cases_and_embedding_cache; preserves identical downstream behavior.
Adapter & Factory Tests
tests/test_adapters_export_coverage.py
Removed return value assignments from AdapterFactory.create calls; reflowed FallbackChain instantiation to multi-line parenthesized form.
CLI Test Formatting
tests/test_cli_*.py (benchmark, compare, doctor, interactive, misc_command_branches, remaining_coverage, run_command, schema, validate_benchmark_branches)
Consolidated multi-line patch context managers into single with-blocks; removed unused capsys.readouterr() calls; collapsed single-argument function calls into single-line form; reformatted string literals and argument lists for consistency.
Branch Coverage Tests (General)
tests/test_caching_unified_branch_coverage.py, tests/test_context_window_branch_coverage.py, tests/test_cost_tracking_branch_coverage.py, tests/test_deployment_coverage.py, tests/test_evaluation_branch_coverage.py, tests/test_experiment_tracking_coverage.py, tests/test_hitl_branch_coverage.py, tests/test_langchain_integration_coverage.py, tests/test_latency_branch_coverage.py, tests/test_misc_coverage.py, tests/test_orchestration_branch_coverage.py, tests/test_probes_models_coverage.py, tests/test_rate_limiting_branch_coverage.py, tests/test_runtime_config_loader_branch_coverage.py, tests/test_runtime_high_level_branch_coverage.py, tests/test_runtime_reproducibility_branch_coverage.py, tests/test_runtime_results_coverage.py, tests/test_stability_contract.py, tests/test_template_versioning_branch_coverage.py, tests/test_trace_config_branch_coverage.py
Multi-line reflowing of function arguments, monkeypatch calls, and data structures; removal of unused variable assignments; import reordering; no changes to control flow or logic.
Complex Refactoring
tests/test_cli_diff_harness_coverage.py, tests/test_semantic_obs_coverage.py, tests/test_structured_extraction_branch_coverage.py
Extensive reformatting of with-statements to multi-line parenthesized form; consolidation of multiple patch calls; minor adjustments to context binding and unused captures; substantial line count changes with preserved behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping through tests with care so fine,
Formatting lines in patterns divine,
Multi-line branches now standing tall,
Unused captures removed—no waste at all!
Dependencies squared, pytest now ready,
Our warren's code: consistent and steady!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.95% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main objectives: fixing CI lint gate issues and restoring test coverage above 95%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ci-coverage-95

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kiloconnect
Copy link

kiloconnect bot commented Feb 6, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (36 files)
  • .github/workflows/ci.yml
  • tests/test_adapters_export_coverage.py
  • tests/test_caching_unified_branch_coverage.py
  • tests/test_cli_benchmark_coverage.py
  • tests/test_cli_compare_coverage.py
  • tests/test_cli_diff_harness_coverage.py
  • tests/test_cli_doctor_coverage.py
  • tests/test_cli_interactive_coverage.py
  • tests/test_cli_misc_command_branches.py
  • tests/test_cli_remaining_coverage.py
  • tests/test_cli_run_command_coverage.py
  • tests/test_cli_schema_coverage.py
  • tests/test_cli_validate_benchmark_branches.py
  • tests/test_context_window_branch_coverage.py
  • tests/test_cost_tracking_branch_coverage.py
  • tests/test_deployment_coverage.py
  • tests/test_evaluation_branch_coverage.py
  • tests/test_experiment_tracking_coverage.py
  • tests/test_hitl_branch_coverage.py
  • tests/test_langchain_integration_coverage.py
  • tests/test_latency_branch_coverage.py
  • tests/test_misc_coverage.py
  • tests/test_models_config_coverage.py
  • tests/test_orchestration_branch_coverage.py
  • tests/test_probes_models_coverage.py
  • tests/test_rate_limiting_branch_coverage.py
  • tests/test_routing_branch_coverage.py
  • tests/test_runtime_config_loader_branch_coverage.py
  • tests/test_runtime_high_level_branch_coverage.py
  • tests/test_runtime_reproducibility_branch_coverage.py
  • tests/test_runtime_results_coverage.py
  • tests/test_semantic_obs_coverage.py
  • tests/test_stability_contract.py
  • tests/test_structured_extraction_branch_coverage.py
  • tests/test_template_versioning_branch_coverage.py
  • tests/test_trace_config_branch_coverage.py

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the test suite to satisfy the CI lint/format gates (Ruff) while keeping measured coverage above the configured 95% threshold, primarily by reformatting coverage-focused tests and removing unused locals that were tripping lint.

Changes:

  • Reformat many test files to satisfy ruff format --check . (line wrapping, with (...) blocks, etc.).
  • Remove/avoid unused local variables in tests so ruff check . passes.
  • Minor test refactors to preserve behavior/coverage while meeting lint requirements.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_trace_config_branch_coverage.py Reformat monkeypatch calls for Ruff formatting compliance.
tests/test_template_versioning_branch_coverage.py Reformat helper construction; remove unused local.
tests/test_structured_extraction_branch_coverage.py Reformat schema construction and monkeypatch lambdas.
tests/test_stability_contract.py Reformat generator expression for style compliance.
tests/test_semantic_obs_coverage.py Import block reordering + extensive formatting changes; remove unused locals.
tests/test_runtime_results_coverage.py Reformat calls/collections; minor import reordering.
tests/test_runtime_reproducibility_branch_coverage.py Reformat monkeypatch call and long test signature.
tests/test_runtime_high_level_branch_coverage.py Reformat monkeypatch calls and list literals.
tests/test_runtime_config_loader_branch_coverage.py Reformat callsite to single line per formatter.
tests/test_routing_branch_coverage.py Replace lambda assignment with def for style/clarity.
tests/test_rate_limiting_branch_coverage.py Reformat multi-patch context managers using with (...).
tests/test_probes_models_coverage.py Reformat long strings/assertions; remove unused locals.
tests/test_orchestration_branch_coverage.py Reformat long any(...) assert across lines.
tests/test_models_config_coverage.py Insert blank lines / reorder imports to match formatter output.
tests/test_misc_coverage.py Reformat long constructor calls; minor import placement tweaks.
tests/test_latency_branch_coverage.py Reformat function signature and long callsite.
tests/test_langchain_integration_coverage.py Reformat list literals passed to assertions/calls.
tests/test_hitl_branch_coverage.py Reformat monkeypatch.setattr with multi-line args.
tests/test_experiment_tracking_coverage.py Reformat multi-patch context managers using with (...).
tests/test_evaluation_branch_coverage.py Reformat long object construction calls.
tests/test_deployment_coverage.py Reformat config constructions and client.post calls.
tests/test_cost_tracking_branch_coverage.py Reformat nested dict literals.
tests/test_context_window_branch_coverage.py Reformat helper signature and long method call.
tests/test_cli_validate_benchmark_branches.py Reformat multi-patch blocks and long write_text calls.
tests/test_cli_schema_coverage.py Remove unused captured locals; reformat JSON literals.
tests/test_cli_run_command_coverage.py Reformat write_text and multi-patch blocks; reflow list comprehension.
tests/test_cli_remaining_coverage.py Remove unused captured locals in capsys tests.
tests/test_cli_misc_command_branches.py Reformat long patch/call expressions and multi-patch blocks.
tests/test_cli_interactive_coverage.py Remove unused captured locals; reformat patch usage.
tests/test_cli_doctor_coverage.py Import reordering + remove unused locals (but dropped rc assertions in a few tests).
tests/test_cli_diff_harness_coverage.py Reformat list literals and long arg construction.
tests/test_cli_compare_coverage.py Reformat long cmd_compare calls.
tests/test_cli_benchmark_coverage.py Reformat nested patch blocks and long calls.
tests/test_caching_unified_branch_coverage.py Reformat long test signature.
tests/test_adapters_export_coverage.py Remove unused locals; reformat list construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 56 to 60
def test_text_format_with_fail_on_warn(self, capsys):
rc = cmd_doctor(_make_args(format="text", fail_on_warn=True))
cmd_doctor(_make_args(format="text", fail_on_warn=True))
captured = capsys.readouterr()
assert "insideLLMs Doctor" in captured.out

Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd_doctor(...) return value is no longer asserted here. This weakens the test and also loses a cheap sanity check that the command exits successfully (or with the expected nonzero code). Capture the return code (e.g., rc = ...) and assert it is in the expected set (typically 0 or 1 when fail_on_warn=True).

Copilot uses AI. Check for mistakes.
Comment on lines 61 to 64
def test_checks_structure(self, capsys):
rc = cmd_doctor(_make_args(format="json"))
cmd_doctor(_make_args(format="json"))
captured = capsys.readouterr()
data = json.loads(captured.out)
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test no longer checks the return code from cmd_doctor. Please capture the return value and assert it’s an int with an expected value (at least rc in (0, 1)), so the test still validates command success/failure behavior rather than only stdout structure.

Copilot uses AI. Check for mistakes.
Comment on lines 70 to 73
def test_all_check_categories(self, capsys):
rc = cmd_doctor(_make_args(format="json"))
cmd_doctor(_make_args(format="json"))
captured = capsys.readouterr()
data = json.loads(captured.out)
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: the return code from cmd_doctor is ignored. Capture and assert it (even a loose rc in (0, 1) is better than dropping it) to keep this test validating the CLI contract in addition to output content.

Copilot uses AI. Check for mistakes.
import argparse
import json
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'MagicMock' is not used.
Import of 'patch' is not used.

Suggested change
from unittest.mock import MagicMock, patch

Copilot uses AI. Check for mistakes.
@claude
Copy link

claude bot commented Feb 6, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

2 similar comments
@claude
Copy link

claude bot commented Feb 6, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@claude
Copy link

claude bot commented Feb 6, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@dr-gareth-roberts dr-gareth-roberts merged commit 51ae22e into main Feb 6, 2026
8 checks passed
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