Skip to content

Stabilize Coverity Scan triage and document known false positives - #164

Open
antonwolfy wants to merge 1 commit into
masterfrom
coverity-triage-policy
Open

Stabilize Coverity Scan triage and document known false positives#164
antonwolfy wants to merge 1 commit into
masterfrom
coverity-triage-policy

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Coverity Scan runs weekly against mkl_random. The overwhelming majority of findings are in the Cython-generated mklrand.cpp, not in code we maintain — boilerplate artifacts (DEADCODE / UNUSED_VALUE / CHECKED_RETURN) produced by Cython's single-source-for-many-build-configs templating.

We hit a concrete failure mode: a new Cython release regenerated mklrand.cpp, which churned the Coverity CIDs across the generated unit and silently dropped all prior triage on the boilerplate — the whole noise set reappeared under new CID numbers, alongside one new High-severity finding that turned out benign on inspection.

This PR makes triage durable and records the policy so the noise stays filtered while real signal keeps getting reviewed.

Changes

  • Pin Cython in the Coverity workflow only (cython==3.3.0 in .github/workflows/coverity.yml). A Cython version bump regenerates mklrand.cpp wholesale (renamed helpers, reshuffled lines), which churns CIDs and their triage; pinning keeps the generated code stable between scans. The pin takes effect because the build runs with --no-build-isolation. Production builds leave Cython unpinned in pyproject.toml, so shipped wheels and Python-version support are unaffected. Bumping the pin is a deliberate act that will require re-triaging the boilerplate.
  • Add coverity/README.md, a triage guide with three parts:
    • Policy — where findings come from (generated vs. hand-written), why triage resets, and a review checklist that keeps mkl_random/src/ and __pyx_pf_* bodies in scope rather than blanket-excluding the generated unit.
    • Known findings — the false-positive families with root causes (matched on checker + mechanism, since helper names change across Cython versions), plus the individually verified High-severity _seed_impl OUT_OF_BOUNDS finding (guarded 2-tuple unpack — false positive).
    • Evaluated and declined — why modeling files do not fit, and an opt-in cov-manage-emit hard-exclude left disabled by default.

Rationale

We deliberately do not hard-exclude the generated translation unit: that would also drop the __pyx_pf_* bodies and could hide a genuine .pyx-logic bug. The chosen approach cuts the recurring noise (CID stability via the pin + a documented triage policy) while preserving coverage of the hand-written C++, where a real defect is most likely to appear.

Changelog

Added a Changed entry under [dev].

@antonwolfy
antonwolfy force-pushed the coverity-triage-policy branch 4 times, most recently from da7f337 to 1ace711 Compare August 24, 2026 13:27
@antonwolfy antonwolfy self-assigned this Aug 24, 2026
@antonwolfy antonwolfy added this to the 1.6.0 release milestone Aug 24, 2026
Pin Cython in the Coverity Scan workflow (only) so the generated
mklrand.cpp is byte-stable between scans. Coverity derives CIDs from a
hash of the analyzed code, so an unpinned Cython bump regenerates the
file, resets every CID, and silently discards prior triage on the
Cython-boilerplate false positives. Production builds keep Cython
unpinned in pyproject.toml, so this does not affect shipped wheels or
Python support.

Add coverity/README.md recording the known false-positive families in
generated code (DEADCODE / UNUSED_VALUE / CHECKED_RETURN / OUT_OF_BOUNDS),
the verification of the High-severity _seed_impl OOB finding, the real
INTEGER_OVERFLOW fix (gh-156), and a review checklist that keeps
first-party src/*.cpp and __pyx_pf_* bodies in scope rather than
blanket-excluding the generated unit.
@antonwolfy
antonwolfy force-pushed the coverity-triage-policy branch from 1ace711 to e4a5188 Compare August 24, 2026 14:19
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.

1 participant