Repository navigation
fix(python-compatibility): detect repo state instead of hardcoding uv sync --frozen - #156
Conversation
… sync --frozen Restores the Python Compatibility matrix across all 11 uv-managed downstream repos that have been failing since the workflow assumed every caller had a uv.lock at the repo root. Adds explicit handling for two edge cases the prior implementation crashed on. Root cause: the "Install dependencies" step ran `uv sync --all-extras --frozen` unconditionally. This crashed for three caller categories: 1. Repos without pyproject.toml at root (e.g., DeQA-Doc which is a docs-only fork): error "No pyproject.toml found in current directory or any parent directory." 2. uv-managed repos with PEP 621 pyproject.toml but no uv.lock committed yet: --frozen requires uv.lock to exist. 3. Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master): uv sync cannot read poetry-locked projects. Fix: add a Detect repo state step that examines pyproject.toml + lockfile presence and emits one of four states: - skip: no pyproject.toml; emit a notice and continue (no install or tests run, the job succeeds with a step summary) - uv-locked: uv.lock present; install via uv sync --all-extras --frozen - uv-no-lock: PEP 621 only; install via uv sync --all-extras (without --frozen) so the lockfile is generated in-job - poetry-not-supported: poetry.lock or [tool.poetry] present; fail with an actionable error directing the caller to convert to uv per org policy (separate migration workstream) Install + Run tests steps are gated by the detected state so each caller runs only the correct path. The FROZEN_FLAG env var lets the test command template handle the with/without-lockfile case without branching. Impact: repairs Python Compatibility on 11 uv repos (cookiecutter-template- sample, maester-tests, llc-manager, Unify, dna, GCS, image-preprocessing- detector, monte_carlo, testing, zen-mcp-server, plus DeQA-Doc which now skips cleanly). The 4 Poetry repos surface an actionable error pointing at the poetry-to-uv migration tracking issues. Reference: docs/audits/cve-scan-coverage-2026-05-25.md addendum (CI Repair Sprint, Task 9 in current session). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe Python compatibility workflow restructures dependency installation and testing to detect repository "uv readiness" before execution. It adds a detection phase that skips when Changesuv readiness detection and conditional workflow gating
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Cross-linking the poetry-to-uv migration tracking issues that this PR's
Filed 2026-05-25. Each issue documents the migration steps and acceptance criteria. After those 4 repos complete migration, this PR's poetry-rejection branch becomes effectively dead code (all callers will pass detection); we can leave it as a defensive guardrail or remove in a follow-up. |
There was a problem hiding this comment.
Pull request overview
Fixes the python-compatibility.yml reusable workflow, which previously hardcoded uv sync --all-extras --frozen and broke downstream callers that lacked pyproject.toml, lacked a uv.lock, or used Poetry. A new detection step categorizes the caller into one of four states and gates install/test steps accordingly, restoring 11 downstream repos and explicitly rejecting the 4 Poetry repos with an actionable error.
Changes:
- Adds a "Detect repo state" step emitting
skip/uv-locked/uv-no-lock/poetry-not-supported. - Splits the install step into lockfile vs. no-lockfile variants and adds a skip-notice step; Poetry repos fail fast with a directing error.
- Threads a
FROZEN_FLAGenv into the test step souv rundrops--frozenwhen no lockfile is present.
| - name: Skip notice (no pyproject.toml) | ||
| if: steps.detect.outputs.state == 'skip' | ||
| env: | ||
| MATRIX_PYTHON: ${{ matrix.python }} | ||
| MATRIX_OS: ${{ matrix.os }} | ||
| run: | | ||
| echo "## Python Compatibility Skipped" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "No pyproject.toml at repo root, nothing to test on Python $MATRIX_PYTHON / $MATRIX_OS." >> $GITHUB_STEP_SUMMARY | ||
| shell: bash |
PR Review
Review status: Copilot not requested · CodeRabbit rate-limited · SonarCloud failed · 23/24 CI green Critical
Important
Suggested
SonarQube: 6 issues (3x S8541, 3x S8544), 0 hotspots, all MAJOR severity, all PR-introduced. Copilot: not requested. Investigate Generated with Claude Code |
…OSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in line 292 of python-compatibility.yml and halves the YAML maintenance surface. Test crypto imports step already used the FROZEN_FLAG pattern; no change needed there. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nv + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both codeql and python-security jobs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nale Restores the SonarCloud Quality Gate (Security Rating A on new code) on PR #156 by addressing the 6 MAJOR vulnerabilities introduced by the uv-no-lock detection logic, plus the Copilot finding on coverage upload. Changes: 1. Test step: drop FROZEN_FLAG env var; use literal --frozen unconditionally. The install step always produces uv.lock before this step runs (uv-no-lock generates one during sync; uv-locked has one committed). Eliminates 2 of 3 S8544 findings. 2. uv-no-lock install (line 297): add NOSONAR(S8541,S8544) suppression with rationale. No uv.lock exists by design on this path; --no-build is opt-out via the no-build workflow input (NO_BUILD_FLAG env at line 187), and SonarCloud cannot follow env-var indirection statically. Matches the convention of the existing uv-locked install step at line 292 which uses the same pattern and is accepted by SonarCloud as pre-existing code. 3. Test step run block (lines 326, 332): add NOSONAR(S8541) suppression on each uv run invocation for the same reason as #2. 4. Upload coverage artifact: tighten if: gating to match Run tests, so docs-only callers (state=skip, e.g. DeQA-Doc) and poetry-not-supported callers do not emit upload-artifact "No files were found" warnings when no coverage XML was produced. Addresses Copilot inline review comment on PR #156. Verified locally: pre-commit clean (yamllint, secrets, em-dash checks), YAML structurally valid. actionlint deferred to CI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both quality-checks and matrix-testing jobs. The 9 downstream uv run steps already used the FROZEN_FLAG pattern; only the 2 install steps needed collapsing. Layout-precondition hardening from project_python_ci_audit_2026_05 is preserved untouched. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PR Fix SummaryAddressed all 7 findings from the /pr-review pass (6 SonarCloud + 1 Copilot) in a single commit: SonarCloud (6 of 6 resolved)
Copilot review (1 of 1 resolved)
PR description: updated with a Local validation passed
Deferred (not in scope)
CI re-run triggered by the push. Generated with Claude Code |
|
… --frozen Same pattern as PR #156 (python-compatibility.yml), applied to both jobs in python-fips-compatibility.yml. Root cause: both the fips-check and fips-runtime-test jobs hardcoded `uv run --frozen` and `uv sync --all-extras --frozen` respectively. These failed across the fleet for the same caller categories: 1. Repos without pyproject.toml at root: no error context to anchor on 2. uv-managed repos with no uv.lock yet: --frozen requires uv.lock 3. Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master): uv cannot read poetry-locked projects Fix: add a Detect repo state step to each job that examines pyproject.toml + lockfile presence and emits one of four states (skip, uv-locked, uv-no-lock, poetry-not-supported). Subsequent uv commands gate on the detected state and swap the --frozen flag in via FROZEN_FLAG env. Poetry repos fail fast with an actionable error pointing at the migration tracking issues. Affected jobs: - fips-check (Run FIPS compatibility check step, lines 181 + 190 of original): uv run --frozen --> uv run $FROZEN_FLAG, gated on detect state - fips-runtime-test (Install dependencies + Test crypto imports steps): same pattern as python-compatibility.yml Impact: repairs FIPS Compatibility across 6 uv repos (maester-tests, dna, GCS, monte_carlo, testing, zen-mcp-server). The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md addendum (CI Repair Sprint, Task 9 in current session). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…OSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in line 292 of python-compatibility.yml and halves the YAML maintenance surface. Test crypto imports step already used the FROZEN_FLAG pattern; no change needed there. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… --frozen (#157) * fix(python-fips): detect repo state instead of hardcoding uv sync/run --frozen Same pattern as PR #156 (python-compatibility.yml), applied to both jobs in python-fips-compatibility.yml. Root cause: both the fips-check and fips-runtime-test jobs hardcoded `uv run --frozen` and `uv sync --all-extras --frozen` respectively. These failed across the fleet for the same caller categories: 1. Repos without pyproject.toml at root: no error context to anchor on 2. uv-managed repos with no uv.lock yet: --frozen requires uv.lock 3. Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master): uv cannot read poetry-locked projects Fix: add a Detect repo state step to each job that examines pyproject.toml + lockfile presence and emits one of four states (skip, uv-locked, uv-no-lock, poetry-not-supported). Subsequent uv commands gate on the detected state and swap the --frozen flag in via FROZEN_FLAG env. Poetry repos fail fast with an actionable error pointing at the migration tracking issues. Affected jobs: - fips-check (Run FIPS compatibility check step, lines 181 + 190 of original): uv run --frozen --> uv run $FROZEN_FLAG, gated on detect state - fips-runtime-test (Install dependencies + Test crypto imports steps): same pattern as python-compatibility.yml Impact: repairs FIPS Compatibility across 6 uv repos (maester-tests, dna, GCS, monte_carlo, testing, zen-mcp-server). The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md addendum (CI Repair Sprint, Task 9 in current session). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(python-fips): collapse install steps via FROZEN_FLAG env + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in line 292 of python-compatibility.yml and halves the YAML maintenance surface. Test crypto imports step already used the FROZEN_FLAG pattern; no change needed there. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(quality): suppress S8541/S8544 in python-fips with rationale; tighten gates Mirrors the eecbaa3 pattern already on python-compatibility.yml main. Restores the SonarCloud Quality Gate (Security Rating A on new code) and closes the structural gaps the pr-review surfaced. fips-check job (no install step pre-generates uv.lock, so $FROZEN_FLAG must remain dynamic; suppression with rationale is the correct path): 1. Add multi-line rationale comment before the step explaining the env-var indirection SonarCloud cannot follow statically. 2. Suppress both uv run invocations with NOSONAR(S8541,S8544) plus inline rationale, replacing the previous absent suppression at lines 201, 210. 3. Add shell: bash to the run block for declaration consistency with the detect step above. 4. Add #ASSUME and #VERIFY RAD tags on the FROZEN_FLAG ternary per repo CLAUDE.md (mandatory for reusable workflow gating logic). fips-runtime-test job (mirrors python-compatibility.yml exactly): 1. Split Install dependencies into uv-locked / uv-no-lock variants so the literal --frozen stays visible to the scanner on the locked path. 2. uv-no-lock variant carries NOSONAR(S8541,S8544) with rationale (replaces the previous incomplete `# NOSONAR S8541` at line 440). 3. Test crypto imports: drop FROZEN_FLAG env, use literal --frozen with inline NOSONAR(S8541). Safe because the install step above always produces uv.lock before this step runs. 4. Add shell: bash to all new run steps. Tighten if: gates to avoid false failures and noisy artifact warnings: 5. Upload FIPS report: add detect-state condition so docs-only callers (state=skip) and poetry-not-supported callers do not emit upload- artifact "No files were found" warnings when the FIPS check produced no report. 6. Check result: add detect-state condition so skip / poetry-not-supported callers do not trigger a false failure from the empty exit_code output (`empty != '0'` would otherwise evaluate true). Verified locally: - pre-commit clean (yamllint, secrets, em-dash checks) - YAML structurally valid - All six SonarCloud open vulnerabilities (S8541 + S8544 at lines 201, 210, 449, 440) addressed with the suppression style python-compatibility uses on main. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * docs: empirical findings on SonarCloud NOSONAR placement in GHA YAML Captures the observation that preceding-line NOSONAR comments inside a YAML pipe block scalar do NOT suppress S8544 when the next line uses a dynamic flag (FROZEN_FLAG), even though the same placement pattern DOES suppress S8541 when the next line carries the literal --frozen token. Inline NOSONAR on a YAML run: line works for any rule combination. The team has multiple reusable workflows using these rules; this doc gives them the verification protocol and the recommended patterns up front so the next remediation does not iterate empirically. Source data: - python-compatibility.yml on main: inline + preceding-line patterns, quality gate passing - python-fips-compatibility.yml in PR #157 commit e797676: preceding-line NOSONAR(S8541,S8544) inside a pipe block left 4 of 6 vulnerabilities unsuppressed Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(quality): restructure fips-check to expose literal --frozen for SonarCloud Phase C re-fix following commit e797676. The preceding-line NOSONAR(S8541,S8544) inside the fips-check pipe block was not honored by SonarCloud (still flagged lines 210, 220). Restructure to mirror the python-compatibility.yml sibling exactly: add install steps before the FIPS check, then use literal --frozen on the uv run lines (Pattern A from docs/sonarcloud-nosonar-patterns.md). Changes to fips-check job: 1. Add Install dependencies (uv with lockfile) step gated on state=uv-locked, using literal uv sync --all-extras --frozen NO_BUILD_FLAG. No suppression needed; literal --frozen is visible. 2. Add Install dependencies (uv without lockfile) step gated on state=uv-no-lock, using uv sync --all-extras NO_BUILD_FLAG with inline NOSONAR(S8541,S8544) and rationale. 3. Run FIPS compatibility check: drop FROZEN_FLAG env var, use literal uv run --frozen NO_BUILD_FLAG python SCRIPT_PATH on both invocations. Add NOSONAR(S8541) as a preceding bash comment in the pipe block (Pattern B from the same doc). 4. Update preamble comment to reflect new structure; keep ASSUME and VERIFY RAD tags pointing at the install steps. Trade-off: adds 1-2 min of cache-friendly install runtime per fips-check job invocation that previously skipped it. Acceptable for the deterministic suppression behavior; matches the sibling design. Verified locally: pre-commit clean (yamllint, em-dash, secrets); FROZEN_FLAG completely removed from the file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…g uv sync/run --frozen Same pattern as PR #156 (python-compatibility.yml) and #157 (python-fips-compatibility.yml). Root cause: codeql and python-security (Bandit) jobs hardcoded `uv sync --frozen` and `uv run --frozen`, which failed on three caller categories: repos without pyproject.toml (DeQA-Doc), uv-managed repos without uv.lock yet, and Poetry repos (uv cannot parse poetry projects). Fix: detect-state step + gated install/run steps in both jobs (codeql, python-security). Each job has its own Detect step because every job runs on a fresh runner with a fresh checkout. The detect step exits 1 with an actionable error for Poetry repos, prints a job summary notice when pyproject.toml is absent, and drops --frozen when uv.lock is not yet present. Impact: repairs Security Analysis across the uv repos in the fleet. The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md (CI Repair Sprint). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nv + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both codeql and python-security jobs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…-frozen Same pattern as PR #156 (python-compatibility.yml) and #157 (python-fips-compatibility.yml). Root cause: the quality-checks and matrix-testing jobs ran `uv sync --all-extras --frozen` and `uv run --frozen` unconditionally, crashing on (1) repos without pyproject.toml, (2) uv-managed repos without uv.lock yet, and (3) Poetry repos that should not be served by this uv-only workflow. Added a Detect repo state step in both jobs that emits one of four states (skip, uv-locked, uv-no-lock, poetry-not-supported) and gated every install and test step on that state. uv run sites now read FROZEN_FLAG from the detect step so the --frozen flag is dropped only when no lockfile exists. The Validate source layout precondition (per project_python_ci_audit_2026_05.md) is preserved unchanged. The llm-governance job does not use uv and was not modified. Impact: repairs CI across the uv repos in the fleet. The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md (CI Repair Sprint). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both quality-checks and matrix-testing jobs. The 9 downstream uv run steps already used the FROZEN_FLAG pattern; only the 2 install steps needed collapsing. Layout-precondition hardening from project_python_ci_audit_2026_05 is preserved untouched. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…-frozen (#159) * fix(python-ci): detect repo state instead of hardcoding uv sync/run --frozen Same pattern as PR #156 (python-compatibility.yml) and #157 (python-fips-compatibility.yml). Root cause: the quality-checks and matrix-testing jobs ran `uv sync --all-extras --frozen` and `uv run --frozen` unconditionally, crashing on (1) repos without pyproject.toml, (2) uv-managed repos without uv.lock yet, and (3) Poetry repos that should not be served by this uv-only workflow. Added a Detect repo state step in both jobs that emits one of four states (skip, uv-locked, uv-no-lock, poetry-not-supported) and gated every install and test step on that state. uv run sites now read FROZEN_FLAG from the detect step so the --frozen flag is dropped only when no lockfile exists. The Validate source layout precondition (per project_python_ci_audit_2026_05.md) is preserved unchanged. The llm-governance job does not use uv and was not modified. Impact: repairs CI across the uv repos in the fleet. The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md (CI Repair Sprint). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(python-ci): collapse install steps via FROZEN_FLAG env + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both quality-checks and matrix-testing jobs. The 9 downstream uv run steps already used the FROZEN_FLAG pattern; only the 2 install steps needed collapsing. Layout-precondition hardening from project_python_ci_audit_2026_05 is preserved untouched. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(quality): restructure python-ci to expose literal --frozen for SonarCloud Applies the same restructure pattern landed in PR #157 (python-fips) and PR #158 (python-security-analysis) to python-ci.yml. See docs/sonarcloud-nosonar-patterns.md for the full background. Changes across both jobs in python-ci.yml (quality-checks and matrix-testing): 1. Split Install dependencies steps into uv-locked / uv-no-lock variants. uv-locked uses literal uv sync --all-extras --frozen $NO_BUILD_FLAG; uv-no-lock carries inline NOSONAR(S8541,S8544) with rationale. 2. Drop FROZEN_FLAG env var from every downstream step in both jobs: - Ruff formatter check, Ruff linter, BasedPyright - Dead code detection with Vulture - Unit / integration / security tests (3 pytest invocations) - Combined coverage report (4 coverage invocations) - Security scan with Bandit (2 invocations, if/else branches) - Dependency vulnerability scan with pip-audit (2 invocations) - Matrix test runner 3. Replace every $FROZEN_FLAG with literal --frozen on uv run lines. 4. Add # NOSONAR(S8541) as a preceding bash comment to every uv run line in the run: blocks (17 total). 5. Update the echo error-message hint in Ruff formatter check from uv run $FROZEN_FLAG to uv run --frozen so the displayed remediation command matches what the workflow now executes. Trade-off: matches sibling design. No new install runtime; the install step was already running unconditionally on every CI job. Quality gate should flip to A on new code after re-analysis. Verified locally: pre-commit clean (yamllint, em-dash, secrets, commitizen); FROZEN_FLAG completely removed from the file; no empty env: blocks; indentation preserved across if/else shell branches. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…g uv sync/run --frozen Same pattern as PR #156 (python-compatibility.yml) and #157 (python-fips-compatibility.yml). Root cause: codeql and python-security (Bandit) jobs hardcoded `uv sync --frozen` and `uv run --frozen`, which failed on three caller categories: repos without pyproject.toml (DeQA-Doc), uv-managed repos without uv.lock yet, and Poetry repos (uv cannot parse poetry projects). Fix: detect-state step + gated install/run steps in both jobs (codeql, python-security). Each job has its own Detect step because every job runs on a fresh runner with a fresh checkout. The detect step exits 1 with an actionable error for Poetry repos, prints a job summary notice when pyproject.toml is absent, and drops --frozen when uv.lock is not yet present. Impact: repairs Security Analysis across the uv repos in the fleet. The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md (CI Repair Sprint). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nv + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both codeql and python-security jobs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…g uv sync/run --frozen (#158) * fix(python-security-analysis): detect repo state instead of hardcoding uv sync/run --frozen Same pattern as PR #156 (python-compatibility.yml) and #157 (python-fips-compatibility.yml). Root cause: codeql and python-security (Bandit) jobs hardcoded `uv sync --frozen` and `uv run --frozen`, which failed on three caller categories: repos without pyproject.toml (DeQA-Doc), uv-managed repos without uv.lock yet, and Poetry repos (uv cannot parse poetry projects). Fix: detect-state step + gated install/run steps in both jobs (codeql, python-security). Each job has its own Detect step because every job runs on a fresh runner with a fresh checkout. The detect step exits 1 with an actionable error for Poetry repos, prints a job summary notice when pyproject.toml is absent, and drops --frozen when uv.lock is not yet present. Impact: repairs Security Analysis across the uv repos in the fleet. The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md (CI Repair Sprint). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(security-analysis): collapse install steps via FROZEN_FLAG env + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both codeql and python-security jobs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(quality): restructure python-security-analysis to expose literal --frozen for SonarCloud Applies the same restructure pattern landed in PR #157 (python-fips- compatibility.yml) to python-security-analysis.yml. See docs/sonarcloud-nosonar-patterns.md for the full background; the short version is that SonarCloud cannot follow $FROZEN_FLAG env-var indirection, and preceding-line NOSONAR(S8541,S8544) inside a `|` block is not honored. Changes to both jobs in python-security-analysis.yml: CodeQL job (lines 169-183): 1. Split Install dependencies into uv-locked / uv-no-lock variants. uv-locked uses literal `uv sync --no-dev --frozen $NO_BUILD_FLAG`; uv-no-lock carries inline NOSONAR(S8541,S8544) with rationale. Python SAST (Bandit) job (lines 295-332): 2. Same Install split. 3. Bandit Static Analysis step: drop FROZEN_FLAG env, use literal `uv run --frozen $NO_BUILD_FLAG bandit ...` with preceding-line NOSONAR(S8541). Add shell: bash explicitly. Trade-off: adds ~1-2 min of cache-friendly install runtime to the uv-no-lock path on the CodeQL job; matches sibling design. Verified locally: pre-commit clean (yamllint, em-dash, secrets); FROZEN_FLAG completely removed from the file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore(python-security-analysis): add reciprocal keep-in-sync pointer to detect-state block The python-security job's detect-state block already references the codeql job ("Same logic as the codeql job above; each job runs on its own runner..."), but the codeql block had no reciprocal pointer. Adds a one-line "Mirrored in the python-security job below; keep both blocks in sync" comment so future edits in either direction surface the duplication constraint. Pure comment change; no behavior delta. Pre-commit clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…run --frozen (#160) Apply split-install detect-state pattern (validated by merged PRs #156, #157, #159). Branches on pyproject.toml + lockfile presence: skip when no pyproject (test job notice; release job fails fast), reject poetry repos with actionable error, use literal --frozen on uv-locked path, no --frozen on uv-no-lock path. Avoids the dynamic-FROZEN_FLAG anti-pattern (preceding-line NOSONAR inside run: block scalars is not honored by SonarCloud's githubactions rule set for dynamic flags; see BWCPA/.github docs/sonarcloud-nosonar-patterns.md delivered in PR #157). Affects test job (1 install + 4 uv run steps) and release job (1 install + uv build + SBOM gen). publish-pypi job unchanged (uses uv publish only, no --frozen).
…nc --frozen Apply the split-install detect-state pattern established by merged PRs #156-#160. Branches on pyproject.toml + lockfile presence: skip when no pyproject, fail fast on poetry repos with actionable error, use --frozen on uv-locked repos and bare uv sync on uv-no-lock repos. Install step is split into two if-guarded variants so SonarCloud sees literal --frozen on the uv-locked path (S8544 cannot fire). The uv-no-lock variant inlines NOSONAR(S8541,S8544) with rationale; uv.lock does not exist by design on that path. The shell branching on extra-dependencies input is preserved inside each install step (flattening to step variants would obscure intent). The pytest run step uses literal --frozen with a preceding-line NOSONAR(S8541) for --no-build only; this placement is honored when the underlying line is otherwise clean per python-mutation.yml:159-169 precedent. Downstream analysis steps (Verify coverage, SonarCloud Scan, Wait, Check Quality Gate, Quality Gate Summary, Upload coverage artifacts, Fail on Quality Gate) gain detect-state guards so the skip path exits the job cleanly.
…njection Addresses CodeQL alerts #182 and #183 (py/code-injection) and Important findings from /pr-review on PR #166. Critical: - Map steps.extras.outputs.flag to env UV_EXTRAS on both install steps so it reaches bash as a variable value rather than being interpolated into the run: script via GitHub-side template expansion. Template expansion runs before bash sees the line; without env mapping, any shell metacharacters in flag would become script text. The flag derives from inputs.extra-dependencies, a caller-controlled reusable workflow input. - Add #CRITICAL / #VERIFY RAD annotations near the install steps documenting the env-mapping invariant per project CLAUDE.md. Pattern alignment with PRs #156/#158/#160: - Remove NOSONAR(S8541) on the uv-locked install step. The canonical precedent keeps the locked install line bare on the rationale that literal --frozen makes the line scanner-clean; only the uv-no-lock branch carries NOSONAR. Polish: - Strip leading space in FLAG accumulator so the for-loop branch produces the same shape as --all-extras and empty branches. - Escape ] explicitly in poetry detection regex for reader clarity (functional no-op; the original was correct ERE). - Document why the downstream if: conditions use the positive disjunction (state == 'uv-locked' || state == 'uv-no-lock') rather than the shorter negative form; the negative form would incorrectly run downstream steps when steps.detect.outputs.state is empty after an upstream failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous commit (6fa51ff) removed NOSONAR(S8541) on the uv-locked install line on the assumption that it would match the #156/#158/#160 precedent of keeping the locked-install line bare. SonarCloud's Quality Gate on PR #166 empirically rejected this assumption: S8541 (security rating C) fires on this line regardless of the literal --frozen, because $NO_BUILD_FLAG remains a dynamic env var. Why this workflow differs from #156/#158/#160: the install steps in those PRs likely resolve to a literal --no-build, no flag, or no install at all on the locked path. python-sonarcloud.yml's locked install step uses dynamic $NO_BUILD_FLAG (the no-build: workflow input is opt-out by design for PEP 517 consumers like hatchling), so S8541 matches. Restored the inline NOSONAR(S8541) and updated the header comment to document the empirical divergence so a future reader does not re-attempt the same "match precedent" cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(python-sonarcloud): detect repo state instead of hardcoding uv sync --frozen Apply the split-install detect-state pattern established by merged PRs #156-#160. Branches on pyproject.toml + lockfile presence: skip when no pyproject, fail fast on poetry repos with actionable error, use --frozen on uv-locked repos and bare uv sync on uv-no-lock repos. Install step is split into two if-guarded variants so SonarCloud sees literal --frozen on the uv-locked path (S8544 cannot fire). The uv-no-lock variant inlines NOSONAR(S8541,S8544) with rationale; uv.lock does not exist by design on that path. The shell branching on extra-dependencies input is preserved inside each install step (flattening to step variants would obscure intent). The pytest run step uses literal --frozen with a preceding-line NOSONAR(S8541) for --no-build only; this placement is honored when the underlying line is otherwise clean per python-mutation.yml:159-169 precedent. Downstream analysis steps (Verify coverage, SonarCloud Scan, Wait, Check Quality Gate, Quality Gate Summary, Upload coverage artifacts, Fail on Quality Gate) gain detect-state guards so the skip path exits the job cleanly. * fix(python-sonarcloud): inline NOSONAR per uv sync line in uv-no-lock install step Preceding-line NOSONAR(S8541,S8544) inside the uv-no-lock install step's multi-line run block is not honored by SonarCloud's githubactions rule set (documented anti-pattern in docs/sonarcloud-nosonar-patterns.md). Moving suppression to inline trailing comments on each of the three uv sync lines within the block. The step-level rationale moves into the header comment. Verified: SonarCloud PR #166 flagged S8541 L293 + S8544 L293, L299, L301 (the three uv sync lines). Lines 280 and 282 (uv-locked path, literal --frozen) were NOT flagged, confirming preceding-line NOSONAR(S8541) is honored when the underlying line is otherwise clean of S8544. * fix(python-sonarcloud): collapse install steps to single-line for SonarCloud SonarCloud's githubactions rule set ignores NOSONAR (both preceding-line and inline) inside multi-line run: | blocks for S8541/S8544. Even with inline trailing NOSONAR per uv sync line, PR #166 commit bb31ec1 still flagged 5 vulnerabilities (L296, L302, L304). Restructure: extract the EXTRA_DEPENDENCIES branching into a separate Resolve extras flag step that outputs steps.extras.outputs.flag, then collapse each install step to a single-line run: shape. This is the only reliable Pattern A position for SonarCloud (per docs/sonarcloud-nosonar-patterns.md). Two install steps remain (uv-locked, uv-no-lock); the resolve step unconditionally handles all three extras-modes and outputs a literal flag string consumed by both. * fix(python-sonarcloud): map UV_EXTRAS via env to block GHA template injection Addresses CodeQL alerts #182 and #183 (py/code-injection) and Important findings from /pr-review on PR #166. Critical: - Map steps.extras.outputs.flag to env UV_EXTRAS on both install steps so it reaches bash as a variable value rather than being interpolated into the run: script via GitHub-side template expansion. Template expansion runs before bash sees the line; without env mapping, any shell metacharacters in flag would become script text. The flag derives from inputs.extra-dependencies, a caller-controlled reusable workflow input. - Add #CRITICAL / #VERIFY RAD annotations near the install steps documenting the env-mapping invariant per project CLAUDE.md. Pattern alignment with PRs #156/#158/#160: - Remove NOSONAR(S8541) on the uv-locked install step. The canonical precedent keeps the locked install line bare on the rationale that literal --frozen makes the line scanner-clean; only the uv-no-lock branch carries NOSONAR. Polish: - Strip leading space in FLAG accumulator so the for-loop branch produces the same shape as --all-extras and empty branches. - Escape ] explicitly in poetry detection regex for reader clarity (functional no-op; the original was correct ERE). - Document why the downstream if: conditions use the positive disjunction (state == 'uv-locked' || state == 'uv-no-lock') rather than the shorter negative form; the negative form would incorrectly run downstream steps when steps.detect.outputs.state is empty after an upstream failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(python-sonarcloud): re-add NOSONAR(S8541) on uv-locked install line The previous commit (6fa51ff) removed NOSONAR(S8541) on the uv-locked install line on the assumption that it would match the #156/#158/#160 precedent of keeping the locked-install line bare. SonarCloud's Quality Gate on PR #166 empirically rejected this assumption: S8541 (security rating C) fires on this line regardless of the literal --frozen, because $NO_BUILD_FLAG remains a dynamic env var. Why this workflow differs from #156/#158/#160: the install steps in those PRs likely resolve to a literal --no-build, no flag, or no install at all on the locked path. python-sonarcloud.yml's locked install step uses dynamic $NO_BUILD_FLAG (the no-build: workflow input is opt-out by design for PEP 517 consumers like hatchling), so S8541 matches. Restored the inline NOSONAR(S8541) and updated the header comment to document the empirical divergence so a future reader does not re-attempt the same "match precedent" cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>



Summary
Restores Python Compatibility matrix across the 11 uv-managed downstream repos failing since the workflow assumed every caller has uv.lock + pyproject.toml at root. Adds explicit, actionable handling for the three caller categories that crashed.
Root cause
The Install dependencies step ran
uv sync --all-extras --frozenunconditionally, crashing on:DeQA-Doc(docs-only fork)error: No pyproject.toml found in current directory or any parent directory--frozenrequires uv.lockPromptCraft,ledgerbase,data_ingestor,pp-security-masterFix
New Detect repo state step examines pyproject.toml + lockfile presence and emits one of four states. Each install + test step is gated on the detected state:
skipuv-lockeduv sync --all-extras --frozen $NO_BUILD_FLAG(current behavior)uv-no-lockuv sync --all-extras $NO_BUILD_FLAG(no--frozen)poetry-not-supportedPer the org's uv-only policy for reusable workflows, Poetry repos are explicitly rejected rather than silently muddling through. Migration issues are being filed against the 4 Poetry repos as a separate workstream.
Affected downstream repos (15)
DeQA-Doc(skip),cookiecutter-template-sample,maester-tests,llc-manager,Unify,dna,GCS,image-preprocessing-detector,monte_carlo,testing,zen-mcp-serverPromptCraft,ledgerbase,data_ingestor,pp-security-masterMost callers use
@mainfloating refs and pick up immediately. SHA-pinned callers will need a follow-up pin bump (deferred per CI Repair Sprint plan).SonarCloud impact (added 2026-05-25)
The initial commit
0f43328triggered 6 new MAJOR SonarCloud findings on.github/workflows/python-compatibility.yml, failing the Quality Gate(Security Rating C, required A). Follow-up commit
eecbaa3addressesthem:
Run testsstep: eliminated by droppingthe
FROZEN_FLAGenv var and using literal--frozenunconditionally.The install step always produces
uv.lockbefore tests run, so theliteral is safe in both
uv-lockedanduv-no-lockstates.uv-no-lockinstall step: suppressedwith
# NOSONAR(S8544)and rationale. Nouv.lockexists by design onthis path; that is the entire point of the state.
uv-no-lockinstall andRun testssteps: suppressed with
# NOSONAR(S8541)and rationale.--no-buildis opt-out via the
no-buildworkflow input (NO_BUILD_FLAGenv atline 187, per PR feat(workflows): add no-build opt-out input to all reusable workflows #112); SonarCloud cannot follow the env-var
indirection. The pre-existing
uv-lockedinstall step (line 292) usesthe same pattern and is already accepted by SonarCloud.
Also addresses the Copilot inline review on the
Upload coverage artifactstep: gated on the same detected states asRun testssodocs-only callers (state=skip) and poetry-not-supported callers no
longer emit
upload-artifact "No files were found"warnings.Test plan
@maincallers (e.g.,python-libs,Unify): confirm next Python Compatibility run succeedsDeQA-Doc: confirm it now skips with a notice instead of failingledgerbase): confirm it fails with the new actionable error pointing at migrationReference:
docs/audits/cve-scan-coverage-2026-05-25.md(CI Repair Sprint addendum, Task 9 in current session).Generated with Claude Code
Summary by CodeRabbit