test(coverage): require 100% coverage for changed Python code - #1139
test(coverage): require 100% coverage for changed Python code#1139doublewhy wants to merge 8 commits into
Conversation
|
Thanks for the thorough work on this. After review, we’re going to decline this PR and submit a smaller replacement. The replacement will retain the useful measurement improvements—branch coverage, complete repository-owned Python scope, and canonical reports—while enforcing the repository’s 90% coverage policy through standard Coverage.py capabilities. We will omit the manual ratchet, 100% changed-code requirement, and custom semantic hardening. The hardening threat model is inconsistent with ADR-015, which treats repository-mutable policy as protection against accidental regressions rather than an adversarial security boundary. Because this checker and its invocation remain editable in the same PR, the implementation also cannot provide the claimed tamper resistance. The revised coverage policy and its relationship to ADR-014 will be documented before implementation. Thank you for the careful investigation and extensive testing; it helped clarify the narrower change we need. |
ac98e2f to
9ec37b5
Compare
Plain-language summary
Context. OpenRAE already runs a large unit and integration test suite, and CI publishes coverage to SonarCloud.
Problem. The old gate looked only at overall line coverage and allowed the repository to remain above a 50% average. A new or edited branch could therefore be untested while CI still passed. Changes could also evade measurement by narrowing Coverage.py configuration, moving reports, omitting repository tooling, or using exclusions that looked structural but still ran at runtime.
Fix. This PR measures both statements and branches across shipped Python and repository tooling. It requires every changed executable statement and every exit from a changed branch to run, validates the coverage configuration and report paths, and records an honest whole-repository baseline that may rise but cannot be lowered. Existing untested legacy code is tracked by the aggregate ratchet; this PR does not claim that the whole repository is already at 100% coverage.
Closes #1104.
What changed
tools/,noxfile.py, and the Hatch build hook.TYPE_CHECKINGandProtocolexclusions as structural only when their imports and namespaces cannot be rebound dynamically; eagerly evaluated annotations, defaults, decorators, and class bases remain coverage obligations.tools/coverage_ratchet.jsonat a canonical path and rejects lowering or deleting it after adoption. The recorded historical floors remain 89.739% statements and 75.638% branches.Verification
Rebased without conflict onto exact base
96b20ae8422fae9936bae928bbd8a1c14d2001da; candidate head9ec37b568ed83b962783f143e318db31a675fbaa.dev.31665503280, verify job94339074943: all deterministic lanes passed, including 7,058 unit tests, 59 integration tests, and the pinned Isabelle proof. The production combine printedCOVERAGE_POLICY_PASSagainst exact base96b20ae8422fae9936bae928bbd8a1c14d2001da./home/runner/work/rae/raesource and 833 repository-relative filenames, with no absolute or escaping filenames.94340403950parsed the canonical XML, passed the quality gate, and completed successfully.Scope and merge notes
This PR is independently based on current
dev. It does not include Python compatibility, runtime, libvirt, OCI, or release-admission changes except where those changes are already present in the base. The coverage floor was not weakened during the refresh.