Skip to content

Fix: Declare the Python project type - #204

Merged
ModeSevenIndustrialSolutions merged 3 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-203
Nov 24, 2026
Merged

ModeSevenIndustrialSolutions merged 3 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-203

Conversation

@lf-releng-code-monkey-bot

Copy link
Copy Markdown
Contributor

Closes #203

Authored by an AI agent; human review required
Command Exit
bash tests/test-grype-gate-inputs.sh (base commit) 1
bash tests/test-python-metadata.sh 0
bash tests/test-grype-gate-inputs.sh 0
bash tests/test-grype-sbom-binding.sh 0
AISLOP_NO_TELEMETRY=1 DO_NOT_TRACK=1 aislop scan --changes --base 3d95a0d82c02bb256a4225e4ab76d4a965e2d02c --json . 0
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/wor 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.


What changed

Each of the four reusable workflows asked build-metadata-action for the project's Python versions without saying the project is a Python project. The action's type detection ranks package.json above pyproject.toml, and go.mod, pom.xml and others above setup.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 no python_matrix_json.

  • Fix: Declare the Python project type: adds project_type: python to the metadata step of build-test.yaml, build-test-multiarch.yaml, build-test-release.yaml and build-test-release-multiarch.yaml. python is the extractor's own name, so the extractor still picks between pyproject.toml, setup.cfg and setup.py. Nothing else in the step changes and the pin stays the same. tests/test-python-metadata.sh adds the input to METADATA_WITH and gains a mutant that drops it. README and docs/BRIEF.md now mention the declaration.
  • Test: Check the declared type on a mixed fixture: adds tests/fixtures/mixed-markers, a small Python project (mixed-markers-fixture) beside a package.json for mixed-markers-node-side with devDependencies only. A new python-metadata-fixture job in testing.yaml runs the same metadata step on it. The job fails unless python_matrix_json holds a non-empty python-version array and project_name is mixed-markers-fixture. The contract script holds that step to the workflows' pin, version comment and with: block (path_prefix aside), and adds five mutants for it.
  • Test: Track the v0.5.5 repository-metadata pin (preparatory): 6cc1254 moved all four workflows to repository-metadata-action v0.5.5, but tests/test-grype-gate-inputs.sh still expected the v0.5.4 pin. Because of that, the grype-gate-inputs hook 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 for testing.yaml. Before the workflow edit, the updated script failed with 4 problems (one with: 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 empty diagnostics array. 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

  • Pin version. The issue measured the behaviour at build-metadata-action v0.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 accepts project_type. The new python-metadata-fixture job will show this on the PR's own CI run.
  • No full-workflow test on the fixture. The fixture isn't added to the standard legs, because python-build-action makes the same undeclared call inside itself (Fix: Declare the Python project type python-build-action#335).
  • Unrelated test fix. The preparatory pin commit touches a test outside the issue's scope. It is included only because the hook failed on the base commit.
  • REUSE licence file. package.json can't hold comments, so its SPDX header is in a package.json.license sidecar file.

lf-releng-code-monkey-bot Bot and others added 3 commits November 24, 2026 14:12
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>

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.

🟢 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: python across 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

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.

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.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 7d14141 into lfreleng-actions:main Nov 24, 2026
93 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the code-monkey/issue-203 branch November 24, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Declare the Python project type

2 participants