fix(ci): lint must use an ephemeral venv, not the production one
Lint / pssa (push) Failing after 30s
Lint / python (push) Successful in 1m2s

The python lint job set VENV_DIR=F:\CI\python\venv (the shared
orchestrator venv) and ran `pip install -e ".[dev]"`. Every lint run
repointed ci_orchestrator at the lint job's transient checkout; once
act_runner cleaned that dir, all later smoke/build jobs failed with
"No module named ci_orchestrator". Use a job-local venv under
github.workspace, rebuilt fresh each run.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Simone
2026-05-17 15:44:36 +02:00
parent 21681e7419
commit 0726829c5c
+13 -24
View File
@@ -69,7 +69,12 @@ jobs:
env: env:
PYTHONIOENCODING: utf-8 PYTHONIOENCODING: utf-8
VENV_DIR: F:\CI\python\venv # Job-local, ephemeral venv. MUST NOT be the production venv
# (F:\CI\python\venv): an editable install here would repoint the
# shared orchestrator package at this run's transient checkout and
# break every later smoke/build job with "No module named
# ci_orchestrator". github.workspace is discarded after the job.
VENV_DIR: ${{ github.workspace }}\.venv-lint
steps: steps:
- name: Checkout - name: Checkout
@@ -94,30 +99,14 @@ jobs:
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe' $venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
# Probe: a broken venv (pyvenv.cfg pointing to a deleted base interpreter) # Always build a fresh, job-local venv. Never reuse or repair a
# writes "No Python at ..." to stderr; under $ErrorActionPreference='Stop' # shared one — lint must be fully isolated from the production
# native stderr becomes a terminating exception (AGENTS.md error #12), # orchestrator venv.
# so probe with SilentlyContinue + try/catch. if (Test-Path $env:VENV_DIR) {
$venvOk = $false Remove-Item $env:VENV_DIR -Recurse -Force
if (Test-Path $venvPy) {
try {
$prevEAP = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
& $venvPy --version 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) { $venvOk = $true }
}
catch { $venvOk = $false }
finally { $ErrorActionPreference = $prevEAP }
}
if (-not $venvOk) {
Write-Host "Venv missing or broken, (re)bootstrapping at $env:VENV_DIR with $env:CI_PYTHON_LAUNCHER"
if (Test-Path $env:VENV_DIR) {
Remove-Item $env:VENV_DIR -Recurse -Force
}
& $env:CI_PYTHON_LAUNCHER -m venv $env:VENV_DIR
if ($LASTEXITCODE -ne 0) { throw "venv creation failed" }
} }
& $env:CI_PYTHON_LAUNCHER -m venv $env:VENV_DIR
if ($LASTEXITCODE -ne 0) { throw "venv creation failed" }
Write-Host "Using venv python: $venvPy" Write-Host "Using venv python: $venvPy"
& $venvPy --version & $venvPy --version