Skip to content

test: cover schema and query semantic helpers - #383

Merged
Sinity merged 2 commits into
masterfrom
feature/test/schema-lib-query-coverage
Apr 23, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/test/schema-lib-query-coverage

Conversation

@Sinity

@Sinity Sinity commented Apr 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Close the stale #193 package-coverage gap by adding direct semantic tests for the remaining weak helpers in polylogue/lib and polylogue/schemas, then ratchet the repository-wide coverage floor from 84% to 85% with a default coverage gate that still passes under full instrumentation.

Problem

Issue #193 started as a broad package-coverage ticket, but the package-level baseline had already moved. The real remaining gap was narrower: several semantic helpers in polylogue.lib.coverage, polylogue.lib.search_hits, polylogue.lib.query_runtime_matching, and polylogue.schemas.pinning were still lightly exercised, and the repo-level coverage ratchet needed proof that the full default gate could sustain a higher floor without flaking on Hypothesis-generated source laws.

Closes #193
Ref #197

Solution

  • add focused tests for coverage diagnostics, search-hit construction, query runtime action/path/tool matching, and schema pin confirmation/rejection behavior
  • ratchet [tool.coverage.report].fail_under from 84 to 85 in pyproject.toml
  • stabilize the two source-law tests that failed only under coverage instrumentation by disabling the deadline for generated provider bundle cardinality checks and suppressing slow-generation health checks for the conversations-wrapper stream law
  • keep the history explicit with one commit for semantic coverage additions and one commit for the ratchet/stability slice

Verification

  • pytest -q tests/unit/lib/test_coverage_diagnostics.py tests/unit/lib/test_search_hits.py tests/unit/lib/test_query_runtime_matching.py tests/unit/core/test_schema_pinning.py
    • 13 passed
  • pytest -q tests/unit/sources/test_source_laws.py::test_iter_json_stream_conversations_wrapper_round_trips_documents tests/unit/sources/test_source_laws.py::test_parse_payload_bundle_cardinality_contract
    • 5 passed
  • devtools coverage-gate --ignore-integration
    • 5188 passed, total coverage 85.21%
  • devtools coverage-gate
    • 5368 passed, total coverage 86.02%
  • devtools verify --quick
    • passed locally and again in the pre-push hook

Summary by CodeRabbit

  • Tests

    • Added comprehensive test suites validating schema pinning, coverage diagnostics, query runtime matching, and search functionality.
    • Updated test configurations to improve stability and performance across multiple test modules.
  • Chores

    • Increased code coverage enforcement threshold to improve quality standards.

Sinity added 2 commits April 23, 2026 10:38
Problem: #193 had become stale as a package-level coverage ticket. The
remaining weak spots were specific semantic helpers in lib and schema
pinning, and they were not exercised directly.

What changed:
- add focused coverage diagnostics tests for provider ranges, gaps, and
  truncation accounting
- add search hit tests for query term normalization, snippet anchoring,
  and lane-to-surface mapping
- add query runtime matching tests for path, action, tool, sequence,
  and action-text matching
- add schema pinning tests for invalid decisions, pin-set round trips,
  resolved paths, and confirmed/rejected annotation application

Ref #193
Problem: #193 raised the repository-wide coverage floor, but the default
coverage gate still had two Hypothesis-based source laws that could fail
from generation speed or deadline pressure under full instrumentation.

What changed:
- raise the coverage fail-under threshold from 84 to 85
- disable the deadline on bundle-cardinality source laws where generated
  provider payloads are intentionally large under coverage tracing
- suppress slow-generation health checks for conversations-wrapper
  streaming laws to match the sibling stream contracts

Ref #193
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: 5357f751-63d2-42a9-b0f0-0605c28e8e80

📥 Commits

Reviewing files that changed from the base of the PR and between 427c487 and 3b3c93c.

📒 Files selected for processing (6)
  • pyproject.toml
  • tests/unit/core/test_schema_pinning.py
  • tests/unit/lib/test_coverage_diagnostics.py
  • tests/unit/lib/test_query_runtime_matching.py
  • tests/unit/lib/test_search_hits.py
  • tests/unit/sources/test_source_laws.py

📝 Walkthrough

Walkthrough

This PR adds focused unit tests for semantic contracts in schema pinning, coverage diagnostics, query runtime matching, and search-hit utilities, alongside a coverage enforcement threshold increase from 84 to 85 and minor Hypothesis configuration adjustments.

Changes

Cohort / File(s) Summary
Configuration & Coverage Ratchet
pyproject.toml
Incremented [tool.coverage.report] fail_under threshold from 84 to 85.
Schema Pinning Tests
tests/unit/core/test_schema_pinning.py
New test suite validating PinDecision rejection of invalid combinations, PinSet serialization/deserialization and decision queries, resolve_pinned_paths() role-to-path mapping, and apply_pins_to_schema() schema annotation/rejection behavior.
Library Coverage & Search Tests
tests/unit/lib/test_coverage_diagnostics.py, tests/unit/lib/test_search_hits.py
New test suites for archive coverage diagnostics (empty archives, provider ranges, date gaps, truncated sessions) and search-hit utilities (term normalization, snippet generation, retrieval-lane surfaces, conversation hit construction).
Query Runtime Matching Tests
tests/unit/lib/test_query_runtime_matching.py
New test suite validating path/action/tool/text term matching semantics, explicit "none" handling, exclusion behavior, and ordered action sequence matching.
Hypothesis Configuration Adjustments
tests/unit/sources/test_source_laws.py
Set deadline=None for cardinality contract test and added HealthCheck.too_slow suppression for JSON stream round-trip test.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • test: cover schema inference and lib query modules #193: This PR directly implements the acceptance criteria from the semantic coverage slice issue by adding focused tests for coverage diagnostics, search hits, query runtime matching, and schema pinning, and raising the coverage floor from 84 to 85.

Possibly related PRs

Suggested labels

type:test, area:qa, area:schema

Poem

🐰 With whiskers twitched and paws on keys,
I've added tests to put minds at ease—
From pinning schemas to coverage's call,
Four hundred lines now cover it all!
To eighty-five we hop and climb, 🎯
One test at a time, one test at a time!

✨ 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/schema-lib-query-coverage

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 bbfcea8 into master Apr 23, 2026
11 of 12 checks passed
@Sinity
Sinity deleted the feature/test/schema-lib-query-coverage branch April 23, 2026 08:40
@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. More of your lovely PRs please.

ℹ️ 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sinity added a commit that referenced this pull request May 7, 2026
## Summary
Close the stale #193 package-coverage gap by adding direct semantic tests for the remaining weak helpers in `polylogue/lib` and `polylogue/schemas`, then ratchet the repository-wide coverage floor from 84% to 85% with a default coverage gate that still passes under full instrumentation.

## Problem
Issue #193 started as a broad package-coverage ticket, but the package-level baseline had already moved. The real remaining gap was narrower: several semantic helpers in `polylogue.lib.coverage`, `polylogue.lib.search_hits`, `polylogue.lib.query_runtime_matching`, and `polylogue.schemas.pinning` were still lightly exercised, and the repo-level coverage ratchet needed proof that the full default gate could sustain a higher floor without flaking on Hypothesis-generated source laws.

Closes #193
Ref #197

## Solution
- add focused tests for coverage diagnostics, search-hit construction, query runtime action/path/tool matching, and schema pin confirmation/rejection behavior
- ratchet `[tool.coverage.report].fail_under` from 84 to 85 in `pyproject.toml`
- stabilize the two source-law tests that failed only under coverage instrumentation by disabling the deadline for generated provider bundle cardinality checks and suppressing slow-generation health checks for the conversations-wrapper stream law
- keep the history explicit with one commit for semantic coverage additions and one commit for the ratchet/stability slice

## Verification
- `pytest -q tests/unit/lib/test_coverage_diagnostics.py tests/unit/lib/test_search_hits.py tests/unit/lib/test_query_runtime_matching.py tests/unit/core/test_schema_pinning.py`
  - `13 passed`
- `pytest -q tests/unit/sources/test_source_laws.py::test_iter_json_stream_conversations_wrapper_round_trips_documents tests/unit/sources/test_source_laws.py::test_parse_payload_bundle_cardinality_contract`
  - `5 passed`
- `devtools coverage-gate --ignore-integration`
  - `5188 passed`, total coverage `85.21%`
- `devtools coverage-gate`
  - `5368 passed`, total coverage `86.02%`
- `devtools verify --quick`
  - passed locally and again in the pre-push hook
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.

test: cover schema inference and lib query modules

2 participants