Skip to content

test: cover schema inference and lib query modules #193

Closed

Description

@Sinity

Context

This issue originally captured a large coverage gap in polylogue/schemas/
and polylogue/lib/. That baseline is now stale: after the intervening
schema, query, proof, and coverage-gate work, a 2026-04-23 package-focused
coverage report shows the combined polylogue/schemas/* and
polylogue/lib/* surface at roughly 86% coverage, already above the
original package-level ≥60% target.

The remaining risk is no longer "near-zero package coverage". It is that
some high-leverage semantic helpers still lack focused behavioral tests or
have only incidental coverage:

  • polylogue/lib/coverage.py — archive coverage diagnostics, currently
    uncovered despite being readiness-facing.
  • polylogue/lib/search_hits.py — evidence-bearing search-hit helpers used
    by CLI/MCP/archive surfaces.
  • polylogue/lib/query_runtime_matching.py — action/path/tool/text matching
    semantics for immutable query plans.
  • polylogue/schemas/pinning.py — human-reviewed schema annotation pinning
    and rejection semantics.
  • Lower-covered schema outliers such as pinning.py, extraction.py, and
    operator_inference.py should be treated as behavior-contract targets,
    not line-count targets.

Strengthened execution scope

Make this issue a semantic coverage slice, not a raw line-coverage chase:

  • add focused tests around readiness diagnostics, search evidence, action-aware
    query matching, and schema pinning/rejection behavior;
  • prefer tests that assert cross-surface payload shape or semantic decisions
    over tests that simply import large modules;
  • use the new devtools coverage-gate from test: add single-source coverage gate #382 as the ratchet evidence;
  • raise the global coverage floor from 84% to 85% only after the behavioral
    tests justify it;
  • close this issue when the schema/lib query slice has durable tests and the
    85% floor passes, leaving the broader 90% journey to chore: restore test coverage floor toward 90% #197.

Approach

Prioritize by product risk and mutation-kill value:

  1. Archive coverage diagnostics: empty archives, provider ranges, date gaps,
    message totals, and truncated-session heuristic.
  2. Search-hit evidence: query-term normalization, deterministic snippets,
    retrieval-lane surfaces, and message-count-preserving hit updates.
  3. Query runtime matching: action/path/tool/text filters including none
    semantics and exclusion behavior.
  4. Schema pinning: invalid pins reject bad roles/actions, confirmed pins mark
    schema nodes, rejected pins suppress annotations and evidence across nested
    schema paths.
  5. Coverage ratchet: run devtools coverage-gate and raise
    tool.coverage.report.fail_under to 85 only if the gate passes.

Acceptance criteria

  • Focused tests cover the semantic contracts above in polylogue/lib/ and
    polylogue/schemas/.
  • devtools coverage-gate passes with the committed coverage floor at 85%.
  • devtools verify --quick passes.
  • This issue closes with the 85% ratchet; chore: restore test coverage floor toward 90% #197 remains open for the remaining
    87/89/90% increments.

Activity

  1. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Scratch log, 2026-04-23:

    • Starting after test: add single-source coverage gate #382 because the coverage gate is now single-sourced and usable as ratchet evidence.
    • Current package-focused report from the latest coverage data shows polylogue/schemas/* + polylogue/lib/* at roughly 86%, so the original near-zero/≥60 framing is outdated.
    • Decision: treat test: cover schema inference and lib query modules #193 as a semantic coverage slice for remaining high-risk helpers, not a file-per-module smoke-test campaign.
    • Candidate execution target: readiness diagnostics (lib/coverage.py), search evidence (lib/search_hits.py), query runtime matching (lib/query_runtime_matching.py), and schema annotation pinning (schemas/pinning.py), followed by a floor ratchet from 84% to 85% if devtools coverage-gate passes.
  2. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution log for the #193 ratchet slice.

    What landed on the branch:

    • focused semantic tests for polylogue.lib.coverage, polylogue.lib.search_hits, polylogue.lib.query_runtime_matching, and polylogue.schemas.pinning
    • repo coverage floor ratcheted from 84% to 85%
    • full coverage-gate stabilization for the two Hypothesis source-law cases that failed under coverage instrumentation (bundle_cardinality_contract deadline disabled, conversations_wrapper_round_trips_documents slow-generation health check suppressed)

    Verification on feature/test/schema-lib-query-coverage:

    • 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 on pre-push

    Opening PR next. This closes the stale package-coverage gap for #193 and advances #197 by proving the 85% floor is supportable under the default gate.

  3. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Merged via #383. The repo-wide coverage floor is now 85%, the default devtools coverage-gate passes at 86.02% total coverage, and the issue is closed with direct semantic tests over the remaining lib/schemas weak spots. #197 remains the broader ratchet track toward 90%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions