Skip to content

Split CodeQL Swift analysis into separate workflow#133

Merged
alexkroman merged 1 commit into
mainfrom
claude/modest-fermat-3pp5q7
Jun 12, 2026
Merged

Split CodeQL Swift analysis into separate workflow#133
alexkroman merged 1 commit into
mainfrom
claude/modest-fermat-3pp5q7

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Summary

Separates Swift CodeQL analysis into a dedicated workflow (codeql-swift.yml) to optimize CI performance. Swift compilation requires a ~25-minute traced build on macOS runners, which is two orders of magnitude slower than interpreted-language scans. This change isolates that cost to only run when Swift code changes.

Key Changes

  • New workflow codeql-swift.yml: Dedicated CodeQL analysis for Swift with:

    • Path filtering to **/*.swift and the workflow itself, so macOS runner time is only spent when Swift code can change results
    • Narrower triggers: excludes merge_group (merge-queue refs are deleted immediately after PR merge, causing SARIF upload failures on slow scans; the push run on main scans the identical result instead)
    • Weekly schedule to keep the default-branch baseline fresh when new queries ship
    • Manual build mode with explicit swiftc invocation matching scripts/check.sh
  • Simplified codeql.yml: Removes Swift analysis and macOS runner:

    • Converts matrix from include-based to simple language list: [python, actions, javascript-typescript]
    • All remaining languages use build-mode: none (interpreted languages, ~1 minute each)
    • Runs only on ubuntu-latest
    • Removes conditional Swift build step
  • Test infrastructure improvements:

    • Adds shared preserve_logging_state fixture in conftest.py to snapshot/restore process-global logging state (root handlers/level, per-logger levels)
    • Refactors test_debuglog.py to use the shared fixture instead of hand-rolling state management
    • Prevents test order dependencies under pytest-randomly (logging leaks only fail on some seeds)
    • Resets websockets wire loggers to NOTSET to prevent earlier tests' silencers from interfering
  • Documentation: Updates AGENTS.md with lessons learned:

    • Tests touching global logging state must use the shared fixture
    • Guidance to check for in-flight duplicates before starting fixes (concurrent sessions can ship identical changes)
  • Linting: Adds preserve_logging_state to pyproject.toml vulture ignore list (fixture parameter, not called directly)

Implementation Details

The Swift workflow uses the same swiftc invocation as the gate (scripts/check.sh), ensuring consistency between local and CI builds. Path filtering prevents unnecessary macOS runner allocation while the weekly schedule maintains baseline freshness independent of code changes.

https://claude.ai/code/session_019CwN6T2ztwvNARvj3z39sP

- Split the Swift CodeQL analysis into codeql-swift.yml: path-filtered to
  Swift changes, no merge_group trigger. The ~25-minute traced macOS build
  outlived the merge-queue ref on every fast merge, failing the SARIF
  upload with "ref not found" on 7 consecutive queued PRs, and burned
  ~25 macOS runner-minutes per PR for a file that rarely changes. The
  push-to-main run scans the identical merge result; the weekly sweep
  keeps the baseline fresh.
- Promote the debuglog tests' logging snapshot/restore into a shared
  preserve_logging_state conftest fixture so the next module that touches
  process-global logging doesn't rediscover the pytest-randomly order
  dependence that cost PR #125 a red CI round.
- AGENTS.md: note the shared fixture, and tell concurrent sessions to
  check open PRs / recent main commits before starting a fix (PR #89 was
  closed as an exact duplicate of #90).

https://claude.ai/code/session_019CwN6T2ztwvNARvj3z39sP
@alexkroman alexkroman enabled auto-merge June 12, 2026 21:46
@alexkroman alexkroman added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit 7ac0c4c Jun 12, 2026
16 checks passed
@alexkroman alexkroman deleted the claude/modest-fermat-3pp5q7 branch June 12, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants