From 099399b58f5eef8ccd612881167792ea9517fdd1 Mon Sep 17 00:00:00 2001 From: ScottW514 Date: Thu, 15 Oct 2026 21:13:05 -0400 Subject: [PATCH] forgetest-ci: the undefined-name step fails when pyflakes is missing or raises The "No undefined names" step runs under bash -e with no pipefail, and -e does not reach the condition of an `if`. The former body pipes the pyflakes run into grep, so the step's status is grep's alone: with pyflakes absent ("No module named pyflakes" on stderr, exit 1) or crashing, grep sees no match, the `if` is false, and the step passes with nothing checked. Its `pip install pyflakes` also names no interpreter. The step now installs with `python -m pip`, into the interpreter it runs; runs `pyflakes --version`, which fails the step under -e when the module is missing; captures the pyflakes run, stderr included, in a file (its own exit status is 1 for any message, unused imports included, so it cannot be the gate); and fails on "undefined name" or on "Traceback", a crash. The grep is pinned to pyflakes' message text; no pyflakes version is pinned. Proof: the step body, read from this workflow, run under bash -e over the forgetest tree on Ubuntu 24.04 with python 3.12, against the former body as the control. pyflakes missing: the former body exits 0, this one exits 1. pyflakes 4.0.3 present, the tree as committed: both exit 0 (22 unused imports and 2 unused locals, no undefined name). An undefined name planted in a scratch copy: both exit 1. A pyflakes that raises (a shim, scratch only): the former body exits 0, this one exits 1. In CI the step's log shows the pyflakes version before the check. Acceptance: none; CI only. .github/ is outside meta-forgefirm and every covers map. --- .github/workflows/forgetest-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/forgetest-ci.yml b/.github/workflows/forgetest-ci.yml index 4876af9..8b87c92 100644 --- a/.github/workflows/forgetest-ci.yml +++ b/.github/workflows/forgetest-ci.yml @@ -144,8 +144,10 @@ jobs: - name: No undefined names (the live drills never execute on the host) working-directory: forgefirm/forgetest run: | - pip install pyflakes - if python -B -m pyflakes forgetest tests | grep -E "undefined name"; then exit 1; fi + python -m pip install pyflakes + python -B -m pyflakes --version + python -B -m pyflakes forgetest tests > pyflakes.txt 2>&1 || true + if grep -E "undefined name|Traceback" pyflakes.txt; then exit 1; fi - name: Shared UI files match forgectrl at its pinned revision working-directory: forgefirm