Skip to content

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

Merged
antonwolfy merged 2 commits into
masterfrom
backport/coverity-triage-docs
Sep 3, 2026
Merged

Stabilize Coverity Scan triage and document known false positives#374
antonwolfy merged 2 commits into
masterfrom
backport/coverity-triage-docs

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Backport of IntelPython/mkl_umath#266, adapted to mkl_fft. Stabilizes Coverity Scan triage and documents the verified false positives.

Two changes:

1. Pin Cython in the Coverity workflow
cython==3.3.0 in .github/workflows/coverity.yml only (not pyproject.toml, so shipped wheels are unaffected). A Cython version bump regenerates _pydfti.c wholesale, which churns Coverity CIDs and silently drops their triage; pinning keeps the generated code byte-stable between scans. Works because the scan build runs with --no-build-isolation.

2. Add coverity/README.md
A triage guide covering:

  • Where findings come from across mkl_fft's two captured translation units — template-generated mklfft.c (our oneMKL DFTI logic, kept in scope) and Cython-generated _pydfti.c.
  • The Cython-pin rationale and an opt-in Project Component to group (not ignore) the Cython unit.
  • A review checklist keeping mklfft.c, the mkl_fft/src/*.h helpers, and the __pyx_pf_* bodies in scope.
  • The verified false-positive families, matched on checker + mechanism (not CID, since CIDs reset on a Cython bump).

Documented false-positive families

All triaged Intentional / Ignore / Minor.

Cython-generated boilerplate (_pydfti.c):

  • DEADCODEtp_traverse base-traversal preamble (__Pyx_Coroutine_traverse, __Pyx_CyFunction_traverse, _genexpr and _get_element_strides scope traversals) — one mechanism.
  • DEADCODE — version/ABI-guarded helpers (__Pyx_VectorcallBuilder_AddArg, __Pyx_PyCode_New, __Pyx_ParseKeywordDict).
  • UNUSED_VALUE — Cython reference-cleanup epilogue in _c2r_fft1d_impl.
  • CHECKED_RETURN__Pyx_Generator_Replace_StopIteration.

Our .pyx, dead-by-construction (__pyx_pf_*):

  • DEADCODE — redundant is NULL guards in _process_arguments / _direct_fftnd that Cython's own post-call error check already makes unreachable.
  • DEADCODE — the _c2r_fft1d_impl in-place stub (in_place = 0 right before if in_place:), an intentional placeholder.

Adaptation from mkl_umath

mkl_fft's translation units differ from mkl_umath's, so the table was rebuilt from mkl_fft's own scan and generated code, not copied. mkl_umath's documented families (the __umath_generated.c InitOperators DEADCODE, the with-statement DEADCODE, the __Pyx__Import DEADCODE — which is inverted here because mkl_fft's module name mkl_fft._pydfti contains a dot — and the _patch_impl FORWARD_NULL) do not occur in mkl_fft and were deliberately omitted.

@antonwolfy
antonwolfy force-pushed the backport/coverity-triage-docs branch from b099107 to 706a225 Compare September 3, 2026 10:23
@antonwolfy antonwolfy self-assigned this Sep 3, 2026
@antonwolfy antonwolfy added this to the 2.4.0 release milestone Sep 3, 2026
@antonwolfy antonwolfy changed the title Document Coverity Scan triage and pin Cython for stable scans Stabilize Coverity Scan triage and document known false positives Sep 3, 2026
@antonwolfy
antonwolfy force-pushed the backport/coverity-triage-docs branch from 706a225 to a69587a Compare September 3, 2026 10:28
Backport of IntelPython/mkl_umath#266, adapted to mkl_fft.

- Pin cython==3.3.0 in the Coverity workflow (only there, not in
  pyproject.toml) so the generated _pydfti.c stays byte-stable between
  scans and Coverity CIDs plus their triage survive. Works because the
  scan build uses --no-build-isolation.
- Add coverity/README.md: where findings come from across mkl_fft's two
  translation units (template-generated mklfft.c, which is our DFTI
  logic and stays in scope, and Cython-generated _pydfti.c), the
  Cython-pin rationale, an opt-in Project Component, a review checklist,
  and the verified false-positive families for the mkl_fft project.

The known false positives are grouped by checker + mechanism (matched on
checker + mechanism, not CID, since CIDs reset on a Cython bump):
Cython-generated boilerplate (tp_traverse DEADCODE, version/ABI-guarded
helper DEADCODE, a reference-cleanup UNUSED_VALUE, a CHECKED_RETURN) and
two dead-by-construction families in our own .pyx (redundant is-NULL
guards Cython already proves, and an intentional in-place placeholder
stub) - all triaged Intentional / Ignore.

mkl_umath's own documented false positives were not ported blind; the
table was rebuilt from mkl_fft's own scan and generated code.
@antonwolfy
antonwolfy force-pushed the backport/coverity-triage-docs branch from a69587a to a16f45c Compare September 3, 2026 10:33
@antonwolfy
antonwolfy marked this pull request as ready for review September 3, 2026 10:35
@antonwolfy
antonwolfy merged commit 510a3f9 into master Sep 3, 2026
97 of 104 checks passed
@antonwolfy
antonwolfy deleted the backport/coverity-triage-docs branch September 3, 2026 18:20
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.

2 participants