Repository navigation
Fix: Declare the Python project type - #204
ModeSevenIndustrialSolutions merged 3 commits into
Conversation
Commit 6cc1254 moved all four workflows to repository-metadata-action v0.5.5, but tests/test-grype-gate-inputs.sh still held them to the v0.5.4 pin, so the grype-gate-inputs hook failed on every change to a workflow file. Hold the workflows to the pin they now carry. 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>
The metadata step of each workflow's python-metadata job left build-metadata-action to detect the project type from marker files. Its detection ranks package.json above pyproject.toml, and go.mod, pom.xml and others above setup.py and setup.cfg, so a Python project carrying one of those files was reported as another kind of project, with no python_matrix_json. The standard workflows then failed their matrix check and the multi-arch ones handed the build an empty list. Pass project_type: python, the Python extractor's own name, which still leaves the choice between pyproject.toml, setup.cfg and setup.py to the extractor. On a project with one Python marker file only the project_type output changes, which no workflow here reads. tests/test-python-metadata.sh holds the four steps to the new with: block and gains a mutant that drops the input. 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>
Add tests/fixtures/mixed-markers, a small Python project beside a package.json that names another project, and a testing.yaml job that runs the workflows' metadata step on it. Without project_type the metadata action reads the directory as an npm project, with no Python matrix; the job fails unless python_matrix_json holds a usable matrix and project_name is the Python project's name. tests/test-python-metadata.sh holds the job's step to the workflows' pin, version comment and with: block, bar path_prefix, so the copy cannot drift, and checks it catches each mutation of that step. A whole-workflow leg on the fixture waits for python-build-action, which makes the same undeclared call inside itself. 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>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the explicit Python metadata changes across the reusable workflows.
No open issues 🎉
What changed in this PR
Addresses #203 by explicitly declaring Python in the metadata steps of all four reusable workflows, preventing other project markers from overriding Python detection without changing the action pin.
Changes:
- Adds
project_type: pythonacross the standard and multi-architecture workflows and documents the behavior. - Adds a mixed Python/Node fixture, a CI metadata check, and contract mutations to guard against regressions.
- Aligns the Grype gate test’s expected repository-metadata pin with the version already used by the workflows.
| File | Description |
|---|---|
tests/test-python-metadata.sh |
Enforces the Python declaration and fixture-step consistency with mutation checks. |
tests/test-grype-gate-inputs.sh |
Updates the expected repository-metadata pin to v0.5.5. |
tests/fixtures/mixed-markers/src/mixed_markers_fixture/__init__.py |
Adds an empty Python package for the fixture. |
tests/fixtures/mixed-markers/pyproject.toml |
Defines the fixture’s Python identity and supported versions. |
tests/fixtures/mixed-markers/package.json.license |
Supplies licensing metadata for the JSON fixture. |
tests/fixtures/mixed-markers/package.json |
Adds a competing Node project marker. |
README.md |
Explains explicit Python project detection. |
docs/BRIEF.md |
Documents the shared Python metadata input. |
.github/workflows/testing.yaml |
Checks the mixed fixture’s Python name and non-empty version matrix. |
.github/workflows/build-test.yaml |
Declares Python in standard build/test metadata extraction. |
.github/workflows/build-test-release.yaml |
Declares Python in standard release metadata extraction. |
.github/workflows/build-test-release-multiarch.yaml |
Declares Python in multi-architecture release metadata extraction. |
.github/workflows/build-test-multiarch.yaml |
Declares Python in multi-architecture build/test metadata extraction. |
Review effort: Balanced
There was a problem hiding this comment.
🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.
No actionable defects found. The Python type declaration is consistent across all four workflows, and the mixed-marker fixture checks the intended metadata behavior without changing action pins or widening permissions.
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.
7d14141
into
lfreleng-actions:main
Closes #203
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI3d95a0d82c02bb256a4225e4ab76d4a965e2d02cbash tests/test-grype-gate-inputs.sh (base commit)bash tests/test-python-metadata.shbash tests/test-grype-gate-inputs.shbash tests/test-grype-sbom-binding.shAISLOP_NO_TELEMETRY=1 DO_NOT_TRACK=1 aislop scan --changes --base 3d95a0d82c02bb256a4225e4ab76d4a965e2d02c --json .prek run --files .github/workflows/build-test-multiarch.yaml .github/workflows/build-test-release-multiarch.yaml .github/workflows/build-test-release.yaml .github/workflows/build-test.yaml .github/worThe
github-code-monkey-botworkflow 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.
What changed
Each of the four reusable workflows asked
build-metadata-actionfor the project's Python versions without saying the project is a Python project. The action's type detection rankspackage.jsonabovepyproject.toml, andgo.mod,pom.xmland others abovesetup.py/setup.cfg. So a Python project with one of those files beside it was read as another kind of project, and the step produced nopython_matrix_json.Fix: Declare the Python project type: addsproject_type: pythonto themetadatastep ofbuild-test.yaml,build-test-multiarch.yaml,build-test-release.yamlandbuild-test-release-multiarch.yaml.pythonis the extractor's own name, so the extractor still picks betweenpyproject.toml,setup.cfgandsetup.py. Nothing else in the step changes and the pin stays the same.tests/test-python-metadata.shadds the input toMETADATA_WITHand gains a mutant that drops it. README anddocs/BRIEF.mdnow mention the declaration.Test: Check the declared type on a mixed fixture: addstests/fixtures/mixed-markers, a small Python project (mixed-markers-fixture) beside apackage.jsonformixed-markers-node-sidewithdevDependenciesonly. A newpython-metadata-fixturejob intesting.yamlruns the same metadata step on it. The job fails unlesspython_matrix_jsonholds a non-emptypython-versionarray andproject_nameismixed-markers-fixture. The contract script holds that step to the workflows' pin, version comment andwith:block (path_prefixaside), and adds five mutants for it.Test: Track the v0.5.5 repository-metadata pin(preparatory): 6cc1254 moved all four workflows torepository-metadata-actionv0.5.5, buttests/test-grype-gate-inputs.shstill expected the v0.5.4 pin. Because of that, thegrype-gate-inputshook already failed on the base commit for any workflow change, so this PR couldn't be committed without skipping a hook that reported a finding. This one-line change makes the test expect the pin the workflows use now.What I ran
bash tests/test-python-metadata.sh: exit 0. 24/24, 24/24, 23/23 and 23/23 mutants caught across the four workflows, and 5/5 fortesting.yaml. Before the workflow edit, the updated script failed with 4 problems (onewith:mismatch per workflow).bash tests/test-grype-gate-inputs.sh: exit 0. It exited 1 on the base commit before the preparatory commit.bash tests/test-grype-sbom-binding.sh: exit 0.prek run --files <all 13 changed files>: exit 0, with no hooks skipped. This includes yamllint, actionlint, zizmor, reuse, shellcheck, check-json, ruff and the GitHub workflow schema checks.aislop scan --changes --base <base>with telemetry off: exit 0 with an emptydiagnosticsarray. Note that aislop has no engine for shell, YAML or Markdown, and its built-in policy excludes the fixture's Python file, so the scan covered no files.Things a reviewer may question
build-metadata-actionv0.13.3, but the workflows pin v0.13.2. The issue says to leave the pin alone. I couldn't fetch the action from this runner to confirm that v0.13.2 acceptsproject_type. The newpython-metadata-fixturejob will show this on the PR's own CI run.standardlegs, becausepython-build-actionmakes the same undeclared call inside itself (Fix: Declare the Python project type python-build-action#335).package.jsoncan't hold comments, so its SPDX header is in apackage.json.licensesidecar file.