Skip to content

infra: port .github/actions/run-swift-format's three shell steps to Python (GEN-005 sweep, #962) #2792

Closed

Description

@zackees

What

.github/actions/run-swift-format/action.yaml still carries three multi-line
run: steps, so ci-lint precheck reports three GEN-005 approved exceptions
for that path (the block at ci.toml:330-335, reason "Upstream OBS
build/packaging scripts … tracked in #962"). #962 is closed and the Python-port
sweep has moved through the composite actions since (compatibility-validator,
services-validator, flatpak-manifest-validator, qt-xml-validator,
generate-docs, check-changes); this action is the same shape and is still
shell.

Findings on origin/master (ci-lint precheck, pin a1917ce7…, header
5 violation(s), 414 approved exception(s), 10 needs_review):

  • runs.steps[0] — the Windows runner guard (if: runner.os == 'Windows', bash)
  • runs.steps[2] — the Linux brew update / brew install zsh step
  • runs.steps[3] — the Run swift-format 🔥 step: shell: zsh --no-rcs --errexit --pipefail,
    the zsh ${(s:,:)CHANGED_FILES//[\[\]\'\"]/} split, and the call to
    build-aux/run-swift-format --fail-<condition> --check <files>

runs.steps[1] is a uses: step (./.github/actions/check-changes) and is not
a finding.

Fix

One Python module with one subcommand per step, each step a single
uv run call, mirroring the merged compatibility-validator port (#2692):

  • a pinned astral-sh/setup-uv step at the top of the action (the caller,
    check-format.yaml's swift-format job on macos-26, installs nothing
    first), with save-cache: and the CACHE-013 cache-suffix expression;
  • ci/run_swift_format.py guard --notice … (still selected by the action's own
    if: runner.os == 'Windows', exit 2);
  • ci/run_swift_format.py install-deps for the Linux brew/zsh step;
  • ci/run_swift_format.py format --fail-condition <c>, reading the same
    CHANGED_FILES env var, splitting it the way the zsh line did, and returning
    build-aux/run-swift-format's status;
  • ci/test_run_swift_format.py as the offline pin (module by path, stub brew
    and stub formatter recording argv), and the ci.toml GEN-005 block for this
    path deleted. The build-aux/run-swift-format exception is a separate path
    and stays.

Why it is safe to change

The swift-format job runs only when a .swift file changed
(ci/swift_changes.py), and the module keeps the step's exact formatter argv,
so a port that is wrong shows as a red Format 🔍 / swift-format job on the
first PR that touches Swift. The RED is the offline test (module absent, block
present); the GREEN is the module plus the action/ci.toml edits, with
ci-lint precheck going from 414 to 411 approved exceptions and no other count
moving.

Activity

  1. added
    infra
    on Oct 28, 2026
  2. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Claiming: investigation — the three GEN-005 findings are already enumerated above, so this is the port itself.

    Plan (one PR, from origin/master):

    1. RED: ci/test_run_swift_format.py (module absent, ci.toml block present).
    2. GREEN: ci/run_swift_format.py (guard / install-deps / format), the action's three steps as single uv run calls plus a pinned Set Up uv, and the GEN-005 [[exceptions]] block for this path deleted.
    3. Evidence: ci-lint precheck 414 -> 411 approved exceptions, no other count moving; uv run ci/local_gate.py --only self-test; ruff check.

    Expected first PR: within the hour.

  3. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    /ready

    Scope is settled (three enumerated findings, one module, one test), so this is Ready rather than an open investigation.

  4. added
    needs-investigation
    on Oct 28, 2026
  5. added
    ready
    and removed
    needs-investigation
    on Oct 28, 2026
  6. added a commit that references this issue on Oct 28, 2026
  7. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Part done: PR #2793 (draft, one PR, both commits).

    • RED 4f9186cdc: ci/test_run_swift_format.py -> Ran 11 tests ... FAILED (failures=3, errors=7).
    • GREEN 4f5b00c10: ci/run_swift_format.py (guard / install-deps / format), the action's three steps as single uv run calls plus a pinned Set Up uv with the CACHE-013 cache-suffix, and the GEN-005 block for this path deleted.
    • ci-lint precheck (pin a1917ce7…): origin/master 5 violation(s), 416 approved exception(s), 10 needs_review -> branch 5 violation(s), 413 approved exception(s), 10 needs_review; the three findings for .github/actions/run-swift-format/action.yaml are gone and no other rule moved.
    • uv run ci/local_gate.py --only self-test -> == self-test: ok; ruff check clean.
    • ci/test_build_aux_formatters.py's live-script pin now follows the call site into the module (build-aux/run-swift-format keeps its own GEN-005 block; it is a different path).
  8. added a commit that references this issue on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infraready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions