← Back to Pull requests

Add test-python-versions matrix to quality gate #36

Closed
unknown closed this pull request without merging on Sep 03, 2026 18:32 UTC
View on GitHub
unknown unknown commented on Sep 03, 2026 16:25 UTC
Author

Summary


Lets consumers run their test suite across several Python versions with one input instead of hand-rolling a second matrix job (as done in cognizant-ai-lab/leaf-common#191 and cognizant-ai-lab/neuro-san-studio#1363).

uses: cognizant-ai-lab/build-common/.github/workflows/_python-quality-gate.yml@<sha>
with:
  python-version: '3.12'                          # lint / shellcheck / README job
  test-python-versions: '["3.12", "3.13", "3.14"]' # NEW: pytest matrix
  ...

_python-quality-gate.yml:

  • new test-python-versions input (JSON list string, default '')

  • quality-gate job: test steps and the Slack step gain inputs.test-python-versions == ''

  • new unit-tests job: if: test-python-versions != '' && run-pytest, strategy.matrix.python-version: fromJSON(inputs.test-python-versions), fail-fast: false; same checkout + test-command-override / pytest steps as quality-gate

  • new notify job: needs: [quality-gate, unit-tests], sends one Slack message with status: contains(needs.*.result, 'failure') ? failure : success; only when a matrix is set
  • New composite actions/python-ci-setup holds the setup steps that were inline in quality-gate (apt packages, requirements detection, setup-python-env) so both jobs share them. It hard-codes ./.build-common/actions/setup-python-env since uses: cannot be templated; the header comment documents that expectation.

    Backward compatibility: with the default '' the workflow is behaviourally identical to today (same single quality-gate job, same check name, same Slack step). Consumers that opt in get extra checks <job> / Unit tests (3.x) and <job> / Notify Slack.

    Downstream check: consumers found via _python-quality-gate — leaf-common, neuro-san (tests.yml, integration.yml), neuro-san-deploy, neuro-san-studio, nsflow, neuro-ui; all pin to tags (1.0.6–1.0.9) and none of them use the removed inline step ids (detect-reqs), so nothing breaks on main or on tag upgrade.

    Validation: yamllint --strict and actionlint pass. Dogfooded from a leaf-common branch pointing at this SHA with test-python-versions: '["3.12", "3.13", "3.14"]': https://github.com/cognizant-ai-lab/leaf-common/actions/runs/33778473493

    Link to Devin session: https://app.devin.ai/sessions/25fc14ae7bdc496f98837871f43ed0ea
    Open in Devin Desktop: https://app.devin.ai/desktop/session/25fc14ae7bdc496f98837871f43ed0ea?variant=devin
    Requested by: @donn-leaf
    <!-- devin-review-badge-begin -->

    ---

    <a href="https://app.devin.ai/review/cognizant-ai-lab/build-common/pull/36" target="_blank">
    <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=3">
    <img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=3" alt="Devin Review">
    </picture>
    </a>
    <!-- devin-review-badge-end -->

    Diff: 358 lines (+268 / -90) across 4 files Reviewer: donn-leaf Review duration: 126m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 358 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.352
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #36"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.6% (MEDIUM) · Higher = larger blast radius
    42.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.8% · Safe to merge
    16.8%