Skip to content

quality: remove pragma-based coverage suppression from owned Python tooling #493

Open

Description

@seonghobae

Finding

Fresh review of #488@2f699fa6818abd4a8b1a20f915a2596177ebb544 found that the newly added raw-string LCOV regression correctly removed its copied # pragma: no cover, but the repository-wide Python coverage policy still permits the same suppression pattern for owned tooling.

Exact-head .coveragerc@8f5ce471f2fca5639e7e8857e39d404698af521a has fail_under = 100, branch coverage enabled, and exclude_lines = pragma: no cover. The covered production source set includes scripts.check_workspace_contract, scripts.check_docstrings, scripts.check_coverage, scripts.prepare_agent_pr_message, scripts.release_evidence, and scripts.actions_workflow_fleet.

At least these covered production entrypoints retain # pragma: no cover on their if __name__ == "__main__" guards: scripts/check_docstrings.py, scripts/check_workspace_contract.py, scripts/release_evidence.py, and scripts/actions_workflow_fleet.py. prepare_agent_pr_message already has an in-process runpy.run_module(..., run_name="__main__") regression pattern that demonstrates the preferred direction: execute the real CLI boundary rather than remove it from the denominator.

This is quality/operability evidence, not a Validation Evidence arithmetic finding. It must not be repaired by lowering fail_under, excluding more files/lines, moving source outside [run].source, adding skip/xfail, or rewriting the source denominator.

Required RED → GREEN

  1. Add focused in-process CLI-entrypoint tests for every owned covered script whose __main__ guard is presently suppressed. Use deterministic local fixtures/mocks so tests do not require live network mutation or provider credentials.
  2. Remove the corresponding # pragma: no cover annotations only after the real entrypoint path is exercised.
  3. Remove the global exclude_lines = pragma: no cover policy once the covered production source set has no legitimate reliance on it; a regression must fail if an owned production source reintroduces pragma-based suppression.
  4. Preserve branch coverage, fail_under = 100, covered source membership, current LCOV authored-line semantics, and all scientific arithmetic/contracts.
  5. Prove exact-head Python line+branch 100% without exclusion-based denominator manipulation, then update TEST_STRATEGY/operability traceability if the coverage policy is documented there.

Boundary

Do not fold unrelated test-file unittest.main() convenience guards into production coverage just to increase denominator. The acceptance target is the owned production source set selected by .coveragerc; test files may be cleaned separately for consistency, but they are not a substitute for exercising production CLI boundaries.

Current #488 CI is runner-queued, so this issue records a separate verified repair frontier without churning that exact scientific head merely to retrigger Actions.

Activity

  1. seonghobae commented on Sep 15, 2026

    @seonghobae
    ContributorAuthor

    Status: the fix exists and is green on everything a branch controls

    Measured against origin/main today, this issue is still open in substance:

    [report]
    exclude_lines =
        pragma: no cover
    

    and five of the six modules under [run] source still carry a pragma:

    Module pragma: no cover occurrences on main
    scripts/check_workspace_contract.py 1
    scripts/check_docstrings.py 1
    scripts/check_coverage.py 1
    scripts/release_evidence.py 1
    scripts/actions_workflow_fleet.py 1
    scripts/prepare_agent_pr_message.py 0

    The repair is #497. It removes the exclude_lines stanza and the pragmas, and replaces the suppression with tests/quality/test_cli_entrypoints.py, which executes each covered module's __main__ boundary in-process through runpy.run_module(..., run_name="__main__") and asserts the exit status, so the boundary is measured rather than removed from the denominator.

    Its current check state is worth recording precisely, because it is not a code problem:

    Failing check Why it is not a branch matter
    CodeQL compatibility analysis (actions) GitHub-owned dynamic workflow path; this repository holds no CodeQL configuration. Failing on 38 open PRs.
    CodeQL compatibility analysis (python) Same.
    dependency-review Dependency Graph is disabled for this repository. Tracked in #498, needs an administrator. Failing on 29 open PRs.

    Nothing else fails. The Python gate, the coverage floor, and the contract checkers all pass.

    So this issue is gated on #497's base merging plus the two infrastructure conditions above, not on further implementation work.

    One related change since

    While repairing a separate coverage-gate hole I removed two exclusions from scripts/check_coverage.py that had the same character as the pragma suppression this issue is about: a match arm whose body is one string literal, and Ok(()) as a function's success return. Both were dropped from the authored-line denominator, so a zero count on either could never fail the contract. That work is in #525 and is independent of this issue, but it is the same failure mode, and worth knowing about when judging whether the suppression problem is fully retired.

  2. seonghobae commented on Sep 16, 2026

    @seonghobae
    ContributorAuthor

    Fresh current-head verification: coverage owner vehicle #538 is now Ready/main-target at exact 0a6947b11f2dba9e161f2abe8bdec0f652d4b47a. .coveragerc still has exclude_lines = pragma: no cover, and scripts/check_docstrings.py still carries if __name__ == "__main__": # pragma: no cover, so this issue remains valid and is not inherited by #538 yet. Do not open a competing coverage sibling while #538 exact-head gates are queued. Once that head reaches a practical terminal point, the next coverage-policy batch should use the surviving #538 lineage (or its verified successor): public/in-process CLI REDs first, then remove owned production pragmas and finally the global pragma exclusion with a regression forbidding reintroduction. No lowering fail_under, source-set shrink, skip/xfail, or denominator rewrite.

  3. seonghobae commented on Sep 16, 2026

    @seonghobae
    ContributorAuthor

    #497 is now repaired onto the surviving foundation lineage instead of the unrelated #492 base.

    Current implementation authority: #497@6f6ee499e80b0537c363baf8d94fd4c46c91ce9d, direct base #538@0a6947b11f2dba9e161f2abe8bdec0f652d4b47a, still Draft.

    Fresh compare against #538 is ahead/behind 10/0 and the effective product delta remains exactly nine paths: .coveragerc, .gitignore, one changelog fragment, five covered CLI scripts, and tests/quality/test_cli_entrypoints.py. The first reconciliation tree accidentally dropped three explanatory comments from scripts/check_coverage.py; ordinary-forward 6f6ee499... restores them. Current scripts/check_coverage.py differs from #538 only at the __main__ pragma marker plus terminal-newline normalization; the later LCOV classifier/reconciliation logic is preserved.

    Because #497 is Draft while #538 is unlanded, Rust Foundation and Documentation Quality on 6f6ee499... are intentionally skipped. Those skips are lifecycle evidence, not GREEN promotion evidence. Keep #493 open until #538 lands, #497 is restacked to the surviving protected-main authority if needed, and the unchanged exact head proves real CLI entrypoint execution, no pragma suppression/global exclusion, branch coverage + fail_under=100, all required terminal gates, and independent approval.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions