From e77c9e968d88354767e8d6ba473febdad770dd1c Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 21 Sep 2026 16:25:49 -0700 Subject: [PATCH 1/5] ci: parallelize slow source-lint guards --- .github/workflows/ci-guards.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-guards.yml b/.github/workflows/ci-guards.yml index 02c755c6eb3a..6c2edd5e9e6f 100644 --- a/.github/workflows/ci-guards.yml +++ b/.github/workflows/ci-guards.yml @@ -563,7 +563,13 @@ jobs: workflow-guard-source-lints: if: ${{ inputs.linux_guard_source == 'true' }} - # Slow guards run beside workflow-guard-tests so they do not extend it. + name: workflow-guard-source-lints / ${{ matrix.group }} + strategy: + fail-fast: false + matrix: + group: [sidebar-layout, dispatch-ownership] + # These source-policy scans are independent and each dominates wall time; + # run them concurrently and aggregate through the reusable-workflow job. runs-on: ${{ vars.LINUX_RUNNER || 'blacksmith-4vcpu-ubuntu-2404' }} timeout-minutes: 15 permissions: @@ -583,12 +589,15 @@ jobs: run: python3 -m pip install --disable-pip-version-check --no-input PyYAML==6.0.3 bashlex==0.18 - name: Validate sidebar lazy-layout guard + if: ${{ matrix.group == 'sidebar-layout' }} run: python3 tests/test_ci_sidebar_lazy_layout_guard.py - name: Initialize Bonsplit for deferred-work ownership guard + if: ${{ matrix.group == 'dispatch-ownership' }} run: git submodule update --init --depth 1 vendor/bonsplit - name: Validate stored DispatchWorkItem ownership + if: ${{ matrix.group == 'dispatch-ownership' }} run: | python3 tests/test_lint_stored_dispatch_work_items.py python3 scripts/lint-stored-dispatch-work-items.py From cbe70010857b3db17864268863bf22dd6accfbc2 Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 21 Sep 2026 16:25:52 -0700 Subject: [PATCH 2/5] test: cover source-lint guard matrix --- tests/test_ci_change_areas.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_ci_change_areas.py b/tests/test_ci_change_areas.py index c003f30eac20..9ebfc09842eb 100644 --- a/tests/test_ci_change_areas.py +++ b/tests/test_ci_change_areas.py @@ -1819,6 +1819,25 @@ def test_linux_preflight_allows_skipped_guard_call_when_all_guard_routes_are_fal assert result.returncode == 0, result.stderr +def test_source_lint_matrix_runs_independent_slow_scans_in_parallel() -> None: + block = workflow_job_block("workflow-guard-source-lints", GUARD_WORKFLOW) + + assert "name: workflow-guard-source-lints / ${{ matrix.group }}" in block + assert "group: [sidebar-layout, dispatch-ownership]" in block + assert ( + "- name: Validate sidebar lazy-layout guard\n" + " if: ${{ matrix.group == 'sidebar-layout' }}" + ) in block + assert ( + "- name: Initialize Bonsplit for deferred-work ownership guard\n" + " if: ${{ matrix.group == 'dispatch-ownership' }}" + ) in block + assert ( + "- name: Validate stored DispatchWorkItem ownership\n" + " if: ${{ matrix.group == 'dispatch-ownership' }}" + ) in block + + def test_history_guard_uses_shallow_synthetic_merge_parent() -> None: block = workflow_job_block("workflow-guard-history", GUARD_WORKFLOW) assert "github.event_name == 'workflow_dispatch' && '0' || '2'" in block From 450ede31866373b0b29667782832818dfa8c6a87 Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 21 Sep 2026 16:30:07 -0700 Subject: [PATCH 3/5] ci: own source-lint topology contract in Linux lane --- .github/workflows/ci-guards.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci-guards.yml b/.github/workflows/ci-guards.yml index 6c2edd5e9e6f..890b6b79f20c 100644 --- a/.github/workflows/ci-guards.yml +++ b/.github/workflows/ci-guards.yml @@ -588,6 +588,10 @@ jobs: - name: Install workflow guard Python dependencies run: python3 -m pip install --disable-pip-version-check --no-input PyYAML==6.0.3 bashlex==0.18 + - name: Validate source-lint guard structure + if: ${{ matrix.group == 'sidebar-layout' }} + run: python3 tests/test_ci_source_lint_guard_structure.py + - name: Validate sidebar lazy-layout guard if: ${{ matrix.group == 'sidebar-layout' }} run: python3 tests/test_ci_sidebar_lazy_layout_guard.py From 8ce3daebd3b296ff97688d7c063697f8b9581675 Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 21 Sep 2026 16:30:10 -0700 Subject: [PATCH 4/5] test: keep source-lint topology out of router self-tests --- tests/test_ci_change_areas.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/test_ci_change_areas.py b/tests/test_ci_change_areas.py index 9ebfc09842eb..c003f30eac20 100644 --- a/tests/test_ci_change_areas.py +++ b/tests/test_ci_change_areas.py @@ -1819,25 +1819,6 @@ def test_linux_preflight_allows_skipped_guard_call_when_all_guard_routes_are_fal assert result.returncode == 0, result.stderr -def test_source_lint_matrix_runs_independent_slow_scans_in_parallel() -> None: - block = workflow_job_block("workflow-guard-source-lints", GUARD_WORKFLOW) - - assert "name: workflow-guard-source-lints / ${{ matrix.group }}" in block - assert "group: [sidebar-layout, dispatch-ownership]" in block - assert ( - "- name: Validate sidebar lazy-layout guard\n" - " if: ${{ matrix.group == 'sidebar-layout' }}" - ) in block - assert ( - "- name: Initialize Bonsplit for deferred-work ownership guard\n" - " if: ${{ matrix.group == 'dispatch-ownership' }}" - ) in block - assert ( - "- name: Validate stored DispatchWorkItem ownership\n" - " if: ${{ matrix.group == 'dispatch-ownership' }}" - ) in block - - def test_history_guard_uses_shallow_synthetic_merge_parent() -> None: block = workflow_job_block("workflow-guard-history", GUARD_WORKFLOW) assert "github.event_name == 'workflow_dispatch' && '0' || '2'" in block From 7cc98bfc67d74c6c6d1656224d2214774c9a9295 Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 21 Sep 2026 16:30:13 -0700 Subject: [PATCH 5/5] test: add source-lint workflow contract --- tests/test_ci_source_lint_guard_structure.py | 51 ++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/test_ci_source_lint_guard_structure.py diff --git a/tests/test_ci_source_lint_guard_structure.py b/tests/test_ci_source_lint_guard_structure.py new file mode 100644 index 000000000000..9205e7d904d7 --- /dev/null +++ b/tests/test_ci_source_lint_guard_structure.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +"""Structural contract for the reusable source-lint guard lane.""" + +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +GUARD_WORKFLOW = ROOT / ".github" / "workflows" / "ci-guards.yml" + + +def workflow_job_block(job_name: str) -> str: + lines = GUARD_WORKFLOW.read_text(encoding="utf-8").splitlines() + marker = f" {job_name}:" + for index, line in enumerate(lines): + if line != marker: + continue + body = [line] + for following in lines[index + 1 :]: + if ( + following.startswith(" ") + and not following.startswith(" ") + and following.strip() + ): + break + body.append(following) + return "\n".join(body) + raise AssertionError(f"{job_name} job not found") + + +def test_source_lint_matrix_runs_independent_slow_scans_in_parallel() -> None: + block = workflow_job_block("workflow-guard-source-lints") + + assert "name: workflow-guard-source-lints / ${{ matrix.group }}" in block + assert "group: [sidebar-layout, dispatch-ownership]" in block + assert ( + "- name: Validate sidebar lazy-layout guard\n" + " if: ${{ matrix.group == 'sidebar-layout' }}" + ) in block + assert ( + "- name: Initialize Bonsplit for deferred-work ownership guard\n" + " if: ${{ matrix.group == 'dispatch-ownership' }}" + ) in block + assert ( + "- name: Validate stored DispatchWorkItem ownership\n" + " if: ${{ matrix.group == 'dispatch-ownership' }}" + ) in block + + +if __name__ == "__main__": + test_source_lint_matrix_runs_independent_slow_scans_in_parallel() + print("PASS: source-lint guard workflow structure")