Skip to content

chore: restore test coverage floor toward 90% #197

Closed

Description

@Sinity

Context

The coverage floor was dropped from 90% to 80% in #174 to unblock
other work. It then climbed back in measured, justified steps:

Current verified state after #387

  • devtools coverage-gate is the single coverage entrypoint for humans
    and CI.
  • The gate reads fail_under from pyproject.toml; there is no stale CI
    override anymore.
  • The full default gate passes under instrumentation at 89.46% total
    coverage.
  • The committed floor is now 89%.
  • The gate remains stable enough to run the full suite locally without
    the earlier Hypothesis false-failure path.

Strengthened execution scope

This remains a semantic-coverage ratchet, not a generic percentage
chase. Every raise must make an operational package area materially more
trustworthy.

The remaining climb should not be framed as "get to 90 and stop." 90%
is only the next checkpoint. The real target is the highest honest
floor
justified by a coherent tranche of direct owning-module tests. If
a strong package slice supports 91% or more, ratchet there. Do not
artificially stop at 90 just because the old number was round.

The next tranche should therefore aim to clear well past 90 with
headroom, ideally nearer 91% than 90.0, by closing the remaining
active-path debt in the run/proof/operator surface instead of scattering
small bookkeeping tests.

Next tranche: remaining run/proof/operator execution surface

The final large package should retire the remaining low direct coverage
in the active execution and verification path, especially:

  • run and preparation orchestration
  • proof rendering and proof diffing/reporting
  • remaining command/operator surfaces that still carry branch-heavy
    control logic
  • smaller runtime/root helpers that still distort the floor despite being
    part of ordinary usage

Primary targets therefore include, but are not limited to:

  • polylogue/pipeline/run_stages.py
  • polylogue/pipeline/prepare.py
  • polylogue/pipeline/run_state.py
  • polylogue/proof/rendering.py
  • polylogue/proof/diffing.py
  • polylogue/cli/check_rendering_plain.py
  • polylogue/cli/commands/run.py
  • polylogue/cli/commands/products.py
  • polylogue/cli/machine_main.py

This tranche should not be called done unless those helpers are covered
directly at the owning-module level rather than only incidentally
through broader command tests.

Package map for the remaining climb

The major remaining debt is now concentrated in:

  • run/pipeline orchestration paths
  • proof rendering and diff/report semantics
  • branch-heavy operator and command helpers
  • a shrinking runtime/root support tail that still matters to users or
    agents after the entrypoint, logging, wrapper, and showcase work

Execution rule

Prefer coherent ratchet boundaries over ceremonial one-point raises. If
a strong tranche clears 90, 91, or higher cleanly with margin, raise to
the highest honest floor supported by the measured full suite. Do not
create an artificially capped PR just because an old milestone was 90%.

Plan

Incremental raises tied to specific package slices:

Target Trigger Status
84% Coverage gate is single-sourced and stable under instrumentation done
85% First schema/lib semantic coverage tranche justifies the ratchet done
86% Schema/lib tranche + gate hardening support the measured raise done
87% CLI operator/rendering/workflow blind spots are retired enough for the full gate to clear comfortably done
88% Remaining CLI/query helpers plus root entrypoint/logging seams justify the next measured raise even though 89 is not yet honest done
89% The broader active operator surface clears with measurable headroom after direct tests over showcase, sync, wrappers, and operator helpers done
90%+ The remaining run/proof/operator surface is covered directly enough to justify the highest honest floor the measured suite supports next

Each raise should land as one or more focused PRs that tell a coherent
package story. If a slice improves the groundwork but does not yet reach
90+, it references this issue instead of closing it.

Acceptance criteria

  • Coverage enforcement is single-sourced from committed configuration and
    used by CI.
  • The local coverage gate remains discoverable through devtools.
  • The current coverage gate remains stable enough to run under full
    instrumentation without false-failure health checks.
  • The floor is raised above 89% only when the measured suite supports it.
  • The next tranche is backed by direct tests over the remaining active
    run, proof, and operator helpers, not only broader command tests.
  • The ratchet moves to the highest honest floor supported by the full
    measured suite, not just the next round number.
  • The issue remains open until the floor is restored to a level that is
    honestly supported by comprehensive active-path coverage without
    excluding modules from measurement and without leaving active
    control-plane helpers effectively untested.

