Skip to content

test: ratchet coverage floor to 86 - #384

Merged
Sinity merged 3 commits into
masterfrom
feature/test/coverage-ratchet-87
Apr 23, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/test/coverage-ratchet-87

Conversation

@Sinity

@Sinity Sinity commented Apr 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Raise the coverage floor from 85 to 86 with a semantic coverage tranche over query/runtime/schema helpers, plus the gate hardening needed to make that ratchet reliable.

Problem

Ref #197 tracks the staged push toward a materially higher repository coverage floor. The next step could not be an arbitrary percentage bump: it needed meaningful tests over under-covered semantic helpers and a stable full coverage lane. The branch also surfaced a strict-mypy export defect in devtools.render_cli_reference while running the required quick baseline.

Solution

  • add focused unit coverage for payload coercion, query runtime filtering and retrieval helpers, schema extraction and operator workflows, runtime registry helpers, archive stats, session summaries, authored payload helpers, and projection/message collection contracts
  • harden the slow semantic/property suites for coverage execution and relax the open --print-path integration assertions to accept the expected optional progress stderr
  • raise [tool.coverage.report].fail_under from 85 to 86 after the full gate measured 86.77%
  • make devtools.render_cli_reference explicitly export its tested helper surface so devtools verify --quick stays green

Verification

  • mypy --strict tests/unit/core/test_session_summaries.py tests/unit/core/test_operator_inference.py tests/unit/lib/test_query_search_runtime.py tests/unit/lib/test_query_runtime_filters.py tests/unit/core/test_conversation_semantics.py tests/unit/core/test_models.py
  • pytest -q tests/unit/core/test_conversation_semantics.py::TestConversationProjectionContracts::test_projection_transform_and_terminal_helpers_cover_empty_and_render_paths
  • pytest -q tests/unit/core/test_session_summaries.py::test_summarize_day_aggregates_cost_duration_words_and_repos
  • devtools coverage-gate
    • 5411 passed in 257.11s (0:04:17)
    • Required test coverage of 86% reached. Total coverage: 86.77%
  • devtools verify --quick

Ref #197

Summary by CodeRabbit

  • Tests

    • Added comprehensive unit test coverage for archive statistics, conversation filtering, message collections, schema operations, payload coercion, and query runtime functionality
    • Enhanced integration tests for query routing with improved error validation
  • Chores

    • Increased minimum code coverage requirement from 85% to 86%

Sinity added 3 commits April 23, 2026 11:58
Problem
The next #197 coverage ratchet needed real semantic coverage over the
query/runtime helpers and schema operator paths rather than broad but
shallow line inflation.

What changed
Add focused unit tests for payload coercion, query runtime filtering,
search retrieval helpers, schema extraction and operator workflows,
runtime registry helpers, archive stats, session summaries, authored
payload helpers, and projection/message collection contracts.

Compatibility
No production behavior changes. This is test-only coverage expansion.

Ref #197
Problem
#197 needed the next coverage floor increase, but the full gate still
had noisy failure modes in property and integration checks that made the
ratchet unreliable.

What changed
Suppress Hypothesis too-slow health checks on the slow semantic law
suites, relax the open --print-path integration assertions to allow the
expected progress stderr, and raise coverage fail_under from 85 to 86.

Verification
This commit is justified by a full coverage-gate pass at 86.77% after
these hardening changes.

Ref #197
Problem
The quick verification baseline failed in strict mypy because tests/unit/devtools/test_render_cli_reference.py imports write_if_changed through devtools.render_cli_reference, but that module did not declare the symbol in its explicit export surface.

What changed
Add an __all__ declaration for the CLI reference renderer module so its tested helpers are part of the public module contract.

Compatibility
No behavior change; this only makes the existing module surface explicit.

Ref #197
@coderabbitai

coderabbitai Bot commented Apr 23, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e3a40465-f45c-44f7-b3b2-ccdbb65bb246

📥 Commits

Reviewing files that changed from the base of the PR and between bbfcea8 and 480b6fc.

📒 Files selected for processing (17)
  • devtools/render_cli_reference.py
  • pyproject.toml
  • tests/integration/test_cli_query_mode.py
  • tests/unit/core/test_archive_stats.py
  • tests/unit/core/test_conversation_semantics.py
  • tests/unit/core/test_message_laws.py
  • tests/unit/core/test_models.py
  • tests/unit/core/test_operator_inference.py
  • tests/unit/core/test_runtime_registry_helpers.py
  • tests/unit/core/test_schema_extraction_runtime.py
  • tests/unit/core/test_session_summaries.py
  • tests/unit/lib/test_payload_coercion.py
  • tests/unit/lib/test_query_runtime_filters.py
  • tests/unit/lib/test_query_search_runtime.py
  • tests/unit/scenarios/test_authored_payloads.py
  • tests/unit/sources/test_source_laws.py
  • tests/unit/sources/test_unified_semantic_laws.py

📝 Walkthrough

Walkthrough

This pull request adds extensive unit test coverage across multiple modules (core, lib, scenarios, sources) to validate existing functionality, increments the coverage threshold from 85 to 86 in pyproject.toml, updates Hypothesis health check configurations in property-based tests, and adds an __all__ declaration to the CLI reference module.

Changes

Cohort / File(s) Summary
Core Infrastructure Updates
devtools/render_cli_reference.py, pyproject.toml
Added explicit __all__ declaration to render_cli_reference module; increased coverage fail_under threshold from 85 to 86.
Core Module Test Suite
tests/unit/core/test_archive_stats.py, test_conversation_semantics.py, test_models.py, test_session_summaries.py, test_schema_extraction_runtime.py
Added new test files validating ArchiveStats computed properties, conversation projection/filtering helpers, MessageCollection sequence/hash semantics, session summary aggregation functions, and schema-based message extraction logic.
Core Module - Operator & Registry Tests
tests/unit/core/test_operator_inference.py, test_runtime_registry_helpers.py
Extended operator inference schema behavior coverage including privacy coercion and provider configuration handling; introduced comprehensive test suite for schema registry operations, payload resolution precedence, and JSON parsing utilities.
Core Module - Property-Based Tests
tests/unit/core/test_message_laws.py
Updated Hypothesis configuration to suppress HealthCheck.too_slow health check across all property-based tests; test assertions remain unchanged.
Library Module Tests
tests/unit/lib/test_payload_coercion.py, test_query_runtime_filters.py, test_query_search_runtime.py
Added test suites for payload coercion helpers, conversation query filtering logic (including SQL push-down behavior), and query-search runtime functions (text normalization, scoring, hybrid retrieval, batch fetching).
Scenarios & Sources Tests
tests/unit/scenarios/test_authored_payloads.py, tests/unit/sources/test_source_laws.py, test_unified_semantic_laws.py
Added tests validating authored payload helper contracts and numeric/mapping coercion; updated Hypothesis configuration in property-based tests to suppress HealthCheck.too_slow.
Integration Test Updates
tests/integration/test_cli_query_mode.py
Introduced stderr validation helper for query routing tests, permitting specific progress lines while rejecting other stderr output.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Suggested labels

type:test, area:qa, area:cli, tool:claude

Poem

🐰 With whiskers twitching and paws poised tight,
We test all corners, from dawn to night—
Coverage climbs from eighty-five to six,
Each test a flower in our logic mix! 🌸
The schemas dance, the queries sing,
New validations make our spirits ring!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/coverage-ratchet-87

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.

@Sinity
Sinity merged commit bef537b into master Apr 23, 2026
11 of 12 checks passed
@Sinity
Sinity deleted the feature/test/coverage-ratchet-87 branch April 23, 2026 10:02
@Sinity

Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Sinity
Sinity requested a review from Copilot May 1, 2026 01:54
@Sinity
Sinity removed the request for review from Copilot May 1, 2026 02:15
Sinity added a commit that referenced this pull request May 7, 2026
## Summary
Raise the coverage floor from 85 to 86 with a semantic coverage tranche
over query/runtime/schema helpers, plus the gate hardening needed to
make that ratchet reliable.

## Problem
Ref #197 tracks the staged push toward a materially higher repository
coverage floor. The next step could not be an arbitrary percentage bump:
it needed meaningful tests over under-covered semantic helpers and a
stable full coverage lane. The branch also surfaced a strict-mypy export
defect in `devtools.render_cli_reference` while running the required
quick baseline.

## Solution
- add focused unit coverage for payload coercion, query runtime
filtering and retrieval helpers, schema extraction and operator
workflows, runtime registry helpers, archive stats, session summaries,
authored payload helpers, and projection/message collection contracts
- harden the slow semantic/property suites for coverage execution and
relax the `open --print-path` integration assertions to accept the
expected optional progress stderr
- raise `[tool.coverage.report].fail_under` from 85 to 86 after the full
gate measured 86.77%
- make `devtools.render_cli_reference` explicitly export its tested
helper surface so `devtools verify --quick` stays green

## Verification
- `mypy --strict tests/unit/core/test_session_summaries.py
tests/unit/core/test_operator_inference.py
tests/unit/lib/test_query_search_runtime.py
tests/unit/lib/test_query_runtime_filters.py
tests/unit/core/test_conversation_semantics.py
tests/unit/core/test_models.py`
- `pytest -q
tests/unit/core/test_conversation_semantics.py::TestConversationProjectionContracts::test_projection_transform_and_terminal_helpers_cover_empty_and_render_paths`
- `pytest -q
tests/unit/core/test_session_summaries.py::test_summarize_day_aggregates_cost_duration_words_and_repos`
- `devtools coverage-gate`
  - `5411 passed in 257.11s (0:04:17)`
  - `Required test coverage of 86% reached. Total coverage: 86.77%`
- `devtools verify --quick`

Ref #197
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