Skip to content

Feat: Warn when a Python project skips resolution - #183

Merged
ModeSevenIndustrialSolutions merged 2 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-182
Nov 1, 2026
Merged

ModeSevenIndustrialSolutions merged 2 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-182

Conversation

@lf-releng-code-monkey-bot

@lf-releng-code-monkey-bot lf-releng-code-monkey-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #182

Authored by an AI agent; human review required
Command Exit
bash tests/python-warning-steps.sh 0
bash tests/workflow-steps.sh 0
zizmor --persona auditor .github/workflows/ 0
prek run --files .github/workflows/sonatype-lifecycle.yaml tests/python-warning-steps.sh docs/BRIEF.md 0
aislop scan --changes --base 378fcc19ebdf37f17fde4888d4b71c83b21d6cf3 --json . 0
gitlint --commits 378fcc19ebdf37f17fde4888d4b71c83b21d6cf3..HEAD 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; a maintainer must act on any finding that remains after that, and reviews every round before merge.

Round 1 of revision, on its base.


Adds a non-fatal step to the scan job of sonatype-lifecycle.yaml, Check for an unresolved Python project. It warns when a Python project is scanned with the default build_type: 'none', because Nexus IQ then evaluates few or none of its dependencies (#182).

What it does

  • Runs only when build_type is none. It sits after both checkout steps and before Sonatype Lifecycle scan.
  • Enters path_prefix itself, which it receives through env:. It sets no working-directory: and exits 0 when path_prefix names no directory.
  • Warns only when scan_targets is ., the directory holds pyproject.toml, setup.py, setup.cfg, uv.lock or requirements.txt, and the directory holds neither poetry.lock nor Pipfile.lock.
  • Emits one ::warning annotation and the same text in the step summary. The text names the files found and recommends build_type: 'python' with python_version. The step always exits 0.
  • docs/BRIEF.md records the warning, why it does not fail the job, and the two facts verified on 2026-11-01.

This round

  • Copilot found that a nonexistent path_prefix failed the step through working-directory: before the script could exit 0. Following the maintainer's instruction, the step no longer sets working-directory: and does not use continue-on-error. It now runs cd -- "${PATH_PREFIX}" 2> /dev/null || exit 0.
  • New harness cases: a nonexistent PATH_PREFIX passes with no warning; the default PATH_PREFIX=. warns; the step sets no working-directory; PATH_PREFIX is passed through env. The harness now runs the step from a directory other than the project, so it confirms the step enters PATH_PREFIX itself. Against the old step, 21 of the 36 cases fail.

Checks run

  • bash tests/python-warning-steps.sh: 36 cases passed
  • bash tests/workflow-steps.sh: 112 cases passed
  • zizmor --persona auditor .github/workflows/: no findings
  • prek run --files on the three changed files: passed
  • aislop scan --changes --base <base>: no diagnostics
  • gitlint --commits <base>..HEAD: passed

For the reviewer

  • The new cases are in tests/python-warning-steps.sh, not in tests/workflow-steps.sh, because that file is executable and this workflow cannot edit executable files. Moving the cases into it is a mechanical follow-up.

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.

🟡 Changes recommended

The diagnostic step fails when an unused path_prefix directory does not exist, preventing valid scans from running unless the step is made non-fatal.

1 open issue
What changed in this PR

This PR addresses #182 by warning when the Sonatype Lifecycle lane scans a Python project without dependency resolution, helping callers recognize scans that may evaluate few or no dependencies.

Changes:

  • Adds a targeted warning and step summary recommending Python resolution mode.
  • Adds generated-fixture tests and runs them in the workflow test job.
  • Documents the warning conditions and verified Python scan behavior.
File Description
tests/​python-warning-steps.sh Tests warning conditions, output, and step placement.
docs/​BRIEF.md Explains the warning and records verified scan behavior.
.github/​workflows/​workflow-tests.yaml Runs the new Python warning tests.
.github/​workflows/​sonatype-lifecycle.yaml Detects unresolved Python projects and emits guidance.

Review effort: Balanced

lf-releng-code-monkey-bot Bot and others added 2 commits November 1, 2026 19:19
A Python project scanned with the default build_type 'none' passes
green while Nexus IQ evaluates few or none of its dependencies: it
cannot read pyproject.toml, setup.py or uv.lock, and reads only the
'==' lines of requirements.txt. Both of the organisation's own uv
callers scan that way and reported 0 and 4 components.

Add a step to the scan job that, when scan_targets is left at '.',
the project holds Python metadata and no poetry.lock or Pipfile.lock,
emits a warning annotation and step summary naming the files found
and recommending build_type 'python'. It always exits 0, so existing
callers keep working.

The step enters path_prefix itself, passed through env, and exits 0
when it names no directory, rather than setting working-directory:
GitHub fails a step whose working directory is missing before its
script runs, and 'none' mode never uses path_prefix, so a caller may
leave it naming nothing. continue-on-error is avoided because it
would also report a genuine bug in the step as a pass.

Review of PR lfreleng-actions#183, round 1: Copilot found that a nonexistent
path_prefix failed the step through its working-directory. Fixed as
the maintainer asked, with harness cases for a missing PATH_PREFIX,
for the default '.', and for the step setting no working-directory.

The cases run from a new tests/python-warning-steps.sh, wired into
the Workflow step tests job, because tests/workflow-steps.sh is an
executable file this change could not edit.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Note beside D24 that the CLM lane now warns when a Python project is
scanned with build_type 'none', why it warns rather than fails, why
it enters path_prefix itself and stays silent when that is missing,
and the two facts verified on 2026-11-01: Python mode yields exact
components on the live server, and dirExcludes=**/.* does not exclude
a dot-directory scan target.

Co-authored-by: Copilot <[email protected]>
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 remain for the change adding a non-fatal warning about potentially unevaluated Python dependencies.

No open issues 🎉

Review effort: Balanced

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 1e51855 into lfreleng-actions:main Nov 1, 2026
12 checks passed
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: Warn when a Python project skips resolution

2 participants