Skip to content

Fix: Run parsers with setup-python interpreter - #207

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

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

Conversation

@lf-releng-code-monkey-bot

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

Copy link
Copy Markdown
Contributor

Closes #206

Authored by an AI agent; human review required
Command Exit
python3 .cm-scratch/run.py action.yaml <step> <fixture> <empty|missing|real interpreter> (pyproject-name and setup-name, 9 cases) 0
prek run --files action.yaml README.md 0
shellcheck .cm-scratch/sc-pyproject-name.sh .cm-scratch/sc-setup-name.sh 0
uvx zizmor --offline action.yaml 0
uvx gha-workflow-linter==1.12.0 lint . --action-calls off --allow-list off --verify-python-path 7
git commit -s --amend -F .cm-scratch/msg.txt (prek + gitlint hooks) 0
git log --raw --format=%h b91cf0c8bcd50f03aa0872d0dc331a6f075d53dd..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 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.

Round 2 of revision, on its base.


What this does

The pyproject.toml and setup.py parser steps started python3 by bare name, so the caller's PATH chose the interpreter (gha-workflow-linter PPA014, action.yaml lines 115 and 351). This PR:

  • adds a commit-pinned actions/setup-python step (# v6.3.0) with python-version: ">=3.11" and update-environment: false, so the caller's PATH and environment stay untouched;
  • starts both parsers as "$PYTHON" -I from that step's python-path output, with LD_LIBRARY_PATH set to the interpreter's own lib. Without that, the interpreter can't start in container jobs and Name Extraction [no-tomllib] failed;
  • (this round) sets continue-on-error: true on the setup-python step and guards each parser on $PYTHON being a non-empty executable path. If provisioning fails, both parsers use their awk line-match fallbacks, never the caller's python3, and the shell-only setup.cfg step still runs;
  • updates the README to match.

Checks run

  • Parser steps extracted from action.yaml and run locally with PYTHON empty, missing, and a real interpreter, on a pyproject.toml, a setup.py and a Python 2 setup.py. Every case returned the right name: the fallback when there's no interpreter, the parser otherwise.
  • prek run --files action.yaml README.md: pass (gitlint, aislop, yamllint, write-good, actionlint and the rest).
  • shellcheck on the two changed step scripts: pass.
  • zizmor --offline action.yaml: no findings.
  • gha-workflow-linter lint . --action-calls off --allow-list off --verify-python-path: exits 7 at base and still exits 7 here. Both PPA014 findings are gone. The one remaining finding is a pre-existing, out-of-scope PPA004 in .github/workflows/testing.yaml:379. Two PPA009 notices on "$PYTHON" are notices only.

Still for a reviewer

Two review threads ask for changes in .github/workflows/testing.yaml: parser-mode matrix and skips, fallback fixtures, and a CI interpreter-selection regression test. A maintainer comment authorised that edit. This PR doesn't otherwise change that file, though, and the publishing workflow rejects edits to any other workflow file whatever a comment says. So those threads are still open for a human, or need a follow-up change that touches testing.yaml. The same edit is needed to clear PPA004 and get the linter to exit 0.

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 Python version constraint can select interpreters without tomllib, while CI lacks regression coverage for executable selection and no longer reliably exercises the awk fallbacks.

3 open issues
What changed in this PR

This PR addresses #206 by making the project-name action run its Python parsers with an interpreter provided by actions/setup-python, rather than resolving python3 from the caller’s PATH.

Changes:

  • Adds commit-pinned interpreter setup with environment updates disabled.
  • Uses the interpreter’s absolute path for both parsers, retaining isolated mode (-I).
  • Keeps the awk fallbacks and updates documentation to describe the new interpreter behavior.
File Description
README.md Documents interpreter provisioning and parser fallback behavior.
action.yaml Adds interpreter setup, binds both parser steps to its output, and updates fallback comments.

Review effort: Balanced

Comment thread action.yaml Resolved
Comment thread action.yaml Resolved
Comment thread action.yaml Resolved
@ModeSevenIndustrialSolutions

Copy link
Copy Markdown
Member

Maintainer instruction for the next revision round: the head has failing checks (listed in the packet) that this change introduced; the action's own tests must pass. Fix the cause in the action or its tests, not by weakening the test; address any open review thread; nothing further. Acceptance from the issue stands: gha-workflow-linter lint . --action-calls off --allow-list off --verify-python-path exits 0 and the tests pass.

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

Python provisioning failure aborts all extraction, making the shell-only setup.cfg path and existing awk fallbacks unreachable.

3 open issues

Review effort: Balanced

Comment thread action.yaml Resolved
@ModeSevenIndustrialSolutions

Copy link
Copy Markdown
Member

Maintainer instruction for the next revision round: this round may edit .github/workflows/testing.yaml. Address the three open threads: make the no-python / no-tomllib parser-mode tests exercise the provisioned interpreter rather than the caller's PATH, add the interpreter-selection regression test, and make the setup-python step's failure fall back rather than abort (continue-on-error plus a guard on its output). Fix the failing 'Name Extraction [no-tomllib]' check. Nothing further.

The pyproject.toml and setup.py parser steps started python3 by bare
name, so the caller's PATH chose the interpreter this action runs
(gha-workflow-linter PPA014).

Add a commit-pinned actions/setup-python step with
update-environment: false, so the caller's PATH and environment stay
untouched, and start both parsers through its python-path output as
"$PYTHON" -I. The line-based fallbacks remain for files the parsers
reject.

Request python-version ">=3.11" rather than "3.x": with check-latest
off, "3.x" may resolve to an older interpreter from the runner's tool
cache, which lacks tomllib and silently degrades pyproject.toml to the
line match (review: require Python 3.11+).

Start the interpreter with LD_LIBRARY_PATH set to its own lib
directory. Tool-cache builds find libpython through an absolute rpath
under /opt/hostedtoolcache, which a job container mounts at /__t, and
setup-python only sets LD_LIBRARY_PATH when it updates the
environment. Without it, the interpreter could not start in a
container job, both parsers fell back to the line match, and the
Name Extraction [no-tomllib] job failed on setup.py fixtures.

Let the setup-python step continue on error, and start a parser only
when its python-path output names an executable; otherwise both
parsers take their line-based fallbacks, never the caller's python3,
and the shell-only setup.cfg step still runs (review: provisioning
failure skips the fallbacks).

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

Container startup and repeated setup-python provisioning need CI validation because existing checks cannot establish which parser ran, and the local harness does not exercise action provisioning.

2 open issues

Review effort: Balanced

@ModeSevenIndustrialSolutions

ModeSevenIndustrialSolutions commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Maintainer instruction for the next revision round Retracted. An earlier version of this comment said the publishing workflow allows a revision round to edit .github/workflows/testing.yaml. That was wrong: it was checked against an outdated copy of the bot. On main, scripts/workflow_gate.py rejects any revision round that touches a workflow file this pull request does not already change (docs/DESIGN.md §20.3), and no comment widens that. Round 4 was right to hand off.

The two open threads (parser-mode matrix and fallback fixtures; the interpreter-selection regression test) and the PPA004 at testing.yaml:379 need a human change or a separate follow-up pull request that edits testing.yaml. No further revision round is requested here.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit e1cca93 into lfreleng-actions:main Nov 14, 2026
16 checks passed
lf-releng-code-monkey-bot Bot added a commit to lfreleng-bot-forks/python-project-name-action that referenced this pull request Nov 14, 2026
Since lfreleng-actions#207 the parsers start the interpreter setup-python provides,
not the job's python3. The name-extraction matrix still chose its
modes by that python3, so every leg ran tomllib and ast, the awk
fallbacks went untested, and the no-python skips hid fixtures 14 to
64 in a leg where the full parser ran.

Name each leg by the parser path the action must take. The parser
legs run on the runner and in an ubuntu:24.04 image with no python3;
the fallback leg points setup-python, through AGENT_TOOLSDIRECTORY,
at a tool cache whose only Python fails when started. Each leg first
runs the action on two probes that the parsers and the awk matches
read differently, and fails unless the names show the path it names.
The fallback leg also requires that the action started the failing
interpreter, and every leg plants decoy python3 and python first on
PATH that must never run. The python:3.10-slim leg tested only the
job's own python3, which the action no longer starts, so drop it.

Skips now name the fallback path, the only one where the awk match
runs. Add a malformed pyproject.toml and a Python 2 setup.py, which
tomllib and ast reject, so the fallbacks must return the name on
every path.

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>
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: Stop the caller choosing this action's interpreter

2 participants