Activity

  1. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Scratch log, 2026-04-23:

    • Starting with deployment-readiness because the requested sequence puts confidence gates before command and architecture cleanup.
    • Fresh measurement command: pytest --cov=polylogue --cov-report=term-missing:skip-covered --cov-fail-under=83 -q --ignore=tests/integration.
    • Result: coverage total was 84.79%, so the current 83% floor is justified and an 84% ratchet is viable.
    • The run still exited non-zero because five parser property tests tripped Hypothesis HealthCheck.too_slow only under coverage instrumentation. That is a gate reliability issue, not a product regression.
    • CI still passes --cov-fail-under=80 even though pyproject.toml says 83, so the first execution slice should make the coverage gate single-sourced and then ratchet to the measured safe floor.
  2. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution log for PR #382:

    • Branch: feature/test/coverage-ratchet-gate.
    • Commits:
      • test: stabilize coverage-gated source tests
      • test: add single-source coverage gate
    • PR: test: add single-source coverage gate #382
    • Decision: this PR uses Ref #197, not Closes #197, because it installs the trustworthy coverage-ratchet path and raises the floor to 84%; chore: restore test coverage floor toward 90% #197 should remain open until the floor reaches 90%.
    • Verification:
      • pytest -q tests/unit/devtools/test_coverage_gate.py tests/unit/devtools/test_command_catalog.py tests/unit/devtools/test_devtools_main.py tests/unit/sources/test_parsers_props.py -> 51 passed.
      • pytest -q tests/unit/sources/test_source_laws.py::test_detect_provider_recognizes_generated_payloads tests/integration/test_mcp.py::TestMCPRealRepositoryPaths::test_search_uses_real_repository_and_filter_stack -> 2 passed.
      • devtools coverage-gate --ignore-integration -> 5175 passed, required coverage 84% reached, total coverage 84.83%.
      • devtools coverage-gate -> 5355 passed, required coverage 84% reached, total coverage 85.60%.
      • devtools verify --quick -> all checks passed.
      • push pre-hook devtools verify --quick -> all checks passed.
  3. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    PR #382 merged as 427c487. The coverage floor is now 84%, CI uses the shared devtools coverage gate, and #197 remains open for the remaining 90% ratchet work.

  4. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Starting the next #197 tranche on feature/test/coverage-ratchet-87.

    Execution target for this slice:

    • push the floor from 85% toward the planned 87% step if the measured suite supports it
    • cover schema extraction/operator fallback and promote/list behavior directly in the owning unit suites
    • add focused semantic tests for under-covered pure lib helpers around query-runtime filtering, search-hit execution, payload coercion, projection mixins, message collections, session summaries, and archive stats

    I’m treating this as a package-sized semantic coverage pass, not a cosmetic ratchet. I’ll log the measured gate result before deciding the exact new fail_under value.

  5. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Executed the next #197 tranche on feature/test/coverage-ratchet-87 and opened PR #384:
    #384

    What landed in this slice:

    • substantial semantic coverage over query runtime filtering/retrieval helpers, payload coercion, schema extraction/operator flows, runtime registry helpers, archive stats, session summaries, authored payload helpers, and projection/message collection contracts
    • coverage-lane hardening for the slow semantic/property suites so the full gate is stable enough to ratchet rather than oscillate
    • open --print-path integration assertions now tolerate the expected optional progress stderr instead of treating it as a failure
    • a small devtools.render_cli_reference export fix surfaced by devtools verify --quick

    Measured result:

    • devtools coverage-gate
      • 5411 passed in 257.11s (0:04:17)
      • Required test coverage of 86% reached. Total coverage: 86.77%
    • devtools verify --quick passed

    Decision note:

    • I raised the floor from 85 to 86 in this PR.
    • I am deliberately not closing chore: restore test coverage floor toward 90% #197 yet, because 87 is still not honest on the current evidence. This branch gets us to a justified 86 with better semantic coverage and a cleaner gate for the next ratchet slice.
  6. added a commit that references this issue on Apr 23, 2026
  7. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Merged via PR #384 as bef537b5 on master.

    The issue stays open for the next justified ratchet beyond 86.

  8. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Starting the next #197 tranche on feature/test/coverage-ratchet-87-cli-site.

    Execution tactic for this slice:

    • target the CLI operator/rendering/workflow helpers directly rather than padding already-healthy packages
    • retire the worst remaining 0%/near-0% control-plane modules first
    • only raise the floor if the measured full gate supports it cleanly

    Initial target set:

    • polylogue/cli/products_rendering.py
    • polylogue/cli/products_workflow.py
    • polylogue/cli/run_display_workflow.py
    • polylogue/cli/run_watch_workflow.py
    • polylogue/cli/schema_command_support.py
    • polylogue/cli/schema_rendering_explain.py
    • polylogue/cli/schema_rendering_results.py
    • polylogue/cli/query_verbs.py
  9. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Executed the strengthened 87% CLI-operator tranche on feature/test/coverage-ratchet-87-cli-site and opened PR #385:
    #385

    What this slice did:

    • added direct unit coverage for the CLI control-plane helper modules that were still sitting at 0% or near-0% coverage
    • covered both human and machine-output branches instead of relying on incidental higher-level command coverage
    • raised the floor from 86 to 87 only after the full gate cleared at the higher threshold

    Targeted module movement from the full gate:

    • polylogue/cli/products_rendering.py: 100%
    • polylogue/cli/products_workflow.py: 100%
    • polylogue/cli/query_verbs.py: 100%
    • polylogue/cli/run_watch_workflow.py: 100%
    • polylogue/cli/run_display_workflow.py: 92%
    • polylogue/cli/schema_command_support.py: 96%
    • polylogue/cli/schema_rendering_explain.py: 92%
    • polylogue/cli/schema_rendering_results.py: 87%

    Measured result:

    • devtools coverage-gate
      • 5434 passed in 262.51s (0:04:22)
      • Required test coverage of 87% reached. Total coverage: 87.33%
    • devtools verify --quick passed

    Decision note:

    • This issue remains open. 87 is now justified and enforced.
    • The next tranche should target the remaining CLI/query/support and root-module gaps on the path to 89 and 90.
  10. added a commit that references this issue on Apr 23, 2026
  11. 6 remaining items

  12. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Starting the post-88 tranche now. I expanded the issue scope first: the next raise is no longer just leftover CLI query cleanup, it is a broader active-operator-surface pass over showcase QA workflow/catalog/invariants, sync/read wrappers, and the remaining meaningful query/helper seams. Target is a measured total closer to 89.5% than to 89.0% before ratcheting the floor to 89.

  13. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution update on feature/test/coverage-ratchet-89p5 / 18aa9768:

    • broadened the tranche beyond leftover CLI helpers into showcase QA workflow/catalog/invariants/reporting, sync/read-model wrappers, product registry/runtime seams, MCP/operator helpers, plain-console rendering, Drive source client wiring, and version/git metadata error paths
    • devtools coverage-gate now measures 89.46% total coverage (5583 passed)
    • devtools verify --quick passes after the new tests and type/lint cleanup
    • raised fail_under from 88 to 89

    Next step is PR + merge; #197 stays open because this justifies 89 cleanly, not 90.

  14. added a commit that references this issue on Apr 23, 2026
  15. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Merged in #387 as 2badf030 (test: ratchet coverage floor to 89 (#387)).

    Measured result for this tranche:

    • devtools coverage-gate -> 5583 passed in 311.67s, total coverage 89.46%
    • devtools verify --quick -> passed

    This lands the strengthened 89% tranche with real headroom instead of an edge-skim. #197 stays open for the final 90% raise.

  16. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution update for the final ratchet tranche:

    • strengthened the issue scope toward the highest honest floor, then executed the remaining run/proof/operator package directly
    • added owning-module runtime coverage for:
      • cli.machine_main
      • cli.check_rendering_plain
      • cli.commands.products
      • cli.commands.run
      • proof.diffing
      • proof.rendering
      • pipeline.prepare
      • pipeline.observers
      • pipeline.run_stages
      • pipeline.run_state
    • stabilized two suite-load Hypothesis flakes in test_fts5.py and test_unified_semantic_laws.py with the repo’s existing HealthCheck.too_slow policy
    • measured the full gate at 90.14% and ratcheted fail_under to 90

    PR: #389

    Verification actually run:

    • pytest -q tests/unit/cli/test_check_rendering_plain_runtime.py tests/unit/cli/test_machine_main_runtime.py tests/unit/cli/test_products_command_runtime.py tests/unit/cli/test_run_command_runtime.py tests/unit/pipeline/test_prepare_runtime.py tests/unit/pipeline/test_run_stages_runtime.py tests/unit/pipeline/test_run_state_runtime.py tests/unit/pipeline/test_observers_runtime.py tests/unit/proof/test_diffing_runtime.py tests/unit/proof/test_rendering_runtime.py -> 60 passed in 12.42s
    • pytest -q tests/unit/storage/test_fts5.py::test_escape_fts5_match_text_safe tests/unit/sources/test_unified_semantic_laws.py::test_typed_content_blocks_extract_without_crash -> 2 passed in 10.27s
    • devtools coverage-gate -> 5643 passed in 289.45s, Total coverage: 90.14%
    • devtools verify --quick -> passed
  17. added a commit that references this issue on Apr 23, 2026
  18. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Merged via PR #389.

    • merge commit: 3101c308b5eb94f687917c714fe48565f8251eb0
    • squash subject on master: test: ratchet coverage floor to 90 (#389)
    • final measured gate used for the ratchet: devtools coverage-gate -> 5643 passed in 289.45s, Total coverage: 90.14%
    • quick repo baseline: devtools verify --quick -> passed

    This closes the 89 -> 90 restoration track. The floor is now back at 90 with direct active-path coverage over the remaining run/proof/operator helpers, but not enough measured headroom to justify 91 yet.

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

    area:qatype:choretype:test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions