Skip to content

ci: port the macOS analysis steps to ci/analyze_project.py, clearing the analyze-project GEN-005 block (#3040) - #3043

Merged
zackees merged 2 commits into
masterfrom
infra/3040-analyze-project-python
Oct 30, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/3040-analyze-project-python

Conversation

@zackees

@zackees zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member

Fixes #3040

.github/workflows/analyze-project.yaml carried four GEN-005 findings, all recorded in one path-scoped ci.toml approved exception:

  1. jobs.windows.defaults.run.shell: pwsh — the PVS-Studio job has no run: step at all (every step is uses:), so the shell line was dead configuration.
  2. jobs.macos.steps[1] Set Up Environment
  3. jobs.macos.steps[3] Build OBS Studio
  4. jobs.macos.steps[4] Compile Analytics Data

The three macOS steps are now one call each, so the whole block leaves the baseline:

run: uv run --no-project --script ci/analyze_project.py setup
run: uv run --no-project --script ci/analyze_project.py build
run: uv run --no-project --script ci/analyze_project.py merge-sarif

ci/analyze_project.py

  • setup — sudo xcode-select --switch /Applications/Xcode_26.5.app/Contents/Developer, the step's Homebrew cleanup (its unwanted_formulas array is empty upstream, so the uninstall is a no-op today but stays supported), mkdir -p of Library/Developer/Xcode/DerivedData/CompilationCache.noindex, and xcodeCasPath= appended to $GITHUB_OUTPUT (the build step's XCODE_CAS_PATH).
  • build — --config Debug --target macos-arm64 --codesign --analyze, plus --debug when RUNNER_DEBUG is set; git fetch origin --no-tags --no-recurse-submodules -q; then .github/scripts/build-macos with that argv.
  • merge-sarif — flattens analytics/StaticAnalyzer/obs-studio/**/*.plist to analytics/<name>.sarif and reproduces the step's jq -s program in Python: first $schema/version, the first tool.driver without rules, the concatenated de-duplicated rules and artifacts, every results entry, and codeFlows[].threadFlows[].locations[].location.physicalLocation.region.endLine/endColumn dropped where they are 0.

The macos job gains a pinned astral-sh/setup-uv step (the same bec219d2 v10.1.0 the other jobs use, master-only save plus the pr-<N> cache-suffix) because the ported steps need uv on a runner that installed none. The permanently disabled PVS-Studio job is otherwise untouched.

RED — 4791138d3

ci/test_analyze_project.py alone. On master it fails on the workflow shape (run: | present, shell: pwsh present, steps are not module calls) and on the ci.toml block.

GREEN — 93f8354f6

Module, workflow edit and the ci.toml block deletion together. ci-lint precheck header:

  • before: 4 violation(s), 368 approved exception(s), 2 needs_review
  • after: 4 violation(s), 364 approved exception(s), 2 needs_review

No GEN-005 finding remains for .github/workflows/analyze-project.yaml, and no other rule moved. The four remaining violations are the documented structural floor (CACHE-004, GEN-004, SEC-003, WF-003).

Evidence

  • uv run --no-project python -m unittest ci/test_analyze_project — 13 tests, OK. Includes a differential run of the verbatim old jq -s program against merge on two analyzer reports (shared rule, shared artifact, one zero-sized code-flow region) when jq is on PATH; the merged documents compare equal, and the rules/artifacts/results counts match.
  • uv run --no-project ruff check ci/analyze_project.py ci/test_analyze_project.py — clean.
  • uv run ci/local_gate.py --only self-test — one unrelated, pre-existing failure: ci/test_check_changes.py::OutputsTest::test_outputs_are_written_to_the_step_file dies with git: command not found from the module's own subprocess on this NixOS host. It reproduces identically on unmodified origin/master in this checkout, so it is environmental and not caused by this PR.

Not verified here

No PR lane runs analyze-project.yaml (it is workflow_call from scheduled.yaml only), and this host is Linux with no Xcode, so the setup/build subcommands are exercised against a recording runner and their argv/output contract, not against a real macOS runner. The first real clang-analyze run after merge is the acceptance check for the composed steps; merge-sarif is additionally proven against the old jq output above.

The workflow still carries three multi-line zsh steps and its ci.toml
GEN-005 exception, so this pin fails on master and passes once
ci/analyze_project.py and the single-call steps land.
`.github/workflows/analyze-project.yaml` carried four GEN-005 findings: a
`defaults.run.shell: pwsh` in the disabled PVS-Studio job (which has no
`run:` step at all) and three multi-line zsh steps in the macOS job.

The three steps are now one call each:

  uv run --no-project --script ci/analyze_project.py setup
  uv run --no-project --script ci/analyze_project.py build
  uv run --no-project --script ci/analyze_project.py merge-sarif

setup switches Xcode, uninstalls the (currently empty) unwanted Homebrew
formula list, creates the DerivedData compilation cache and writes
xcodeCasPath to $GITHUB_OUTPUT. build assembles the analyzer argv, refreshes
origin and runs .github/scripts/build-macos. merge-sarif flattens the
analyzer plists and merges them, keeping the old jq program's shape: first
$schema/version, the first driver without rules, de-duplicated rules and
artifacts, every result, and zero endLine/endColumn removed.

The macos job gains a pinned setup-uv step (master-only save, pr-<N>
cache-suffix) because the steps now need uv on a runner that installed none.

ci-lint precheck: 4 violation(s), 368 approved exception(s), 2 needs_review
-> 4 violation(s), 364 approved exception(s), 2 needs_review.
@zackees
zackees marked this pull request as ready for review October 30, 2026 10:02
@zackees
zackees added this pull request to the merge queue Oct 30, 2026
@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

PR CI is green (Fast Gate ⚡, Format 🔍 / checks, Validate Data, CI Gate ✅) and the PR is queued for master. This is a ci/-only change (one workflow, one ci.toml block, two new ci/ files), so there is no local-gate attestation stamp to look for.

Precheck moved 4 violation(s), 368 approved exception(s), 2 needs_review -> 4 violation(s), 364 approved exception(s), 2 needs_review; the four remaining violations are the documented structural floor (CACHE-004, GEN-004, SEC-003, WF-003).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

infra: port the macOS analysis steps to ci/analyze_project.py and clear the analyze-project GEN-005 block

1 participant