Skip to content

Feat: Derive the standard matrix from metadata - #190

Merged
ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-189
Nov 20, 2026
Merged

ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-189

Conversation

@lf-releng-code-monkey-bot

Copy link
Copy Markdown
Contributor

Closes #189

Authored by an AI agent; human review required
Command Exit
bash tests/test-python-metadata.sh 0
bash tests/test-python-metadata.sh <base-commit workflows copy> (expected failure) 1
prek run --files <changed files> 0
prek run --all-files 0
zizmor --persona auditor --offline --no-progress .github/workflows/ 0
AISLOP_NO_TELEMETRY=1 aislop scan --base 9c88388 --json . (diagnostics: []) 0
AISLOP_NO_TELEMETRY=1 aislop scan --staged --json . (diagnostics: []) 0
git commit -s (pre-commit and commit-msg hooks) 0

The github-code-monkey-bot workflow opened this pull request.
Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.


INFO
One follow-up needs a maintainer: register tests/test-python-metadata.sh as a prek hook. This workflow may not edit .pre-commit-config.yaml, so the hook is not in this PR. Append this beside the two Grype wiring hooks:

  # Contract check for the Python version source: one pinned
  # build-metadata-action call in a python-metadata job, which
  # every matrixed job, the build and the SBOM read from.
  - repo: local
    hooks:
      - id: python-metadata
        name: Python version source contract check
        entry: bash tests/test-python-metadata.sh
        language: python
        additional_dependencies: ['pyyaml==6.0.2']
        pass_filenames: false
        # yamllint disable-line rule:line-length
        files: '^(\.github/workflows/[^/]+\.yaml|tests/test-python-metadata\.sh)$'

What changed and why

The standard workflows (build-test.yaml, build-test-release.yaml) got their Python test matrix and build interpreter from python-build-action v2.1.2. That action embeds build-metadata-action v0.11.1, which hard-codes the range 3.10 to 3.14. The multi-arch workflows use their own python-metadata job with a pinned v0.13.2, which resolves the range from live release data. So the two lanes gave different answers for the same project.

  • build-test.yaml / build-test-release.yaml: add a python-metadata job copied from the multi-arch variants: same name, permissions, timeout, harden-runner steps, dual checkout, and the same build-metadata-action pin and with: block. It needs gerrit-validate in the verify workflow and tag-validate in the release workflow. Its outputs are matrix_json ({"python-version": [...]}) and build_version. A follow-on step fails with ::error:: when the matrix isn't JSON with a non-empty python-version array, and emits ::warning:: when python_requires_python_fallback is true.

    • python-build needs python-metadata and passes it python_version: needs.python-metadata.outputs.build_version. The job's matrix_json and build_python_version outputs are removed. artefact_name, artefact_path and artefact_digests stay.
    • python-tests and python-audit add python-metadata to needs and expand its matrix. Their if: conditions are unchanged. In the release workflow, python-tests still waits for python-audit, sbom and grype.
    • sbom adds python-metadata to needs and uses its build_version.
    • The header job graphs now start with python-metadata.
  • Multi-arch workflows: the derive step in each python-metadata job now gives the same fallback warning. Nothing else changes.

  • tests/test-python-metadata.sh: a contract test written like tests/test-grype-gate-inputs.sh. For all four workflows it checks:

    • there is one python-metadata job, and it needs the right upstream job;
    • it holds the only build-metadata-action call, with the same pin, # v0.13.2 comment, step id and with: block in every workflow;
    • its build_version output and matrix output are wired;
    • the fallback warning is present, and in the standard workflows so is the failing matrix check;
    • no expression reads matrix_json or build_python_version from needs.python-build.outputs;
    • every Python matrix comes from python-metadata;
    • every python-build-action and sbom-action python_version comes from needs.python-metadata.outputs.build_version, or, on the multi-arch build legs, from matrix.python-version;
    • every job that reads python-metadata lists it in needs.

    It then checks 22 or 23 mutated copies of each workflow and fails if any mutant passes.

  • testing.yaml: the Test: Grype gate wiring job runs the new script in a new step. The job name is unchanged, so required-check names stay the same.

  • Docs: the README job graphs and multi-arch paragraph, and docs/BRIEF.md Q11/Q12, now describe the current design in place.

Behaviour that changes for callers

  • Standard-lane test and audit matrices gain Python 3.15 where the project's requires-python allows it, and no longer include 3.10.
  • The build and the SBOM use the newest line of that matrix: 3.15 for the same projects, where they used 3.14.
  • A run has one more job (Extract Project Metadata), ahead of the build.

What I ran

  • bash tests/test-python-metadata.sh: passes. All mutants are caught (23/23, 23/23, 22/22, 22/22).
  • The same script run against the base commit's workflows: fails with 22 problems, as expected.
  • The new matrix-check step script, run against valid, empty, null, bare-array and string matrices with the fallback flag on and off: errors and warnings appear as intended.
  • prek run --files <changed files> and prek run --all-files: pass. This covers yamllint, actionlint, zizmor, shellcheck, markdownlint, reuse, gha-workflow-linter, check-jsonschema, codespell and both Grype wiring checks. The commit-msg gitlint hook also passed.
  • zizmor --persona auditor --offline .github/workflows/: no findings.
  • aislop 0.20.0 (--base 9c88388, --staged), telemetry off: empty diagnostics. aislop scores none of the touched file types (YAML, Markdown, shell), so this gate checks little here.

For reviewers

  • Not verifiable from this session:
    • That build-metadata-action v0.13.2 exposes python_requires_python_fallback. I took the output name from the issue, and an absent output would only stop the warning from firing.
    • The Testing 🧪 acceptance criterion: whether the dependamerge standard leg and the python-nss-ng multi-arch leg list the same versions. That shows up in this PR's run. If a consumer fails on its new 3.15 leg, that is a finding about the consumer. Per the issue, the matrix is not narrowed.
  • python-build-action still runs its embedded metadata step. Only its matrix output goes unused now (out of scope per the issue).
  • The release workflow's python-metadata checks out the tagged code after tag-validate, the same as the multi-arch release workflow.

The standard workflows took their Python test matrix and build
interpreter from python-build-action, whose embedded copy of
build-metadata-action (v0.11.1) fixes the range at 3.10 to 3.14. The
multi-arch workflows resolve it from live release data through their
own python-metadata job and a pinned v0.13.2. The two lanes therefore
disagreed for the same project: dependamerge ran 3.11 to 3.14 on the
standard lane while python-nss-ng ran 3.11 to 3.15 on the multi-arch
one.

build-test.yaml and build-test-release.yaml now carry the same
python-metadata job as the multi-arch variants, with the same pin and
inputs. It fails on a matrix the jobs cannot expand and warns when
requires-python fell back to a default range; the multi-arch jobs gain
the same warning, which python-build-action stops giving once it
receives python_version. python-tests and python-audit expand its
matrix, and python-build and the SBOM use its build version. Nothing
reads a matrix or build version from python-build any more.

tests/test-python-metadata.sh holds all four workflows to that
contract and proves itself against mutated copies; testing.yaml runs
it beside the Grype wiring checks. README.md and docs/BRIEF.md
describe the shared design.

Behaviour that changes for callers of the standard workflows:

- Test and audit matrices gain Python 3.15 where the project's
  requires-python allows it, and no longer include 3.10.
- The build and the SBOM use the newest line of that matrix: 3.15
  for the same projects, where they used 3.14.
- A run has one more job, ahead of the build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Missing Testing-run evidence leaves standard/multi-arch interpreter parity and build/SBOM outcomes unverified, requiring maintainer review before merge.

No open issues 🎉

What changed in this PR

Aligns the standard workflows with the multi-architecture workflows by deriving Python versions from the same pinned metadata action, addressing #189’s inconsistent version selection.

Changes:

  • Adds metadata jobs to the standard workflows and wires their outputs into builds, tests, audits and SBOM generation.
  • Validates standard-lane matrices and adds fallback warnings across all four workflows.
  • Adds a mutation-backed contract check to CI and updates the workflow documentation. Prek hook registration remains a documented maintainer follow-up.
File Description
tests/​test-python-metadata.sh Adds metadata wiring checks and mutation-based validation.
README.md Updates job graphs and Python version selection documentation.
docs/​BRIEF.md Records the shared metadata design for both workflow families.
.github/​workflows/​testing.yaml Runs the new contract check in the existing wiring job.
.github/​workflows/​build-test.yaml Adds metadata extraction, matrix validation and consumer wiring.
.github/​workflows/​build-test-release.yaml Adds metadata-driven version selection while preserving release gates.
.github/​workflows/​build-test-release-multiarch.yaml Adds a warning when Python version selection uses a fallback.
.github/​workflows/​build-test-multiarch.yaml Adds the same fallback warning to multi-architecture verification.

Review effort: Balanced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.

The version-source rewiring is internally consistent and preserves existing downstream gates; no actionable defect was found in the supplied diff. The external action's fallback-output contract could not be verified from the offline checkout.

Antagonistic round 1 of 3.


Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 7b88f25 into lfreleng-actions:main Nov 20, 2026
92 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the code-monkey/issue-189 branch November 20, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Derive the standard matrix from metadata

2 participants