Repository navigation
Fix: Run parsers with setup-python interpreter - #207
ModeSevenIndustrialSolutions merged 1 commit into
Conversation
There was a problem hiding this comment.
🟡 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
|
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: |
0bef58c to
c2cb604
Compare
|
Maintainer instruction for the next revision round: this round may edit |
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>
c2cb604 to
04138df
Compare
|
The two open threads (parser-mode matrix and fallback fixtures; the interpreter-selection regression test) and the |
e1cca93
into
lfreleng-actions:main
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>

Closes #206
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLIb91cf0c8bcd50f03aa0872d0dc331a6f075d53ddpython3 .cm-scratch/run.py action.yaml <step> <fixture> <empty|missing|real interpreter> (pyproject-name and setup-name, 9 cases)prek run --files action.yaml README.mdshellcheck .cm-scratch/sc-pyproject-name.sh .cm-scratch/sc-setup-name.shuvx zizmor --offline action.yamluvx gha-workflow-linter==1.12.0 lint . --action-calls off --allow-list off --verify-python-pathgit commit -s --amend -F .cm-scratch/msg.txt (prek + gitlint hooks)git log --raw --format=%h b91cf0c8bcd50f03aa0872d0dc331a6f075d53dd..HEADThe
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.
Round 2 of revision, on its base.
What this does
The
pyproject.tomlandsetup.pyparser steps startedpython3by bare name, so the caller'sPATHchose the interpreter (gha-workflow-linterPPA014,action.yamllines 115 and 351). This PR:actions/setup-pythonstep (# v6.3.0) withpython-version: ">=3.11"andupdate-environment: false, so the caller'sPATHand environment stay untouched;"$PYTHON" -Ifrom that step'spython-pathoutput, withLD_LIBRARY_PATHset to the interpreter's ownlib. Without that, the interpreter can't start in container jobs andName Extraction [no-tomllib]failed;continue-on-error: trueon the setup-python step and guards each parser on$PYTHONbeing a non-empty executable path. If provisioning fails, both parsers use their awk line-match fallbacks, never the caller'spython3, and the shell-onlysetup.cfgstep still runs;Checks run
action.yamland run locally withPYTHONempty, missing, and a real interpreter, on apyproject.toml, asetup.pyand a Python 2setup.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).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. BothPPA014findings are gone. The one remaining finding is a pre-existing, out-of-scopePPA004in.github/workflows/testing.yaml:379. TwoPPA009notices 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 touchestesting.yaml. The same edit is needed to clearPPA004and get the linter to exit 0.